Search This Blog

Loading...

Saturday, March 31, 2012

Architecture: SOA Governance, the Guiding Principles

As you develop your service-oriented architecture, here are six key governance issues to keep in mind—and preferably begin to define—in the early stages:

1.Business process definition:
Because services are instances of business processes, you need to know what the right processes are. Typically, a joint business-IT group determines these processes and decides which should be standardized across the organization so that the services that deliver them also reflect both the standards and the exceptions.

2.Architectural compliance:
Just as a builder has to follow the architectural plans and code requirements for a house, so does an IT organization have to follow the service standards and development “blueprint.” Typically, a review board vets all application development proposals to ensure they conform to the architecture. Often, they also identify proposals that duplicate existing resources, to enforce reuse.

3.Service management:
A repository of services helps developers and business users know what already exists and what they do. This encourages reuse by IT developers and helps business analysts see what capabilities they might be able to exploit in new ways.

4.Data management:
Just as services can be used and combined in multiple ways, the data they access and act on can come from multiple sources whose context may not be known by all services. This requires a data architecture that makes this context (metadata) explicit so that all services are working from the same set of assumptions, or consistently translating and interpreting the data they use.

5.Security and compliance:
Because services are not standalone applications, they can interact with each other and be accessed by users in unexpected ways. The development and provisioning policies need to test and validate that this mix-and-match approach does not introduce security or access violations.

6.Provisioning management:
Because services can be used by lots of ad hoc, composite applications, execution load may be unpredictable.
There should be policies for determining access priorities and performance levels under such severe usage, including policies for when to spin out clone services and the supporting IT resources to handle high loads.

References:
1- Oracle SOA Governance.
2- CIO articles.


Tuesday, March 27, 2012

JavaFX: Why JavaFX 2.0? Develop Hardware-Accelerated RIA using JAVA.

Why Use JavaFX?


JavaFX provides a powerful Java-based UI platform capable of handling large-scale data-driven business applications.
JavaFX applications are completely developed in Java, one of the most widely deployed technologies with one of the largest developer communities in the world, while leveraging the power of standards-based programming practices and design patterns.

JavaFX provides a rich set of UI controls, graphics and media API with high-performance hardware-accelerated graphics and media engines to simplify development of immersive visual applications.

JavaFX 2.0 is Java’s next generation graphical user interface (GUI) toolkit for developers to rapidly build rich cross-platform applications. Built from the ground up, JavaFX takes advantage of modern GPUs through hardware-accelerated graphics while providing well-designed programming interfaces enabling developers to combine graphics, animation, and UI controls. The new JavaFX 2.0 is a pure Java language application programming interface (API).

The key architectural strategies provided by JavaFX 2.0 API are the reuse of existing Java libraries and the bridging of communication between other languages that run on the JVM (Visage, Jython, Groovy, JRuby, and Scala).

Nandini Ramani of Oracle plainly states the intended direction of JavaFX the platform in the following excerpt from the screen-cast, Introducing JavaFX 2.0:
The industry is moving toward multi-core/multi-threading [type] platforms with GPUs. JavaFX 2.0 leverages these attributes to improve execution efficiency and UI design flexibility. Our initial goal is to give architects and developers of enterprise applications a set of tools and APIs to help them build better data driven business applications.
— Nandini Ramani - Oracle Corp, VP of Development, Java Client Platform.

Table of features and benefits:

