Tuesday Jan 03, 2012

Java EE 6 using WebLogic 12c, NetBeans, and MySQL (Screencast #39)

Oracle WebLogic Server 12c is now available and comes with a zip installer.

This video shows how to develop and deploy a Java EE 6 application on WebLogic 12c using NetBeans. It builds a simple application using Java Persistence API 2.0, Enterprise JavaBeans 3.1, Servlets 3.0, Java API for RESTful Web Services 1.1, Java Server Faces 2.0, and Contexts & Dependency Injection 1.0. The video also explains how to configure MySQL database in NetBeans and use it for accessing the database tables in the Java EE 6 applications.


You can also check out the sample code built in this application from here.

What kind of Java EE 6 applications are you deploying on WebLogic ?

What else would you like to see on this blog relating to Java EE 6 and WebLogic ?

Follow the complete series here.

Monday Oct 03, 2011

Java EE PaaS using GlassFish 4.0 - JavaOne 2011 Technical Keynote

The JavaOne 2011 Technical Keynote explained how a Java EE application can be easily deployed in a PaaS environment using GlassFish 4.0.

The Java EE application, built from scratch, allows conference organizers to publish details about their conference such as tracks, sessions, and speakers. It also allows attendees to register for the conference and prepare their schedule. The application is built as a typical 3-tier Java EE 6 application using JavaServer Faces (with PrimeFaces widgets) for the front-end, Enterprise JavaBeans for the middle tier business logic, and Java Persistence API for connectivity with the database.

Deploying this application to GlassFish 4.0 highlights the following points:

  • Dynamic Service Provisioning: The service dependencies are discovered by introspecting the application archive and the required services such as Java EE, Database, and Load Balancer are provisioned. These services may be provisioned as part of an application deployment as is the case here, or a deployment can use pre-provisioned services that could be shared by different apps.
  • Elasticity using Auto-scaling: The Java EE cluster is automatically resized to meet the growing demands using auto-scaling. The decision to dynamically grow or shrink is based upon metrics that are collected during the application flow.
  • Highly Available Cluster: The Java EE cluster is highly available with session failover capabilities.

GlassFish 4.0 is a release in development that will allow for PaaS environments in the native and virtualized mode. The native mode provisions all the services on a non-virtualized environment such as a laptop/desktop and easy-to-replicate development and debugging mode. The virtualized mode allows a PaaS administrator to provision all the services in a private or public cloud, in an IaaS-agnostic manner, and provides for scalable deployments by supporting Elasticity to scale up (vertically) or scale out (horizontally) and to scale down to meet the changing needs. The Service Provisioning and Elasticity functionalities can be automatically done by the system or allow for manual action.

Follow the instructions to deploy this application in the native mode:

  1. Download the sample application, unzip, and build as mvn package.
  2. Download platform-specific Load Balancer zip file (Windows, Mac, Ubuntu, Ubuntu-64).
  3. Download GlassFish 4.0 build b04 and unzip.
    1. Copy "lb.zip" to the "glassfish3\glassfish\config" directory.
      1. On Unix machines, the Load Balancer is installed in the directory "/u01/glassfish". Make sure to create this directory and change directory ownership to your login id..
      2. On Windows machines, the Load Balancer is created in the "C:\glassfish" directory.
      3. Check that you are able ping your hostname, such as ping `hostname`
    2. Start the domain as: asadmin start-domain
    3. Enable PaaS Console as: asadmin enable paas-console
    4. Configure GlassFish for the native mode as: asadmin create-ims-config-native
    5. Create a template for load balancer as: asadmin create-template --indexes ServiceType=LB,VirtualizationType=Native LBNative
    6. Follow the instructions in the video below (starting at 5:24) to deploy the application using PaaS Console. Applications not using database functionality or not relying upon a SQL for the database initialization can be deployed using CLI as: asadmin --availabilityenabled=true <APP-NAME>.war

Enjoy the video below for a more detailed explanation of the installation steps, application flow, dynamic service provisioning, high availability and session failover, and auto-scaling using elasticity in the virtualized mode.


Send us feedback at the GlassFish Forums.

An active copy of this page is maintained at glassfish.org/javaone2011.


Wednesday Mar 23, 2011

Screencast #38: "Developing OSGi-enabled Java EE Applications using GlassFish" Tutorial at EclipseCon 2011

This screencast provide detailed instructions on how to develop OSGi-enabled Java EE Applications using GlassFish and Eclipse which will be delivered as a 2-hrs tutorial at the EclipseCon 2011.

You can download the required software and follow the detailed instructions (PDF) along with this screencast. Enjoy the screencast in HD in the full-screen mode:

Here are some time lines in case you want to move around in the screencast:

Introduction & Software Installation 0:00
Exercise 1 (Simple OSGi Service and Client) 2:42
Exercise 2 (Web Application Bundle) 11:57
Exercise 3 (EJB OSGi Service) 27:28
References 40:10

Many thanks to Doug & Ankush for an extensive review of the instructions!

Let us know your feedback by posting a question to the GlassFish Forum.

Technorati: conf eclipsecon osgi javaee glassfish eclipse screencast

Monday Feb 28, 2011

TOTD #157: GlassFish 3.1 Blogs & Screencasts

GlassFish 3.1 was released yesterday ... yay!

This Tip Of The Day (TOTD) will provide the list of blogs/screencasts produced by the GlassFish team:

  1. Connecting Securely to GlassFish via JMX (Prasad)
  2. Securing Administration in GlassFish Server 3.1 - 1: Admin Authentication (Tim)
  3. Securing Administration in GlassFish Server 3.1 - 2: Remote Administration (Tim)
  4. Securing Administration in GlassFish Server 3.1 - 3: Admin Message Encryption (Tim)
  5. Whats New in Metro 2.1 Security (Kumar)
  6. Customizing generated Java Web Start JNLP for app clients in GlassFish Server 3.1 (Tim)
  7. Single Sign-on Using the GlasFish 3.1 OAM Security Provider (Kumar)
  8. Metro 2.1 in GlassFish 3.1 (Fabian)
  9. Tracing SQL Queries & Monitoring (Shalini)
  10. Statement Leak Detection and Reclaim (Shalini)
  11. Statement Cache Monitoring (Shalini)
  12. Application based Connection Pool Monitoring (Shalini)
  13. Performance Tuner in Oracle GlassFish Server 3.1 (Jennifer)
  14. GlassFish 3.1: Clusters with SSH (Joe)
  15. Automatic Starting Implementation Details for GlassFish 3.1 (Byron)
  16. Huge Perfomance Improvement (Byron)
  17. A Taste of Monitoring in GlassFish 3.1 (Byron)
  18. Automatic Starting of Servers in GlassFish 3.1 (Byron)
  19. Monitoring Data - How to Open the Firehose (Byron)
  20. GlassFish 3.1 Scripting of Monitoring Data for Clusters and Instances (Byron)
  21. How to make GlassFish 3.1 Platform Services survive logoff (Byron)
  22. GlassFish 3.1 est là! (Alexis)
  23. Troubleshooting SSH in GlassFish 3.1 (Jennifer)
  24. GlassFish 3.1 and create-local-instance (Jennifer)
  25. GlassFish 3.1 and Manual Synchronization (Jennifer)
  26. Application-scoped Resources (Jagadish)
  27. Transparent JDBC connection Pool Re-configuration in GlassFish 3.1 (Jagadish)
  28. What's New in GlassFish V31. Security (Kumar)
  29. Moving On Up: Upgrading to GlassFish 3.1 (Bobby)
  30. GlassFish 3.1 Overview (Nazrul)
  31. GlassFish 3.1 and NetBeans 7.0 (Vince)
  32. GlassFish 3.1 and Deployment (Hong)
  33. State of the Cluster With Get-Health Command (Bobby)
  34. GlassFish 3.1: From Installation to Running Application in a Cluster (Anissa)
  35. GlassFish 3.1: New Features in Admin Console (Anissa)
  36. change-master-password command in GlassFish 3.1 (Bhakti)
  37. RESTful GlassFish Monitoring (Jason)
  38. GlassFish 3.1 Windows SSH Setup (Elena)
  39. IIOP Changes in GlassFish 3.1 (Ken)
  40. GlassFish 3.1 Automatic Domain Backup (Chris)
  41. Shoal 1.5.29 released - GlassFish 3.1's runtime dynamic clustering service (Shreedhar)
  42. GlassFish OSE 3.1 is out with WebSocket support included (Justin)
  43. GlassFish 3.1 with Metro 2.1 is Out (Marek)
  44. CDI Support in GlassFish 3.1 (Siva)
  45. Whats new in GlassFish 3.1 Performance (Scott)
  46. New Release: GlassFish Server 3.1: Read All About It! (Paul)
  47. Load Balancing Feature in GlassFish 3.1 (Kshitiz)
  48. GlassFish 3.1: using the master password and managing instances (Carla)
  49. GlassFish Server Load Balancer Plugin Installation & Setup (John)
  50. Quick Introduction to Embeddability of GlassFish Open Source Edition 3.1 (Bhavanishankar)
  51. Enhancements to JMS Clustering in GlassFish (Satish)
  52. Validating Multicast Transport: Where did my instances go ? (Bobby)
  53. Debugging GlassFish REST Requests (Jason)
  54. High Availability Single Sign On in GlassFish 3.1 (Shing Wai)
  55. Adding Users to a GlassFish Realm via REST (Jason)
  56. Getting started with Maven Plugin of Embedded GlassFish Server Open Source Edition 3.1 (Bhavanishankar)
  57. Managing GlassFish JDBC Resources using REST (Jason)

Check out the complete set of videos at GlassFishVideos@youtube.

For a more comprehensive list of blogs (including several from the community members), refer to The Aquarium.

Technorati: totd glassfish javaee blogs screencast

Friday Jan 21, 2011

Screencast #37: Java EE 6 with NetBeans and GlassFish - Webinar Replay and Q&A

The replay of Java EE 6 with NetBeans and GlassFish webinar is now available:

This video can also be seen in full screen HD mode.

The complete source code built during this webinar can be downloaded here.

And here is a transcript of Q&A session from the webinar:

Q. How can I using NetBeans generate an entity class with SequenceGenerator annotation for a PostGreSQL table?
A. If you use NetBeans to generate entities from database, it should do the right thing, based on the SQL types of your DB columns. If not, please file a bug report against NetBeans. Thanks.

Q. Do I need to have a good idea in Java EE 6 to attend this conference ?
A. I would help a bit, but NetBeans is doing a great job at helping discovering Java EE 6 with GlassFish

Q. Is there a EOL for GlassFish?
A. There is no EOL for GlassFish as a product. As the reference implementation for Java EE, GlassFish is a strategic product for Oracle. As with any software product, specific versions of GlassFish will EOL over time, as newer releases come out. For example, Oracle GlassFish Server 2.x will be supported until 2014, and we are working now on releasing GlassFish Server 3.1 in the near future.

Q. What is the link to file a bug report for NetBeans IDE?
A. This should help: http://netbeans.org/community/issues.html

Q. Can we you eclipse instead of netBeans?
A. Yes. The GlassFish Eclipse Plugin is available. Screencast #36 shows how to use Eclipse for Java EE 6 development and deployment with GlassFish.

Q. I would love to see a GF 3.0.2 fixing the known memory leaks. Any plans on that, or will it be GF 3.1? (And when?)
A. Fixes for GlassFish Server 3.0.1 will be available either through a support contract (patch), or you can always publish an issue on issuetracker at http://glassfish.java.net, and it will get addressed in the trunk (and 3.1 releases).

Q. Hi, My name is Andrew. i'd like to know all the possible ways to pass values between different JSF pages.and the value which need to be passed is dynamic. A. The easiest way is to use the new Flash scope in JSF 2.0. Failing that you can put it in session and remove it. You could also use @ConversationScoped from CDI.

Q. Why we have no glassfish rpm packets even for Oracle Enterprice Linux?
A. We have to support many Unix/Linux variant so we provide one shell script for all flavors including OS X. In the next release we provide topology creation in the installer which make a RPM less viable. Zip installs are also available.

Q. can you repeat? what blog?
A. The blog we mentioned is hosted by Arun Gupta, blogs.sun.com/arungupta - and a link to all webinar content will always be available at http://glassfish.org/webinars/

Q. How do we do junit without depending on Glassfish server. I want my junit to be totally independent of runtime.
A. If you want to test EJB and CDI code, you will need the embeddable container, which is server-specific. If you want to only test utility classes or JPA, this can be server-independent.

Q. is there any online classes on Java EE6 with Netbeans and GlassFish?
A. This is a great starting page: http://netbeans.org/kb/trails/java-ee.html. See for example the 5-part video screencast.

Q. it is possible.. they dont have any support
A. If you are asking about support for the products, yes - support is available from Oracle for GlassFish server, and for Netbeans you can go to http://netbeans.org/community/lists/index.html You can also obtain incident support for Netbeans from Oracle at http://netbeans.org/kb/support.html If you would like more information, please email glassfish_ww@oracle.com

Q. What kind of support is NetBeans providing for REST frameworks like Spring-RS?
A. NetBeans has a very good and extensive REST support for JerSey (The reference implementation of JAX-RS) and GlassFish 3 which contains JerSey. For Sprin-RS you would need to regsiter as an external library... I am not sure how well it is tested with GlassFish, since there is no need to use a external RS implementation when one is provided in the Java EE 6 runtime

Q. I feel like this is just a heavy adaptation of the Ruby on Rails scaffolding capability, don't you think ?
A. Yes, Rails definitely had a good influence on Java server-side development. Many good things in Java are inspired by Rails.

Q. where i can download Netbeans ?
A. netbeans.org

Q. What is the difference between singleton EJB and an EJB with maxbeans-in pool=initialbeans-inpool=1 ?
A. A quick answer is that the @Singleton annotation is defined by the Java EE 6 specification, is much more readable by developers, and less error-prone than editing container configuration (or other historical workarounds such as static fields). You can also ask at the GlassFish users forum at http://www.java.net/forums/glassfish/glassfish

Q. My Netbeans 6.9.1 does not have Servers or Glassfish on the Services tab, do I need Netbeans 7 to bring up Servers?
A. Which edition of NetBeans do you have? If you have "all-in-one", then the Java EE development features may not be activated. When you start creating a web project, these features will be activated and you will see Servers. You need "Java" or "all-in-one" edition.

Q. What is the Oracle strategy to move forward with NETBEANS and Jdeveloper?
A. Both will continue as supported IDEs at Oracle. Jdeveloper is usually for ADF development and other Fusion development. NetBeans is great for cutting edge Java SE/EE/FX/ME development. Large teams continue to work on both products. They are both swing based IDE tools -- JDeveloper may start to incorporate select netbeans features in the future.

Q. I understand netbeans IDE, but what is the benefit of glassfish?
A. GlassFish offers a lightweight, modular Java EE 6 runtime. It offers rapid development features such as saving HTTP session state on redeploy.

Q. What make me move to glassfish since there's lot IDE tools ?
A. GlassFish offers a lightweight, modular, and productive runtime for Java EE 6.

Thank you every body for attending the webinar!

The complete list of webinars (replay and upcoming ones) is listed at glassfish.org/webinars.

Technorati: conf webinar javaee6 glassfish netbeans

Friday Dec 17, 2010

Screencast #36: Web App Development using Java EE 6, GlassFish, and Eclipse - Webinar Recording

A recently concluded webinar on "Web Application Development with Java EE 6, GlassFish, and Eclipse" demonstrated:

  • Easy creation of web.xml-free and annotation-driven Servlets
  • HTTP session preservation across re-deploys to boost productivity
  • Creating JPA entities from an existing database table
  • Simplified packaging of EJB in a WAR file
  • Facelets as the templating language for JSF pages
  • Using EJB as backing bean for JSF pages
  • Publishing RESTful resources using JAX-RS
  • Injection in JAX-RS resources

And many other features!

The recording from the webinar is is now available:

The entire source code built during the webinar can be downloaded here.

How are you building your Java EE 6 applications ?

Technorati: webinar javaee6 glassfish eclipse screencast

Sunday Nov 21, 2010

Screencast #35: JDK 7 Project Coin Features in NetBeans IDE 7.0 Beta

NetBeans IDE 7.0 Beta was released last week - download here. JDK 7 build 118 was released last week as well - download here. The New and Noteworthy page of NetBeans 7.0 highlights the support for some of the Project Coin features. This screencast highlights how to get started with JDK 7 in NetBeans IDE and use some of the Project Coin features, specifically:

  • Strings in switch
  • Binary integer literals and underscores in numeric literals
  • Multi-catch
  • Improved type inference for generic instance creation (diamond operator)
  • Automatic resource management


Share feedback about Project Coin at coin-dev and about NetBeans at NetBeans Forums.

Technorati: screencast netbeans jdk7 project coin

Wednesday Nov 17, 2010

Screencast #34: GlassFish 3.1 Clustering, High Availability and Centralized Administration

Two main themes of GlassFish 3.1 are: High Availability and Centralized Administration. This screencast demonstrates how to create a 2-instance cluster on a single machine using web-based Administration Console, deploy the canonical clusterjsp application, and show session fail-over capabilities in GlassFish 3.1.

From download to testing an application with high availability ... all in under 10 minutes ... enjoy!

A future screencast will show how to create multiple nodes on different machines, with 1 or more instance on each node, and all of them front-ended with a load balancer.

Technorati: screencast glassfish clustering highavailability

Tuesday Oct 19, 2010

Screencast #33: NetBeans 7.0 M2 and GlassFish 3.1 Features

NetBeans 7.0 M2 was released recently and comes pre-bundled with GlassFish 3.1. Vince Kraemer has been blogging about several features that have been introduced in the builds recently:

Now, you can see all these features live in action in this screencast:


Thanks Vince!

Technorati: screencast netbeans glassfish

Sunday Oct 03, 2010

Screencast #32: OSGi-enabled Java EE Applications using NetBeans and GlassFish

OSGi provides the benefit of modularity, dependency management, service dynamism, and others. Java EE provides persistence, security, transaction management and other similar services. The Enterprise Expert Group in OSGi Alliance defines how to mix and match the Java EE APIs in OSGi. The Release 4 Version 4.2 of Enterprise Specification defines how several Java EE specifications such as JPA, JNDI, JMX, and WAR file specification can work with OSGi and levarage its benefits.

Sahoo & Siva gave a talk at JavaOne 2010 explaining the approach and advantages of writing such applications, their slides are available below:

This 6-part screencast shows how to develop OSGi-enabled Java EE applications using NetBeans and deploy them on GlassFish. The screencast creates a simple OSGi service which is invoked by OSGi client. The same OSGi service is then invoked by Web Application Bundle (WAB) client that is a Web Application + OSGi bundle, a.k.a hybrid application. The OSGi service is then replaced by an EJB-based service using Java Persistence API. This shows how OSGi client and service can seamlessly interoperate with Java EE counterparts.

Specifically, the different parts show:

1. How to create a parent POM project
2. API and Service OSGi Bundle
3. Client OSGi Bundle invoking an OSGi Service
4. Web Application Bundle (WAB) client invoking an OSGi service
5. Client OSGi bundle invoking EJB service
6. Conclusion and other possible extensions

This entire exercise was scheduled as S313522 hands-on lab at JavaOne 2010 but could not be conducted because of technical difficulties. We hope you are able to follow the steps mentioned below and benefit from it.

Please download and install NetBeans 6.9.1 and download the following zip files before attempting the exercise:

  1. GlassFish 3.1 b20 Web Profile
  2. GlassFish OSGi Feature Pack for 3.1 b20
  3. S313522 Detailed Docs + Solutions

If you are using a different build of GlassFish then the OSGi Feature Pack can be downloaded by executing the following script in "glassfish/modules/autostart" directory and giving the build number as the first parameter:

curl -C - -O http://download.java.net/maven/glassfish/org/glassfish/osgi-http/3.1-b$1/osgi-http-3.1-
curl -C - -O http://download.java.net/maven/glassfish/org/glassfish/osgi-platforms/felix-webconsole-
curl -C - -O http://download.java.net/maven/glassfish/org/glassfish/osgi-jpa/3.1-b$1/osgi-jpa-3.1-b$
curl -C - -O http://download.java.net/maven/glassfish/org/glassfish/osgi-ejb-container/3.1-b$1/osgi-
curl -C - -O http://download.java.net/maven/glassfish/org/glassfish/admingui/glassfish-osgi-console-
curl -C - -O http://www.reverse.net/pub/apache/felix/org.apache.felix.webconsole-3.1.2.jar

A typical execution of this script might look like:

./gf-osgi-fp.sh 20
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 27522  100 27522    0     0  74967      0 --:--:-- --:--:-- --:--:--  120k
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  6795  100  6795    0     0  17811      0 --:--:-- --:--:-- --:--:-- 24068
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 24342  100 24342    0     0  59168      0 --:--:-- --:--:-- --:--:--  108k
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 16145  100 16145    0     0  72180      0 --:--:-- --:--:-- --:--:--  186k
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 18724  100 18724    0     0  35921      0 --:--:-- --:--:-- --:--:-- 48785
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  602k  100  602k    0     0   636k      0 --:--:-- --:--:-- --:--:--  748k

Enjoy the video!

How are you using OSGi and Java EE together ? What other OSGi features would you like to see in GlassFish ?

Technorati: screencast javaone osgi javaee netbeans glassfish


profile image
Arun Gupta is a technology enthusiast, a passionate runner, author, and a community guy who works for Oracle Corp.

Java EE 7 Samples

Stay Connected


« July 2016