Class not found exception happens in Mendix 5, same code works in Mx 4

3
We're using some OpenRules libs and in Mendix 4 it works fine. Now we're trying to accomplish the same thing in Mendix five but it gives the following at the bottom of this post. I noticed that the Main class of Mendix is changed to org.apache.felix.main.Main from com.mendix.m2ee.server.HttpAdminAppContainer. Can it have something to do with security / visibility? (...) Caused by: org.openl.OpenConfigurationException: Error processing config file: classpath:/com/openrules/java/openrules.system.xml at com.openrules.java.JavaOpenLBuilder.build(JavaOpenLBuilder.java:80) at com.openrules.java.OpenRulesLBuilder.build(OpenRulesLBuilder.java:61) at org.openl.OpenL.getInstance(OpenL.java:93) at com.openrules.lang.xls.XlsLoader.parse(XlsLoader.java:249) at com.openrules.lang.xls.XlsParser.parseAsModule(XlsParser.java:62) (...) Caused by: org.openl.OpenConfigurationException: Can not load class: org.openl.grammars.jgrammar.JGrammar at org.openl.conf.ClassFactory.validateClassExistsAndPublic(ClassFactory.java:117) at org.openl.conf.ClassFactory.validate(ClassFactory.java:59) at org.openl.conf.OpenLConfiguration.validate(OpenLConfiguration.java:132) at com.openrules.java.ConfigurationHelper.makeConfig(ConfigurationHelper.java:79) at com.openrules.java.JavaOpenLBuilder.build(JavaOpenLBuilder.java:76) at com.openrules.java.OpenRulesLBuilder.build(OpenRulesLBuilder.java:61) at org.openl.OpenL.getInstance(OpenL.java:93) (...) Caused by: java.lang.ClassNotFoundException: org.openl.grammars.jgrammar.JGrammar at java.net.URLClassLoader$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source)
asked
3 answers
2

All i did is download the Java libraries that were missing and giving errors. I put these in the userlib folder and then opened up the project in eclipse. Once open in elipse and put them in the userlib folder. Then I opened up eclipse right click on the project and select build path. You should then press import jar and select the jar file that is in your userlib folder.

answered
1

Triggered by Ronald answer I dived into OSGi, Felix and bundles e.t.c. Because it works fine in Mendix 4 it must have something to do with the new bundle structure. The classloader that wants to load the JGrammar class in this case can not find the class because it is most likely not visible for the classloader.

I tried a bunch of options including adding buddy policies and export-packages to the manifest file of the project bundle (generated in deployment\model\bundles) but nothing seems to help. I also tried to add Export-Pachage lines to the deployment\run\bnd.bnd file. I even tried to add the jars / classes to mxruntime.jar in the installation folder and added it to the manifest file.

Now, several hours later, I give up and I'm hoping that someone of Mendix can give a solution. Below the complete stacktrace.

com.mendix.modules.microflowengine.MicroflowException: com.mendix.core.CoreRuntimeException: org.openl.OpenConfigurationException: Error processing config file: classpath:/com/openrules/java/openrules.system.xml
    at TheDecisionModel.TestRule (JavaAction : 'Call 'RuleTest'')

Advanced stacktrace:
    at com.mendix.modules.microflowengine.MicroflowUtil.processException(SourceFile:150)

Caused by: com.mendix.core.CoreException: com.mendix.core.CoreRuntimeException: org.openl.OpenConfigurationException: Error processing config file: classpath:/com/openrules/java/openrules.system.xml
    at com.mendix.core.component.InternalCore.execute(SourceFile:264)

Caused by: com.mendix.core.CoreRuntimeException: org.openl.OpenConfigurationException: Error processing config file: classpath:/com/openrules/java/openrules.system.xml
    at com.mendix.core.actionmanagement.ActionManager.executeSync(SourceFile:219)

Caused by: org.openl.OpenConfigurationException: Error processing config file: classpath:/com/openrules/java/openrules.system.xml
    at com.openrules.java.JavaOpenLBuilder.build(JavaOpenLBuilder.java:80)
    at com.openrules.java.OpenRulesLBuilder.build(OpenRulesLBuilder.java:61)
    at org.openl.OpenL.getInstance(OpenL.java:93)
    at com.openrules.lang.xls.XlsLoader.parse(XlsLoader.java:249)
    at com.openrules.lang.xls.XlsParser.parseAsModule(XlsParser.java:62)
    at org.openl.OpenL.compileModule(OpenL.java:233)
    at com.openrules.ruleengine.RuleEngine.<init>(RuleEngine.java:66)
    at com.openrules.ruleengine.OpenRulesEngine.initialize(OpenRulesEngine.java:244)
    at com.openrules.ruleengine.OpenRulesEngine.<init>(OpenRulesEngine.java:160)
    at com.openrules.ruleengine.OpenRulesEngine.<init>(OpenRulesEngine.java:175)
    at thedecisionmodel.actions.RuleTest.executeAction(RuleTest.java:63)
    at thedecisionmodel.actions.RuleTest.executeAction(RuleTest.java:1)
    at com.mendix.systemwideinterfaces.core.UserAction.execute(SourceFile:53)
    at com.mendix.core.actionmanagement.CoreAction.call(SourceFile:270)
    at com.mendix.core.actionmanagement.ActionManager.executeSync(SourceFile:208)
    at com.mendix.core.component.InternalCore.execute(SourceFile:252)
    at com.mendix.gk.execute(SourceFile:42)
    at com.mendix.gW.a(SourceFile:44)
    at com.mendix.gV.a(SourceFile:186)
    at com.mendix.gV.executeAction(SourceFile:151)
    at com.mendix.systemwideinterfaces.core.UserAction.execute(SourceFile:53)
    at com.mendix.core.actionmanagement.CoreAction.call(SourceFile:270)
    at com.mendix.core.actionmanagement.ActionManager.executeSync(SourceFile:208)
    at com.mendix.core.component.InternalCore.execute(SourceFile:252)
    at com.mendix.ik.a(SourceFile:137)
    at com.mendix.iM.a(SourceFile:284)
    at com.mendix.iM$a.apply$mcI$sp(SourceFile:182)
    at com.mendix.iM$d.a(SourceFile:198)
    at com.mendix.iM$d.execute(SourceFile:195)
    at com.mendix.core.session.ActionDispatching$Worker$$anonfun$receive$2.apply(SourceFile:155)
    at com.mendix.core.session.ActionDispatching$Worker$$anonfun$receive$2.apply(SourceFile:154)
    at akka.actor.Actor$class.apply(Actor.scala:545)
    at com.mendix.core.session.ActionDispatching$Worker.apply(SourceFile:150)
    at akka.actor.LocalActorRef.invoke(ActorRef.scala:910)
    at akka.dispatch.MessageInvocation.invoke(MessageHandling.scala:25)
    at akka.dispatch.ExecutableMailbox$class.processMailbox(ExecutorBasedEventDrivenDispatcher.scala:223)
    at akka.dispatch.ExecutorBasedEventDrivenDispatcher$$anon$4.processMailbox(ExecutorBasedEventDrivenDispatcher.scala:123)
    at akka.dispatch.ExecutableMailbox$class.run(ExecutorBasedEventDrivenDispatcher.scala:195)
    at akka.dispatch.ExecutorBasedEventDrivenDispatcher$$anon$4.run(ExecutorBasedEventDrivenDispatcher.scala:123)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
    at akka.dispatch.MonitorableThread.run(ThreadPoolBuilder.scala:192)

Caused by: org.openl.OpenConfigurationException: Can not load class: org.openl.grammars.jgrammar.JGrammar
    at org.openl.conf.ClassFactory.validateClassExistsAndPublic(ClassFactory.java:117)
    at org.openl.conf.ClassFactory.validate(ClassFactory.java:59)
    at org.openl.conf.OpenLConfiguration.validate(OpenLConfiguration.java:132)
    at com.openrules.java.ConfigurationHelper.makeConfig(ConfigurationHelper.java:79)
    at com.openrules.java.JavaOpenLBuilder.build(JavaOpenLBuilder.java:76)
    at com.openrules.java.OpenRulesLBuilder.build(OpenRulesLBuilder.java:61)
    at org.openl.OpenL.getInstance(OpenL.java:93)
    at com.openrules.lang.xls.XlsLoader.parse(XlsLoader.java:249)
    at com.openrules.lang.xls.XlsParser.parseAsModule(XlsParser.java:62)
    at org.openl.OpenL.compileModule(OpenL.java:233)
    at com.openrules.ruleengine.RuleEngine.<init>(RuleEngine.java:66)
    at com.openrules.ruleengine.OpenRulesEngine.initialize(OpenRulesEngine.java:244)
    at com.openrules.ruleengine.OpenRulesEngine.<init>(OpenRulesEngine.java:160)
    at com.openrules.ruleengine.OpenRulesEngine.<init>(OpenRulesEngine.java:175)
    at thedecisionmodel.actions.RuleTest.executeAction(RuleTest.java:63)
    at thedecisionmodel.actions.RuleTest.executeAction(RuleTest.java:1)
    at com.mendix.systemwideinterfaces.core.UserAction.execute(SourceFile:53)
    at com.mendix.core.actionmanagement.CoreAction.call(SourceFile:270)
    at com.mendix.core.actionmanagement.ActionManager.executeSync(SourceFile:208)
    at com.mendix.core.component.InternalCore.execute(SourceFile:252)
    at com.mendix.gk.execute(SourceFile:42)
    at com.mendix.gW.a(SourceFile:44)
    at com.mendix.gV.a(SourceFile:186)
    at com.mendix.gV.executeAction(SourceFile:151)
    at com.mendix.systemwideinterfaces.core.UserAction.execute(SourceFile:53)
    at com.mendix.core.actionmanagement.CoreAction.call(SourceFile:270)
    at com.mendix.core.actionmanagement.ActionManager.executeSync(SourceFile:208)
    at com.mendix.core.component.InternalCore.execute(SourceFile:252)
    at com.mendix.ik.a(SourceFile:137)
    at com.mendix.iM.a(SourceFile:284)
    at com.mendix.iM$a.apply$mcI$sp(SourceFile:182)
    at com.mendix.iM$d.a(SourceFile:198)
    at com.mendix.iM$d.execute(SourceFile:195)
    at com.mendix.core.session.ActionDispatching$Worker$$anonfun$receive$2.apply(SourceFile:155)
    at com.mendix.core.session.ActionDispatching$Worker$$anonfun$receive$2.apply(SourceFile:154)
    at akka.actor.Actor$class.apply(Actor.scala:545)
    at com.mendix.core.session.ActionDispatching$Worker.apply(SourceFile:150)
    at akka.actor.LocalActorRef.invoke(ActorRef.scala:910)
    at akka.dispatch.MessageInvocation.invoke(MessageHandling.scala:25)
    at akka.dispatch.ExecutableMailbox$class.processMailbox(ExecutorBasedEventDrivenDispatcher.scala:223)
    at akka.dispatch.ExecutorBasedEventDrivenDispatcher$$anon$4.processMailbox(ExecutorBasedEventDrivenDispatcher.scala:123)
    at akka.dispatch.ExecutableMailbox$class.run(ExecutorBasedEventDrivenDispatcher.scala:195)
    at akka.dispatch.ExecutorBasedEventDrivenDispatcher$$anon$4.run(ExecutorBasedEventDrivenDispatcher.scala:123)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
    at akka.dispatch.MonitorableThread.run(ThreadPoolBuilder.scala:192)