Features Benefits
  • Java APIs for JavaFX. JavaFX 2.0 applications are completely developed in Java
  • Developers can use their favorite Java development tools
  • Leverage thousands of existing Java libraries
  • Developers can use popular JVM-based scripting languages, such as Groovy, JRuby and Scala
  • FXML, a scriptable, XML-based markup language for defining user interfaces.
  • Develop and maintain complex user interfaces easily
  • Web rendering engine
  • Seamlessly mix and match native Java capabilities and the dynamic capabilities of web technologies in your applications
  • Seamless integration into Swing applications
  • Existing Swing applications can be updated easily with new JavaFX features, such as rich graphics API, media playback, and embedded Web content
  • High-performance hardware accelerated graphics pipeline
  • JavaFX applications featuring data visualizations and complex user interfaces can leverage modern graphics cards for optimal performance
  • High-performance media engine
  • Playback video and audio content in popular formats within your application
  • Over 50 charts, form and layout components, easily customizable through the use of Cascading Style Sheets (CSS).
  • JavaFX provides all the major UI controls required for the development of a full featured application. Components can be easily skinned using standard Web technologies such as CSS
  • Ubiquitous deployment via the Java Runtime Environment (JRE)
  • The JavaFX Runtime is installed with the Java Runtime Environment, ensuring its availability on more than 97% of enterprise desktops worldwide [Source: Forrester, November 2009: Enterprise Platform Trends, H1 2009]

If you plan to use and develop javaFX based GUI you will need the JavaFX SDK.
By the way now starting with Java SE 7 Update 2, the JDK includes the JavaFX SDK.

For more information & resources:

DOWNLOAD
START LEARNING
API DOCUMENTATION
DISCUSSION FORUM
OTHER RESOURCES

Saturday, March 24, 2012

JDK7: Part 1- The power of java 7 NIO.2 (JSR 203) (important concepts)

Get educated with the new file I/O mechanism introduced in the JDK 7 release.

This is a 2 parts series of article, focuses on JSR 203 java 7 NIO.2 API.
  1. Part 1 will introduce the main concepts involved in the new JSR. 
  2. Part 2 will covers the important aspects involved in developing NIO.2-based applications by examples and case studies for the concepts introduced in part 1, this will spice up your Java 7 applications with the new I/O capabilities. You will learn to develop NIO.2 applications, beginning with simple but essential stuff and gradually moving on to complex features such as sockets and asynchronous channels.
In this article part 1 I will introduce the new and powerful IO API, packaged & delivered in Java SE 7 NIO.2. Also I will cover all the important aspects involved in developing NIO.2-based applications in brief.

Table of contents:
1. Working with the new Path Class (Part 1).
2. Metadata File Attributes (Part 1, 2 (examples)).
3. What is Symbolic and Hard Links? (Part 1, 2 (examples)).
4. New API for Files and Directories (Part 1, 2 (examples)).
5. The FileVisitor Interface (Part 1, 2 (examples)).
6. Monitoring via Watch Service API (Part 1, 2 (examples)).
7. New powerful Random Access Files (Part 1, 2 (examples)).
8. Networking with the Sockets APIs (Part 1, 2 (examples)).
9. The Asynchronous Channel API (Part 1, 2 (examples)).
10. Important Things to Remember (& migration tips from java IO to java NIO.2) (Part 2).
11. References (Part 1, 2).

Wednesday, March 21, 2012

JEE6: Who Needs Aspect-Oriented Programming?

In Java EE, there is rarely an obvious use case for AOP.

According to Wikipedia, aspectoriented programming aims to separate reusable functionality from the business logic:

“In computing, aspectoriented programming (AOP) is a programming paradigm which aims to increase modularity by allowing the separation of cross-cutting concerns. AOP forms a basis for aspect-oriented software development.”
AOP was a hot topic a few years ago, but it never really took off in J2EE—and for good reason.

Aspects Are Commodities The integral parts of the Enterprise JavaBeans (EJB) 1.0 specification (JSR 318) in early 1998 were aspects. The developer had to develop the Bean class and the Remote and Home interfaces but none of the cross-cutting aspects. Threading, pooling, security, transactions, session handling, and even persistence were configurable aspects cleanly separated from the business logic.

The cross-cutting functionality was configurable in the early EJB 1.0 days with POJOs.

With the advent of EJB 1.1 and J2EE, Java classes were replaced with XML, and the recent Java EE 5 and Java EE 6 specifications made XML optional. You can configure the vast majority of all use cases with annotations and override them with XML.

Although the whole EJB 1.0 idea was based on aspects, you will find only two mentions of the word aspect in the original specification in different contexts.

AOP and EJB 1.0 were “invented” nearly at the same time.

In J2EE, the configurable decoration of an EJB bean with, for example, transactions was just an integral part of the development experience. Other frameworks
provided the same functionality but called that functionality AOP.

You will have a number of aspects by defining a simple EJB 3.1 bean. For example, a stateless EJB 3.1 bean comes with transaction and lifecycle aspects out of the box.

The method greet() is never invoked directly. The container dispatches the invocations to free EJB instances from the pool. Also, transactions are started before each method invocation.

The method call is processed by a chain of default and configurable aspects until it reaches the actual business logic. Outside the application server, you would probably implement the same functionality with the decorator pattern or with a more generic solution, such as AOP.

* For complete article by Adam Bien in Java Magazine check it out here

Monday, March 19, 2012

JPA: Query, incompatible types compilation error

I have faced a problem while I am writing a generic JPA query like the following:

Compile it and you will get the following error in Jdeveloper 11.1.2.1.0
Error(200,37): incompatible types.

It works for Query.getResultList(), but it doesn't work for Query.getSingleResult().

A work around solves the problem which is, cast to T as (T) query.getSingleResult();

After investigation the perfect solution is to rewrite the following statement:

To be:

Use TypedQuery instead of Query and JDeveloper will remove all "Unchecked conversions from Object to T unsound but tolerated" warnings.

Note: that TypedQuery introduced in JPA 2.

Sunday, March 18, 2012

ADF: BIDI via EL in AdfFacesContext

At some point, you may have an inlineStyle whose value is BIDI sensitive; in LTR (left-to-right) mode, you may want a “left” style but in RTL (right-to-left) mode, you may want a “right” style. You don’t have to write a managed bean to give you the corresponding style as i did before, you can use EL (expression language).

Here’s an example assigning a padding for the “start” side of 10px:

Also you can use CSS and af:isRTL() function, if you editing ADF skin for your application, or prefers the CSS style, finally both ways works with CSS option, refere to "ADF: Add locale aware CSS to an individual component" for more info.

For other properties
See oracle.adf.view.rich.context.AdfFacesContext

Saturday, March 17, 2012

ADF: showPopupBehavior operation & load trigger

Sometimes I need to dual authenticate the entrance of a page that contains a very sensitive information such Payroll page.

In my old days I implement such a case by developing a page to open it as dialog and handle the load in page phase listener life cycle.

Now I will introduce a more easer and professional mechanism for such a case, by opening a popup in page load in a simple way.

Project structure is an ADF fusion application, and ADF web project as the following:



With ADF Faces it's so easy to open a popup on page load. All what I needs to do is to define af:showPopupBehavior operation for af:document tag.

Note: af:showPopupBehavior trigger type should be set to load.
There are a lot of triggers for this operation could be found in "Oracle® Fusion Middleware Web User Interface Developer's Guide for Oracle ADF 11g R2(11.1.2.1.0)" usage and implementation.

This will ensure, it will be executed during document load and will call popup during page rendering phase:


The payroll.jsf page code is as the following:

When you run the application Popup is popped up on page load:


References:
1- Oracle® Fusion Middleware Web User Interface Developer's Guide for ADF 11g Release 2(11.1.2.1.0)
2- ADF Faces Cheat Sheets 11.1.2.1.0

Monday, March 12, 2012

ADF: Add locale aware CSS to an individual component

Some locales have a right to left layout orientation. When creating a skin in ADF Faces, it's (relatively) easy to add locale aware CSS using the :rtl psuedo-class on the end of a skinning key to indicate that the skinning key should be used when the renderer is rendering right to left.
Example:

In this example, we want some padding before the start of the text in the content element of the component. In right to left locales, the start of the text is on the right side by default, so we need to change the padding from the left to the right.

Let's say, however, that you want to specify a locale aware CSS style on an individual component using the contentStyle attribute. There is a handy ADF Faces EL function to help you out here: isRTL. For our example, let's say we want an inputText component whose text content is 'end' aligned. If you weren't considering RTL locales, you could code this as:

