19

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

Havok
  • 5,776
  • 1
  • 35
  • 44
  • Note that OpenJDK simply does not work with Glassfish. Glassfish is looking for OracleJDK specifically. It would be nice if someone had answered what J2EE concrete implementation works with OpenJDK, if any. – Dean Jan 21 '20 at 02:32

2 Answers2

20

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:

Community
  • 1
  • 1
BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
  • 1
    So what's the recommended workflow? Should you install Java EE alongside OpenJDK? Should you install Glassfish alongside OpenSDK? Should you remove OpenJDK to install these? – Aaron Franke Jan 17 '20 at 22:05
  • Nope. Just download whatever Java EE server you want. See also the "See also" link. – BalusC Jan 17 '20 at 22:43
2

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)
Dharman
  • 30,962
  • 25
  • 85
  • 135
Dean
  • 21
  • 1
  • Two facts: 1) J2EE stopped 11 May 2006, catch up. 2) You should report bugs to the vendor, not here. – BalusC Jan 21 '20 at 09:10