AnsweredAssumed Answered

Java application gets NoClassDefFoundError but works for other models?

Question asked by dieter.wuyts@toyota-europe.com on Oct 9, 2015
Latest reply on Oct 15, 2015 by Susanne.Heip

We have created a Java application the triggers XpressMP to process 2 different kind of models and we are currently migrating it to another server, and upgrading to version 7.8 of XpressMP.

The first test was already completed successfully. Our application was able to process the model and get the results without any problems. So I assume this means that the installation was done correctly.

 

For the second model however we get the error below, and I don't really understand why... But it seems like there is in fact something wrong with our installation.

 

java.lang.NoClassDefFoundError: com/dashoptimization/mmjava/Mosel

Caused by: java.lang.ClassNotFoundException: com.dashoptimization.mmjava.Mosel

at java.net.URLClassLoader$1.run(URLClassLoader.java:366)

at java.net.URLClassLoader$1.run(URLClassLoader.java:355)

at java.security.AccessController.doPrivileged(Native Method)

at java.net.URLClassLoader.findClass(URLClassLoader.java:354)

at java.lang.ClassLoader.loadClass(ClassLoader.java:425)

at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)

at java.lang.ClassLoader.loadClass(ClassLoader.java:358)

nextevent is from: 1 class: 1 value: 13

Mosel: E-21: I cannot open file `mmjava.java:java.lang.System.out' for writing (class `com.dashoptimization.mmjava.Mosel' not found).

 

A few things to keep in mind:

- The first type of model runs fine

- I've been already in contact with Fico support through mail, and they confirmed that the model causing that error runs fine using the editor.

- The LD library path (from logging inside our application is:

     java library path: /opt/oracle_instantclient:/opt/xpressmp/lib:/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib

     LD library path: /opt/oracle_instantclient:/opt/xpressmp/lib

- The model that is working is a single *.mos file.

- The model causing this error consists of multiple .mos files. There is logging in the mos files, and I can see in that log that it starts the first one. Next models are then loaded and 'run' is executed to start it. But I don't see any logging from that second .mos file and the error above appears in our java logfile.

 

Could the cause be that the mosel 'run' method starts a new Thread using a new classpath and it can't find the the correct jars or something like that?

Outcomes