This, however, will be right aligned regardless of locale. This is where isRTL() comes to the rescue. This is how we would code this to be locale aware:

The af:isRTL() EL function returns true if we are rendering in RTL, so we can use it to pick the appropriate text alignment.

Friday, March 9, 2012

Webservice: Part 3- Create, compile and publish WS using JDK only (No App. Server)

In Part 1 i have introduced the web services, and how to create, implement and publish WS then show the resulting WSDL.

After that in Part 2 i have implemented a Java Requester for the Web Service created in part 1.

In this part i will implement a multithreading version of the Endpoint Publisher to accept concurrent requests.

Multithreading the Endpoint Publisher

In the examples so far, the Endpoint publisher has been single-threaded and, therefore, capable of handling only one client request at a time: the published service completes the processing of one request before beginning the processing of another request. If the processing of the current request hangs, then no subsequent request can be processed unless and until the hung request is processed to completion.

In production mode, the Endpoint publisher would need to handle concurrent requests so that several pending requests could be processed at the same time. If the underlying computer system is, for example, a symmetric multiprocessor (SMP), then separate CPUs could process different requests concurrently.

On a single-CPU machine, the concurrency would occur through time sharing; that is, each request would get a share of the available CPU cycles so that several requests would be in some stage of processing at any given time. In Java, concurrency is achieved through multithreading. At issue, then, is how to make the Endpoint publisher multithreaded. The JWS framework supports Endpoint multithreading without forcing the programmer to work with difficult, error-prone constructs such as the synchronized block or the wait and notify method invocations.

An Endpoint object has an Executor property defined with the standard get/set methods. An Executor is an object that executes Runnable tasks; for example, standard Java Thread instances. (The Runnable interface declares only one method whose declaration is public void run().) An Executor object is a nice alternative to Thread instances, as the Executor provides high-level constructs for submitting and managing tasks that are to be executed concurrently.

The first step to making the Endpoint publisher multithreaded is thus to create an Executor class such as the following very basic one:

The class MyThreadPool creates a pool of 10 threads, using a fixed-size queue to store the threads that are created under the hood. If the pooled threads are all in use, then the next task in line must wait until one of the busy threads becomes available.

All of these management details are handled automatically. The MyThreadPool class overrides a few of the available methods to give the flavor.

A MyThreadPool object can be used to make a multithreaded Endpoint publisher. Here is the revised publisher, which now consists of several methods to divide the work:

Once the ThreadPoolWorker has been coded, all that remains is to set the Endpoint publisher's executor property to an instance of the worker class. The details of thread management do not intrude at all into the publisher.

The multithreaded Endpoint publisher is suited for lightweight production, but this publisher is not a service container in the true sense; that is, a software application that readily can deploy many web services at the same port.

A web container such as Tomcat, which is the reference implementation, is better suited to publish multiple web services.

References:
Java Web Services: Up and Running, 1st Edition

Webservice: Part 2- Create, compile and publish WS using JDK only (No App. Server)

In part 1 i gives an introduction to web services,then created, implemented and published a WS, after that show the resulting WSDL.

In this part i will show you how to implement a Java Requester of the Web Service created in part 1.

A Java Requester of the Web Service

Example 1. Java client for the Java web service

The Java client uses the same URL with a query string, but the Java client explicitly creates an XML qualified name, which has the syntax namespace URI:local name.

A URI is a Uniform Resource Identifier and differs from the more common URL in that a URL specifies a location, whereas a URI need not specify a location. In short, a URI need not be a URL. For now, it is enough to underscore that the Java class java.xml.namespace.QName represents an XML-qualified name.

In this example, the namespace URI is provided in the WSDL, and the local name is the SIB class name TimeServerImpl with the word Service appended. The local name occurs in the service section, the last section of the WSDL document.

Once the URL and QName objects have been constructed and the Service.create method has been invoked, the statement of interest:

Executes. Recall that, in the WSDL document, the portType section describes, in the style of an interface, the operations included in the web service. The getPort method returns a reference to a Java object that can invoke the portType operations.

The port object reference is of type eg.com.tm.ws.ts.TimeServer, which is the SEI type. The Java client invokes the two web service methods; and the Java libraries generate and process the SOAP messages exchanged transparently to enable the successful method invocations.

In part 3 i will show you how to implement WS created in part 1 to accept concurrent requests.

Webservice: Part 1- Create, compile and publish WS using JDK only (No App. Server)

This is 3 parts series as the following:
  1. Part1: introduction to web services, create, implement and publish WS then show the resulting WSDL.
  2. Part2: A Java Requester of the Web Service created in part 1.
  3. Part3: Multithreading the Endpoint Publisher version for the same service created in part 1.
What Are Web Services?

Although the term web service has various, imprecise, and evolving meanings, a glance at some features typical of web services will be enough to get us into coding a web service and a client, also known as a consumer or requester. As the name suggests, a web service is a kind of webified application, that is, an application typically delivered over HTTP (Hyper Text Transport Protocol).

A web service is thus a distributed application whose components can be deployed and executed on distinct devices. For instance, a stock-picking web service might consist of several code components, each hosted on a separate business-grade server, and the web service might be consumed on PCs, handhelds, and other devices.

Web services can be divided roughly into two groups, SOAP-based and REST-style. The distinction is not sharp because, as a code example later illustrates, a SOAP-based service delivered over HTTP is a special case of a REST-style service. SOAP originally stood for Simple Object Access Protocol but, by serendipity, now may stand for Service Oriented Architecture (SOA) Protocol.

Deconstructing SOA is nontrivial but one point is indisputable: whatever SOA may be, web services play a central role in the SOA approach to software design and development. (This is written with tongue only partly in cheek. SOAP is officially no longer an acronym, and SOAP and SOA can live apart from one another.)

ADF: Creating and Using an ADF Declarative Component

This tutorial shows you how to create ADF declarative component metadata, add ADF Faces components that make up the composite component, and use the declarative component on a JSF page.

In this post ADF: About JSF fragments, ADF regions, declarative components …, i wrote about different declarative component in ADF faces.

You will use wizards to quickly create applications and projects, and a declarative component definition consisting of an attribute, a facet and a method.

The declarative component you will create is panel box containing one label, list of input text, and button. The metadata for the declarative component definition will allow page authors to set the label for a panel box, attach a method to the button to print the input lists after modification, and use built in controllerContext to view page viewId as default value.

To create the declarative component layout, you will use design tools such as the visual editor, Component Palette, and the Property Inspector. Then you will deploy the project to an ADF Library JAR file. For an application to consume the declarative component, you will use the Resource Palette to add the deployed JAR, and then add the deployed JAR to the project that contains JSF pages.

To make use of the declarative component, you will add it to a simple JSF page, edit the pre-defined attributes, create a method and attach it to the declarative component. When you run the application, the page will look similar to this:



Thursday, March 8, 2012

ADF: Stretching a component to (near) 100%

In the past, many users would want their component to stretch to fill 100% of a horizontal area. However, to account for scrollbars that may or may not have been there, they would set the percentage to 98%, etc.

A much better way to do this is to use the new "AFStretchWidth" style class, which will do this automatically for you.

For instance, avoid this:

and instead do this:

You can learn more about ADF Faces layout management here.

Apple: New features of iPad (3) Announced



During the Apple event in Yerba Buena Center, San Francisco, California, the new iPad was announced. It’s just called the “iPad” instead of the iPad 3.;

See the video at http://www.apple.com/apple-events/march-2012;
and full details at http://www.apple.com/ipad.

New features of the new iPad:
  • Retina display
  • 2048 x 1536 resolution
  • 44% greater saturation
  • A5x quad-core graphics
iSight camera
  • 5-megapixel sensor
  • 1080p HD video recording
  • Backside illumination
  • 5-element lens
  • Hybrid IR filter
  • Apple-designed ISP
  • Face detection
Voice dictation
  • Supports voice dictation but doesn’t have full Siri support.
