The error "java.lang.NoClassDefFoundError: org/omg/CORBA/UserException" occurs in custom applications when you upgrade or change Java versions


The following error is generated after you install or upgrade the version of Java that a custom application uses: 

Caused by: java.lang.NoClassDefFoundError: org/omg/CORBA/UserException

The problem occurs because the java.corba module (for example, org.omg.CORBA* packages) were deprecated in Java 9. In Java 11, that module is no longer be available.

Deprecating the module means that the classes in the module are not available in the class path, by default. However, you can add them to the class path by including the --add-module java.corba option on the javac or java command line.

Note: This option is available in Java 9 and Java 10. The CORBA modules are not available in Java 11. However, a workaround is available that enables you to add those modules for Java 11. See the following examples for Java 9 and 10, as well as the workaround for Java 11.

Example for Java 9 and 10:

In Java 9 and 10, you need to change this command:

jdk-9.0.4/bin/java -classpath "log4j.jar;sas.core.jar;sas.security.sspi.jar;sas.svc.connection.jar" javaclass 

When you include --add-module java.corba , the command looks like this:

jdk-9.0.4/bin/java --add-modules=java.corba -classpath "log4j.jar;sas.core.jar;sas.security.sspi.jar;sas.svc.connection.jar" javaclass 

Workaround for Java 11:

To add the CORBA modules to Java 11, you must download GlassFish CORBA JAR files externally from online resources and add them to the class path for Java 11. The following list shows the five GlassFish JAR files that you need:

Disclaimers: