cancel
Showing results for 
Search instead for 
Did you mean: 

Loader constraint violation error

limcheekin
Champ on-the-rise
Champ on-the-rise
Hi,

I managed to port all examples from JUnit3 to JUnit4 style. But there are still 4 tests failed with error in Grails environment for the following two Test classes:
org.activiti.examples.bpmn.scripttask.ScriptTaskTest

loader constraint violation: when resolving overridden method "org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.getFactory()Ljavax/script/ScriptEngineFactory;" the class loader (instance of org/codehaus/groovy/grails/cli/support/GrailsRootLoader) of the current class, org/codehaus/groovy/jsr223/GroovyScriptEngineImpl, and its superclass loader (instance of <bootloader>), have different Class objects for the type javax/script/ScriptEngineFactory used in the signature

java.lang.LinkageError: loader constraint violation: when resolving overridden method "org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.getFactory()Ljavax/script/ScriptEngineFactory;" the class loader (instance of org/codehaus/groovy/grails/cli/support/GrailsRootLoader) of the current class, org/codehaus/groovy/jsr223/GroovyScriptEngineImpl, and its superclass loader (instance of ), have different Class objects for the type javax/script/ScriptEngineFactory used in the signature
at org.codehaus.groovy.jsr223.GroovyScriptEngineFactory.getScriptEngine(GroovyScriptEngineFactory.java:104)
at javax.script.ScriptEngineManager.getEngineByName(ScriptEngineManager.java:133)
at org.activiti.engine.impl.scripting.ScriptingEngines.evaluate(ScriptingEngines.java:60)
at org.activiti.engine.impl.bpmn.ScriptTaskActivity.execute(ScriptTaskActivity.java:45)
at org.activiti.pvm.impl.runtime.AtomicOperationActivityExecute.execute(AtomicOperationActivityExecute.java:40)
at org.activiti.pvm.impl.runtime.ExecutionImpl.performOperation(ExecutionImpl.java:523)
at org.activiti.pvm.impl.runtime.ExecutionImpl.start(ExecutionImpl.java:362)
at org.activiti.engine.impl.cmd.StartProcessInstanceCmd.execute(StartProcessInstanceCmd.java:64)
at org.activiti.engine.impl.cmd.StartProcessInstanceCmd.execute(StartProcessInstanceCmd.java:29)
at org.activiti.engine.impl.interceptor.CommandExecutorImpl.execute(CommandExecutorImpl.java:22)
at org.activiti.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:36)
at org.activiti.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:33)
at org.activiti.engine.impl.RuntimeServiceImpl.startProcessInstanceByKey(RuntimeServiceImpl.java:46)
at org.activiti.examples.bpmn.scripttask.ScriptTaskTest.testScriptExecution(ScriptTaskTest.java:38)

org.activiti.examples.taskforms.TaskFormsTest

loader constraint violation: when resolving overridden method "org.activiti.engine.impl.scripting.JuelScriptEngine.getFactory()Ljavax/script/ScriptEngineFactory;" the class loader (instance of org/codehaus/groovy/grails/cli/support/GrailsRootLoader) of the current class, org/activiti/engine/impl/scripting/JuelScriptEngine, and its superclass loader (instance of <bootloader>), have different Class objects for the type javax/script/ScriptEngineFactory used in the signature

java.lang.LinkageError: loader constraint violation: when resolving overridden method "org.activiti.engine.impl.scripting.JuelScriptEngine.getFactory()Ljavax/script/ScriptEngineFactory;" the class loader (instance of org/codehaus/groovy/grails/cli/support/GrailsRootLoader) of the current class, org/activiti/engine/impl/scripting/JuelScriptEngine, and its superclass loader (instance of ), have different Class objects for the type javax/script/ScriptEngineFactory used in the signature
at org.activiti.engine.impl.scripting.JuelScriptEngineFactory.getScriptEngine(JuelScriptEngineFactory.java:129)
at javax.script.ScriptEngineManager.getEngineByName(ScriptEngineManager.java:133)
at org.activiti.engine.impl.scripting.ScriptingEngines.evaluate(ScriptingEngines.java:60)
at org.activiti.engine.impl.cmd.GetRenderedFormCmd.execute(GetRenderedFormCmd.java:92)
at org.activiti.engine.impl.interceptor.CommandExecutorImpl.execute(CommandExecutorImpl.java:22)
at org.activiti.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:36)
at org.activiti.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:33)
at org.activiti.engine.impl.TaskServiceImpl.getRenderedStartFormByKey(TaskServiceImpl.java:115)
at org.activiti.examples.taskforms.TaskFormsTest.testTaskFormsWithVacationRequestProcess(TaskFormsTest.java:59)

Attached here source codes of activiti examples in JUnit4 style.
[attachment=0]activiti-examples-junit4.zip[/attachment]

Any idea how to fix the error? Please advice.

Regards,
Chee Kin
5 REPLIES 5

frederikherema1
Star Contributor
Star Contributor
Hi,

Can you try to run the tests without the livetribe-jsr223-2.0.6.jar on the classpath? This jar contains the javax.script classes, which are missing when running on Java 5 environment. I'm guessing that these classes are colliding with the ones on your JDK.

regards,
Frederik Heremans

limcheekin
Champ on-the-rise
Champ on-the-rise
Hi Frederik Heremans,

Yes, it works! All tests PASSED now. Is that means the library is needed in JDK5 environment only, but not JDK6 and onward?

Thank you very much!

Regards,
Chee Kin

jbarrez
Star Contributor
Star Contributor
@Chee: thats indeed the case. The livetribe jar is an implementation of the javax.script classes which are part of JDK6, but not of JDK5.

Congrats with the green tests 🙂

frederikherema1
Star Contributor
Star Contributor
Chee,

Apparently some classloaders are more forgiving than others when it comes to duplicate class entries Smiley Wink

limcheekin
Champ on-the-rise
Champ on-the-rise
Hi,

Yeah! Thanks for confirmation.

Regards,
Chee Kin