14

I am seeing java.lang.NoClassDefFoundError: org/omg/CORBA/InterfaceDef when I am calling the method getMethod of the java.lang.Class. I am trying to get the getEmsSession method in EmsSeeionFactory_I of TMF specific jars using reflection. But when I checked for the class in the jacorb.jar, org/omg/CORBA/InterfaceDef.class is available on the class path. I have seen in other forums and I am seeing no answer for the same question in those forums as well. It looks like this exception being thrown from native VM code. I am left with no clue now. Any Ideas ? Complete stack trace is as below

java.lang.NoClassDefFoundError: org/omg/CORBA/InterfaceDef
        at java.lang.Class.getDeclaredMethods0(Native Method)
        at java.lang.Class.privateGetDeclaredMethods(Class.java:2427)
        at java.lang.Class.getMethod0(Class.java:2670)
        at java.lang.Class.getMethod0(Class.java:2688)
        at java.lang.Class.getMethod(Class.java:1603)
2
  • 1
    What is about your classpath?
    – tuergeist
    Nov 25, 2012 at 19:44
  • Your classloader may be confused. Do you have more than one instance of the same JAR file(s) on your classpath?
    – Jeff
    Feb 8, 2013 at 19:09

2 Answers 2

7

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:

glassfish-corba-internal-api.jar
glassfish-corba-omgapi.jar
glassfish-corba-orb.jar
pfl-basic.jar
pfl-tf.jar

http://support.sas.com/kb/63/716.html

1
  • 1
    Or add glassfish-corba-orb maven dependency works for me! Oct 20, 2022 at 1:56
3

NoClassDefFoundError means that the class was found during compile time but NOT found during runtime. Most of the time you have a difference between the classpath your runtime environnement and the classpath of your compile environnement. And it will work after you find the difference and fix it.

If you have checked and you are 100% sure that the classpath are the same, then the error is more tricky and you can read this tutorial to solve the problem : http://javarevisited.blogspot.be/2011/06/noclassdeffounderror-exception-in.html

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.