Posted by bhaktimehta
on March 2, 2012 at 1:06 PM PST
We are pleased to announce the release of Glassfish 3.1.2 and Netbeans 7.1.1 which bundles Glassfish 3.1.2. Also included in Netbeans 7.1.1 are 3 new Glassfish samples. This blog talks about those samples.
We are pleased to announce the release of Glassfish 3.1.2 .
These are the highlights of some of the main features in Glassfish 3.1.2
- Improved Administration Console with better startup time and option to load in background after server startup. [blog ]
- Improved clustering with new DCOM Support for Windows (as an alternative to SSH for remote management of GlassFish instances) and Non-Multicast clustering.
- Improved EclipseLink integration with EclipseLink MOXy support and TopLink Grid support (Coherence as 2nd level data cache)
- WebSocket (RFC 6455) Support
- Transaction recovery using database (in addition to the existing file system support)
- Improved Security (secure admin requires password, Oracle GlassFish Server secure by default with new password required be set during installation or on first use), and
SSL Encrypted traffic between the Domain Administration Server and remote instances
- NetBeans 7.1.1 ships with GlassFish Server 3.1.2
As you can see the newly released Netbeans 7.1.1 ships with Glassfish 3.1.2.
We have added 3 new samples which will work out of the box using Netbeans 7.1.1 and Glassfish 3.1.2.
This blog talks about the new samples.
To download Netbeans 7.1.1 go to http://netbeans.org/downloads/index.html Choose the Javaee supported technology
Once Netbeans is installed you can try the samples by clicking File->New Project->Samples->JavaEE
You will see 3 new samples which are introduced in Netbeans 7.1.1
This is a simple maven sample which shows the Embedded API in Glassfish 3.1.2 and demonstrates
1. Start/stop GlassFish Server
2. Deploy & Undeploy an application
3. Scattered Archive
4. Running asadmin commands from CommandRunner
You can right select the sample as shown above right click and Click Build. It will download the maven dependency glassfish-embedded-all jar.
Under the Source Packages you can see the embedded.telephonedirectory.client and embedded.telephonedirectory.server packages
The embedded.telephonedirectory.server has few JPA entities defined and a PersistenceManager CDI bean.
The embedded.telephonedirectory.client has all the code which shows how to use the embedded apis in Glassfish. You can see we define an http-listener,
then the JDBC pool and resource required for the application is created, the application is deployed using org.glassfish.embeddable.Deployer API.
To access the application launch the URL in the bowser http://localhost:9590/td
Once the user finishes accessing the application type quit in the Tasks panel, the application is undeployed and embedded glassfish is stopped.
2.EjbContainer sample in Glassfish
This sample demonstrates the use of Maven to test EJB's using the standard EjbContainer support in Glassfish 3.1.2.
Open the project in Netbeans and right click and click Build.
Under the Source Packages tab you will see the org.glassfish.embedded.tempconverter package and see a StatelessSession bean called TemperatureConverter
which does basic conversion from Farenheit to Celcius and vice versa.
Under the Test Packages tab you will see the TemperatureConverterTest.java which is a simple junit test which
1. Creates the EjbContainer
2. Gets the Context object and does a lookup for the TemperatureConverterBean
3. Invokes the methods on the TemperatureConverterBean
3.Application scoped resources sample in Glassfish
This is a simple sample which shows Application scoped resources in Glassfish. You can right click and click on Run to run this project.
When you open the project you will see ApplicationScopedResources-app-client and ApplicationScopedResources-ejb modules.
The ApplicationScopedResources-ejb module defines a StatelessSessionBean HelloBean which takes in a DataSource
and does a lookup and returns the name of the datasource or the default if it does not find any matching datasource.
The main file of interest is the glassfish-resources.xml which you can see under the Files tab which is next to the Projects tab.
You can see it the jdbc-resource java:app/app-scoped-resource in java:app : namespace which is shared by all components, modules in an application
(eg: application-client, web component, ejb component in an application, .ear). The application client looks for the "java:app/app-scoped-resource and prints
it since the application client is part of the ear it can access it.
Please try these samples in Netbeans 7. 1.1.and give us your feedback. Also go ahead download and try Glassfish 3.1.2 and we look forward to hear from you!