4G LTE Next-Generation Wireless support:
  • Two different iPads, one for AT&T and one for Verizon
  • Personal hotspot support
  • 10 hours battery life
  • 9 house battery life with 4G
  • 9.4 mm thin, weighs 1.4 lbs
Pricing:
iPad with LTE 4G
  • 16 GB – $629
  • 32 GB – $729
  • 64 GB – $829
iPad with WiFi
  • 16 GB – $499
  • 32 GB – $599
  • 64 GB – $699
Release Date:
March 16 in US, Canada, UK, France, Germany, Switzerland, Japan.

Preorder Date:
Available for pre-order today!

Saturday, March 3, 2012

JPA: 2 ways to get container-managed EntityManager in servlet

In Thread-safety when injecting EntityManager post, I wrote about the danger of using field/setter injection to get EntityManager in servlets and compares container-managed EntityManager vs application-managed EntityManager.

What if I need a container-managed EntityManager in my servlet class?
There are 2 ways to do that:

1. type-level injection + JNDI lookup

2. web.xml + JNDI lookup

The persistence-context-ref is declared in web.xml:


Friday, March 2, 2012

JPA: Thread-safety when injecting EntityManager

As I wrote in post Why we need type-level injections in JavaEE, injecting EJB 3 stateful beans into servlet instance fields is not thread-safe. Along the same line, injecting EntityManager with @PersistenceContext into servlet instance variables is not thread-safe, either. EntityManager is just not designed to be thread-safe.

For example, the following code snippet of a servlet class is incorrect:


One way to fix this is to inject EntityManagerFactory instead. EntityManagerFactory is guaranteed to be thread-safe. For example:

Continuing container-managed EntityManager vs application-managed EntityManager.

There are important differences between the injected EntityManager, and the EntityManager created from an injected EntityManagerFactory. Basically, injected EntityManager is container-managed, meaning all of its lifecycle is controlled by the container (web container or EJB container). Application code cannot close it, or otherwise interfere with its life.

In addition, for a container-managed EntityManager, its associated PersistenceContext is automatically propagated along with the underlying JTA, from servlet A to servlet B, from servlet to EJB, from EJB a to EJB B, and so on. As such, EntityManager of the same configuration injected into various classes can share the same PersistenceContext in a call stack.

On the other hand, EntityManager created from EntityManagerFactory is application-managed EntityManager. Application code is responsible for managing its whole lifecycle. And there is no PersistenceContext propagation for application-managed EntityManager.

Are all EntityManager's obtained from EntityManagerFactory application-managed EntityManager? Yes.

Is it possible to get a container-managed EntityManager from EntityManagerFactory? No.

You may have read about the method EntityManagerFactory.getEntityManager(), which returns a container-managed EntityManager. This method was considered and included in the early draft version of Java Persistence API, but was eventually removed from its final release.

JPA: Why we need to specifies the type-level injections in JavaEE?

As I wrote in the Injection level-types in JavaEE5+, JavaEE type-level injection is more verbose than field and setter injections. So why don't we just all use the simple field or setter injections? Well, there are sometimes a type-level injection is more appropriate

1. You want to lazily initialize a field such as a data source or bean. Having the container to initialize a field via field injection or setter injection has its overhead. With type-level injection, you have the resource and EJB reference fully configured without descriptors, but defer the actual initialization. Whenever you need the resource, just look it up.

Type-level injection also works well if you want to reference the injected resource in some non-component utility classes that are in the same naming context. Since only JavaEE component classes can take injections, you can't inject into POJO utility classes. For example, you can



The above example will also if we instead use field or setter injection. But the instance filed in FooServlet class that takes the injection may not be used at all. Another approach is to pass the data source reference injected into FooServlet as method parameters to ServletHelper. But it pollutes the API. It appears more natural, at least to me, to use type-level injection in this case.

2. You want to restrict the scope or sharing of the variable that references the resource. Field and setter injections both use instance variables, which are accessible to all methods and all threads of the current component instance. Instance variables represent shared states. With type-level injections, you typically assign the resource to a local variable and thus is thread-safe.