Caused by: java.lang.ClassNotFoundException: org.openl.grammars.jgrammar.JGrammar
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at org.openl.conf.ClassFactory.validateClassExistsAndPublic(ClassFactory.java:113)
    at org.openl.conf.ClassFactory.validate(ClassFactory.java:59)
    at org.openl.conf.OpenLConfiguration.validate(OpenLConfiguration.java:132)
    at com.openrules.java.ConfigurationHelper.makeConfig(ConfigurationHelper.java:79)
    at com.openrules.java.JavaOpenLBuilder.build(JavaOpenLBuilder.java:76)
    at com.openrules.java.OpenRulesLBuilder.build(OpenRulesLBuilder.java:61)
    at org.openl.OpenL.getInstance(OpenL.java:93)
    at com.openrules.lang.xls.XlsLoader.parse(XlsLoader.java:249)
    at com.openrules.lang.xls.XlsParser.parseAsModule(XlsParser.java:62)
    at org.openl.OpenL.compileModule(OpenL.java:233)
    at com.openrules.ruleengine.RuleEngine.<init>(RuleEngine.java:66)
    at com.openrules.ruleengine.OpenRulesEngine.initialize(OpenRulesEngine.java:244)
    at com.openrules.ruleengine.OpenRulesEngine.<init>(OpenRulesEngine.java:160)
    at com.openrules.ruleengine.OpenRulesEngine.<init>(OpenRulesEngine.java:175)
    at thedecisionmodel.actions.RuleTest.executeAction(RuleTest.java:63)
    at thedecisionmodel.actions.RuleTest.executeAction(RuleTest.java:1)
    at com.mendix.systemwideinterfaces.core.UserAction.execute(SourceFile:53)
    at com.mendix.core.actionmanagement.CoreAction.call(SourceFile:270)
    at com.mendix.core.actionmanagement.ActionManager.executeSync(SourceFile:208)
    at com.mendix.core.component.InternalCore.execute(SourceFile:252)
    at com.mendix.gk.execute(SourceFile:42)
    at com.mendix.gW.a(SourceFile:44)
    at com.mendix.gV.a(SourceFile:186)
    at com.mendix.gV.executeAction(SourceFile:151)
    at com.mendix.systemwideinterfaces.core.UserAction.execute(SourceFile:53)
    at com.mendix.core.actionmanagement.CoreAction.call(SourceFile:270)
    at com.mendix.core.actionmanagement.ActionManager.executeSync(SourceFile:208)
    at com.mendix.core.component.InternalCore.execute(SourceFile:252)
    at com.mendix.ik.a(SourceFile:137)
    at com.mendix.iM.a(SourceFile:284)
    at com.mendix.iM$a.apply$mcI$sp(SourceFile:182)
    at com.mendix.iM$d.a(SourceFile:198)
    at com.mendix.iM$d.execute(SourceFile:195)
    at com.mendix.core.session.ActionDispatching$Worker$$anonfun$receive$2.apply(SourceFile:155)
    at com.mendix.core.session.ActionDispatching$Worker$$anonfun$receive$2.apply(SourceFile:154)
    at akka.actor.Actor$class.apply(Actor.scala:545)
    at com.mendix.core.session.ActionDispatching$Worker.apply(SourceFile:150)
    at akka.actor.LocalActorRef.invoke(ActorRef.scala:910)
    at akka.dispatch.MessageInvocation.invoke(MessageHandling.scala:25)
    at akka.dispatch.ExecutableMailbox$class.processMailbox(ExecutorBasedEventDrivenDispatcher.scala:223)
    at akka.dispatch.ExecutorBasedEventDrivenDispatcher$$anon$4.processMailbox(ExecutorBasedEventDrivenDispatcher.scala:123)
    at akka.dispatch.ExecutableMailbox$class.run(ExecutorBasedEventDrivenDispatcher.scala:195)
    at akka.dispatch.ExecutorBasedEventDrivenDispatcher$$anon$4.run(ExecutorBasedEventDrivenDispatcher.scala:123)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
    at akka.dispatch.MonitorableThread.run(ThreadPoolBuilder.scala:192)
answered
0

Did you read the documentation about moving from 4 to 5 Look at the part important changes "In the first step we will copy all the libraries from the Mendix 4 runtime to your userlib directory. Also, we will analyze your Java files and repair some errors in imports that have arisen because Mendix Java classes were moved to different packages." Could this be the cause of the problems?

Regards,

Ronald

answered