Havok
Havok

Reputation: 5882

OpenJDK to develop JavaEE?

I'm developing a JavaEE application and deploying it in Glassfish 3. I'm using Ubuntu 12.04, Eclipse for EE developers, and OpenJDK 6 JDK (package openjdk-6-jdk). No problems so far.

The problem is that everywhere where I look for information about using OpenJDK for Java EE development I found that it is supposed that OpenJDK is just Java SE, for example here, or here. Nevertheless, in my application I'm using javax.* a lot, and is working.

I've downloaded the source of OpenJDK 6 and I've found folder /jdk/src/share/classes/javax/ with a lot of classes, but some importants are missing like javax.servlet, javax.ejb or javax.faces.

Again, I don't have any other JDK besides the OpenJDK, nor GCJ or Oracle ones.

My question is: How is this possible? OpenJDK has support for the JavaEE APIs? Can it be used for that, or I need to download and install Oracle JDK? I'm not understanding something here?

Please note that Oracle list SDK for SE apart from SDK for EE, so I suppose they are different, right?

Kind regards

Upvotes: 19

Views: 24611

Answers (2)

Dean
Dean

Reputation: 21

It is fact that J2EE does not specify a JVM, and that Glassfish4 and 5 both check for the Oracle JVM, and do not run with any other JVM.

Note that OpenJDK simply does not work with Glassfish. Glassfish is looking for OracleJDK specifically.

This is what happens if you try to start glassfish on MacOS with OpenJDK 12.0:

bin/asadmin start-domain
Exception in thread "main" java.lang.NullPointerException
    at com.sun.enterprise.module.common_impl.AbstractModulesRegistryImpl.initializeServiceLocator(AbstractModulesRegistryImpl.java:152)
    at com.sun.enterprise.module.common_impl.AbstractModulesRegistryImpl.newServiceLocator(AbstractModulesRegistryImpl.java:144)
    at com.sun.enterprise.module.common_impl.AbstractModulesRegistryImpl.createServiceLocator(AbstractModulesRegistryImpl.java:218)
    at com.sun.enterprise.module.common_impl.AbstractModulesRegistryImpl.createServiceLocator(AbstractModulesRegistryImpl.java:224)
    at com.sun.enterprise.module.single.StaticModulesRegistry.createServiceLocator(StaticModulesRegistry.java:88)
    at com.sun.enterprise.admin.cli.CLIContainer.getServiceLocator(CLIContainer.java:217)
    at com.sun.enterprise.admin.cli.CLIContainer.getLocalCommand(CLIContainer.java:255)
    at com.sun.enterprise.admin.cli.CLICommand.getCommand(CLICommand.java:231)
    at com.sun.enterprise.admin.cli.AdminMain.executeCommand(AdminMain.java:371)
    at com.sun.enterprise.admin.cli.AdminMain.doMain(AdminMain.java:306)
    at org.glassfish.admin.cli.AsadminMain.main(AsadminMain.java:57)

Upvotes: 2

BalusC
BalusC

Reputation: 1108782

Your Glassfish server is the concrete Java EE implementation. Note that OpenJDK is a concrete Java SE implementation. Also note that whenever you download Java EE from Oracle site, basically all you get is Glassfish along with a bunch of documents and examples.

See also:

Upvotes: 20

Related Questions