This is the reason why you shouldn't inject an EJB 3 stateful session bean into a servlet class variable. In so doing, this stateful bean variable will be shared by all request-processing threads running inside the servlet's service method. Servlet is stateless, so it should not keep state (the stateful session bean reference).


JPA: Injection level-types in JavaEE5+

There are 3 types of resource injections in JavaEE in the order of usage frequency:
  1. Field injection.
  2. Setter injection.
  3. Type-level injection. 
Unlike field and setter injections, type-level injections are not really injection. It does not inject anything into anywhere; it just declares a resource reference in a descriptor-free manner.

To use resource injected at type-level, you will need to do a traditional JNDI lookup. What we have saved here, compared to pre-JavaEE-5, is there is no need for deployment descriptors.

A servlet example in glassfish:


Type-level injections are inherently verbose, compared to field and setter injections, where a bare @EJB or @Resource is sufficient in some cases. Field and setter injections can use the field type and parameter type to infer the resource type, respectively.

Type-level injections can't. All the necessary attributes must be present.

  • For @Resource, you must specify at least name and type
  • For @EJB, you must have at least beanInterface and name.

Glassfish 3.1.2: Unable to load resource [com.mysql.jdbc.EscapeProcessor]

While I am building JEE6 web profile application, using EJB3.1, JPA2.1, JSF (IceFaces 3) against MySQL database v5.1.15, my java web app fails in Netbeans v7.1 when I try to run it.

Netbeans reports successful deployment, but then I get this error when executing a JPA query against MySQL:

java.lang.IllegalStateException: WEB9031: WebappClassLoader unable to load resource [com.mysql.jdbc.EscapeProcessor], because it has not yet been started, or was already stopped.
This error occurs at the first query against the database. The entire application works fine with Netbeans version 7.1.
One potential clue is that I had to manually add the MySQL driver to the project for unit test the project using embedded glassfish 3.1.2.

After reviewing/tracing the problem and some googling about the problem here is the fix:

  1. For unit testing put the MySQL driver in the test libraries only don't add it to the project to final deployment.
  2. For production, the MySQL driver should not be in the project ... it should be in <DOMAIN>/lib/ext... in your glassfish v3.1.2 folder.
If there is any help just leave your comment.

Thursday, March 1, 2012

App. Server: GlassFish 3.1.2 Released

Oracle GlassFish Server 3.1.2 has just been released and is ready to download.

Oracle GlassFish Server 3.1.2 improves upon its ease-of use features, flexibility and improved developer productivity with several enhancements. Do you want an application server that's both state-of-the-art and production-ready? Johan Vos, CTO at LodgON, says GlassFish is his favorite application server because: 

"GlassFish contains the most advanced, state-of-the art technology that is seen in similar products a few years later and the quality of GlassFish is very high, the software is ready to be used in production."
Here are the highlights of the Oracle GlassFish Server 3.1.2 release:
  • Improved console startup time over previous versions of Oracle GlassFish Server.
  • Enhanced configuration of Java Message Service (JMS) clusters for fault tolerance and failover capabilities.
  • Easier Load Balancer configuration for faster throughput and reduced latenc.
  • Enhanced security with SSL Encrypted traffic between the Domain Administration Server and remote instances.

  • Support for the WebSocket Protocol RFC 6445, enabling bi-directional communication between a client and server, adding a web-origin based security model for browsers
.
  • New DCOM support. Windows users now have the flexibility to administer Glassfish clusters and instances remotely using SSH or DCOM.

  • New Support for non-Multicast clustering. GlassFish High-Availability clustering is now possible in environments where multicast is disabled.

  • Improved EclipseLink integration to enable data binding with JAX-WS. EclipseLink integration provides TopLink Grid support for using Coherence as a 2nd level data cache.
Learn the differences between Oracle GlassFish Server and GlassFish Server Open Source Edition at glassfish.java.net.

You can download GlassFish 3.1.2 from the Oracle Technology Network.