Markus is a Developer Advocate at Red Hat and focuses on JBoss Middleware. He is working with Java EE servers from different vendors since more than 14 years and talks about his favorite topics around Java EE on conferences all over the world. He has been a principle consultant and worked with different customers on all kinds of Java EE related applications and solutions. Beside that he has always been a prolific blogger, writer and tech editor for different Java EE related books. He is the Java Community leader of the German DOAG e.V. and it's representative on the iJUG e.V. As a Java Champion and former ACE Director he is well known in the community. Markus is a DZone MVB and is not an employee of DZone and has posted 180 posts at DZone. You can read more from them at their website. View Full User Profile

Running GlassFish with JRockit

  • submit to reddit
Since GlassFish 3.0.1 the JDK support was extended. You now also could run GlassFish with Oracle JRockit 6 Update 17 R28.0.0+. This is a great choice in general and I must admit, that this announcement slipped through and missed my attention until today.

Getting started
Get the latest GlassFish 3.0.1 and the latest Oracle JRockit 28.1. Start with installing the JRockit to a suitable location. After that, start the GlassFish installer and do the same. Select the JRockit installation folder if you are asked to select the JDK. Finish the GlassFish installation. and change to %GF_HOME$/bin and type asadmin start-domain.
You will see something like this:
Waiting for DAS to start .Error starting domain: domain1.
The server exited prematurely with exit code 1.
Before it died, it produced the following output:

[WARN ][jrockit] MaxPermSize=192m ignored: Not a valid option for JRockit
[WARN ][jrockit] NewRatio=2 ignored: Not a valid option for JRockit
Could not create the Java virtual machine.
Unknown option or illegal argument: -XX:+LogVMOutput.
Please check for incorrect spelling or review documentation of startup options.

Configure your Domain
Both JVM options are invalid for JRockit. So you have to get a hand on your %GF_HOME%/glassfish/domains/domain1/config/domain.xml and comment out or remove the following three lines in the <java-config> section:

<jvm-options>-XX:LogFile=${com.sun.aas.instanceRoot}/logs/jvm.log</jvm-options> After that try restarting your domain and you will see, it works.
If you run the admin console and select "Enterprise Server > JVM Report" you will see, that the Oracle JRockit is now used.
This seems to be a know issue and will be fixed in the next GlassFish 3.1 release.

Why JRockit?
There are a couple of reasons. It's simple the most powerful JVM on earth. But my favorite is the Mission Control Tooling. includes tools to monitor, manage, profile, and eliminate memory leaks in your Java application. You can simply browse any resources on the server and have a very handy tooling for identifying problems. The most powerful thing is the Flight Recording feature. You can monitor your JVM like a blackbox and collect runtime information with minimal overhead. The flight recording option is enabled by default. You simple need to take your probe for as long as you need it and analyze it with the JRMC.

JRockit Flight Recorder does all this by being tightly integrated into the JVM and by being very conscious of its performance overhead. It provides a wealth of information on the inner workings of the JVM as well as on the Java program running in the JVM. You can use this information for profiling and for root cause analysis of problems. It can be enabled at all times, without causing performance overhead—even in heavily loaded, live production environments.
If you are looking for more details also compare my Flight Recorder post. There are some more experimental features available which you could install by simply selecting "Help > Install Plugins". A WebLogic plugin is available. I would love to have a separate for GlassFish also.



Published at DZone with permission of Markus Eisele, author and DZone MVB.

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)



Piotr Szarański replied on Wed, 2011/02/23 - 10:32am

When it comes only to jvm internals visualisation, Oracle`s (Sun`s) jvm works with VisualVM, which is great tool, in my opinion outclassing Mission Control, through it`s plugins. When it comes to overall experience, jrockit + weblogic have never dissapointed me, whereas Glassfish on Oracle`s (Sun`s) jvm took me on a sad flight to the land of OOME: PermGen.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.