In a JEE Application Server such Oracle WebLogic or IBM WebSphere, where exactly does JVM fit in?
In short, each instance of a JEE Application server runs as a JVM that executes one or more JEE Applications deployed. In other words, Application Server is yet another java application (a big one) that executes custom developed JEE Applications.
Earlier we saw how a JVM can be started by using the ‘java’ command and passing the class name as the parameter
In a JEE Application Server’s case, it will be something like this:
java –classpath /opt/jboss-as/bin/run.jar com.jboss.Main
The above example starts a Jboss Application Server. Note that there will be several additional Java command line parameters in real world.
Let us understand what a JEE Application Server really is.
Sun Microsystems’s J2EE (Java 2 Enterprise Edition) became hugely popular in late 90s. It was a set of specifications geared towards running Servlets an EJBs along with few critical components such as JDBC,JMS and JTA. The specification could be implemented by a vendor to create their own Application Server. The following Application Servers came to market and are still used widely:
- BEA Weblogic (acquired by Oracle)
- Sun GlassFish (acquired by Oracle)
- IBM WebSphere
In most real world scenarios, the JEE Application Server will be in a clustered environment. i.e There will be many JEE Application Server instances grouped together in a cluster. Each Application Server runs in one JVM.
The role of JVM becomes more significant when we deal with Classloaders, a very important component of Java Applications. We will later see that there are classloaders from JVM itself and there are classloaders from the JEE Application Server, and how they work together.
In most JEE Application Servers you will be able to choose the JVM you want to use either by its Admin Console or through configuration files. It is vital to understand the version of JVM supported by a given version of Application Server. For example, if you try to use Java 1.4 with WebSphere 8, you are up for an ugly crash during server startup.
Regarding the JVM command line options, note that there may be JEE Server specific system properties that you can use. For example, the following system property is used by WebLogic to define the weblogic home directory
-Dweblogic.home=<my weblogic home directory>
Keep in mind that you can use all native JVM commands, even though JVM is running the JEE application server. For example, the jstack command can be used to create a thread dump and jmap command can be used to print a histogram of memory allocation.
In the next section, I’ll show you the different JVM implementations and their significances.