question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

java.lang.ClassNotFoundException: org.mvel2.compiler.Accessor

See original GitHub issue

In Mvel 2.4.3 on WildFly 16/Open JDK 11 we observe that


java.lang.ClassNotFoundException: org.mvel2.compiler.Accessor
	at java.base/java.lang.ClassLoader.findClass(ClassLoader.java:718)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:588)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
	at java.base/java.lang.ClassLoader.defineClass1(Native Method)
	at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1016)
	at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:877)
	at org.mvel//org.mvel2.optimizers.impl.asm.ASMAccessorOptimizer$ContextClassLoader.defineClass(ASMAccessorOptimizer.java:2245)
	at org.mvel//org.mvel2.optimizers.impl.asm.ASMAccessorOptimizer.loadClass(ASMAccessorOptimizer.java:2254)
	at org.mvel//org.mvel2.optimizers.impl.asm.ASMAccessorOptimizer._initializeAccessor(ASMAccessorOptimizer.java:750)
	at org.mvel//org.mvel2.optimizers.impl.asm.ASMAccessorOptimizer.optimizeSetAccessor(ASMAccessorOptimizer.java:665)
	at org.mvel//org.mvel2.optimizers.dynamic.DynamicSetAccessor.optimize(DynamicSetAccessor.java:83)
	at org.mvel//org.mvel2.optimizers.dynamic.DynamicSetAccessor.setValue(DynamicSetAccessor.java:60)
	at org.mvel//org.mvel2.compiler.CompiledAccExpression.setValue(CompiledAccExpression.java:59)
	at org.mvel//org.mvel2.ast.DeepAssignmentNode.getReducedValueAccelerated(DeepAssignmentNode.java:90)
	at org.mvel//org.mvel2.compiler.ExecutableAccessor.getValue(ExecutableAccessor.java:42)
	at org.mvel//org.mvel2.MVEL.executeExpression(MVEL.java:968)

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
abykuruvilla-devcommented, Jan 16, 2022

@MalcolmOdd sure. It strangely happens for certain templates and only after deployment. Because of company policy reasons I can’t share the exact code. But we use orbs and mostly like this

String templateStr="@{AmountValidation.isNonNegative(row.get(\"totalAmount\"))}";
CompiledTemplate=TemplateCompiler.compile(templateStr);
...........
//Following line gets executed in multiple threads.
Object result=TemplateRuntime.execute(template,null,factory);

We provide the variables using VariableResolverFactory. Attached the stacktrace

Caused by: java.lang.NoClassDefFoundError: null
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[na:na]
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[na:na]
at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[na:na]
at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490) ~[na:na]
at java.base/java.util.concurrent.ForkJoinTask.getThrowableException(ForkJoinTask.java:603) ~[na:na]
... 72 common frames omitted
Caused by: java.lang.NoClassDefFoundError: org/mvel2/compiler/Accessor
at java.base/java.lang.ClassLoader.defineClass1(Native Method) ~[na:na]
at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1017) ~[na:na]
at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:878) ~[na:na]
at org.mvel2.optimizers.impl.asm.ASMAccessorOptimizer$ContextClassLoader.defineClass(ASMAccessorOptimizer.java:2311) ~[mvel2-2.4.12.Final.jar!/:na]
at org.mvel2.optimizers.impl.asm.ASMAccessorOptimizer.loadClass(ASMAccessorOptimizer.java:2322) ~[mvel2-2.4.12.Final.jar!/:na]
at org.mvel2.optimizers.impl.asm.ASMAccessorOptimizer._initializeAccessor(ASMAccessorOptimizer.java:814) ~[mvel2-2.4.12.Final.jar!/:na]
at org.mvel2.optimizers.impl.asm.ASMAccessorOptimizer.compileAccessor(ASMAccessorOptimizer.java:957) ~[mvel2-2.4.12.Final.jar!/:na]
at org.mvel2.optimizers.impl.asm.ASMAccessorOptimizer.optimizeAccessor(ASMAccessorOptimizer.java:345) ~[mvel2-2.4.12.Final.jar!/:na]
at org.mvel2.optimizers.dynamic.DynamicGetAccessor.optimize(DynamicGetAccessor.java:95) ~[mvel2-2.4.12.Final.jar!/:na]
at org.mvel2.optimizers.dynamic.DynamicGetAccessor.getValue(DynamicGetAccessor.java:65) ~[mvel2-2.4.12.Final.jar!/:na]
at org.mvel2.ast.Union.getReducedValueAccelerated(Union.java:39) ~[mvel2-2.4.12.Final.jar!/:na]
at org.mvel2.ast.Or.getReducedValueAccelerated(Or.java:34) ~[mvel2-2.4.12.Final.jar!/:na]
at org.mvel2.compiler.ExecutableAccessor.getValue(ExecutableAccessor.java:42) ~[mvel2-2.4.12.Final.jar!/:na]
at org.mvel2.MVEL.executeExpression(MVEL.java:945) ~[mvel2-2.4.12.Final.jar!/:na]
at org.mvel2.templates.res.CompiledTerminalExpressionNode.eval(CompiledTerminalExpressionNode.java:39) ~[mvel2-2.4.12.Final.jar!/:na]
at org.mvel2.templates.TemplateRuntime.execute(TemplateRuntime.java:285) ~[mvel2-2.4.12.Final.jar!/:na]
at org.mvel2.templates.TemplateRuntime.execute(TemplateRuntime.java:247) ~[mvel2-2.4.12.Final.jar!/:na]
at org.mvel2.templates.TemplateRuntime.execute(TemplateRuntime.java:255) ~[mvel2-2.4.12.Final.jar!/:na]
at org.mvel2.templates.TemplateRuntime.execute(TemplateRuntime.java:203) ~[mvel2-2.4.12.Final.jar!/:na]
***********************remove private classes from stack trace***************************************
at java.base/java.util.concurrent.ForkJoinTask$AdaptedCallable.exec(ForkJoinTask.java:1448) ~[na:na]
at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:290) ~[na:na]
at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1020) ~[na:na]
at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1656) ~[na:na]
at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1594) ~[na:na]
at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:183) ~[na:na]
Caused by: java.lang.ClassNotFoundException: org.mvel2.compiler.Accessor
at java.base/java.lang.ClassLoader.findClass(ClassLoader.java:719) ~[na:na]
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:589) ~[na:na]
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522) ~[na:na]
... 33 common frames omitted
0reactions
rady66commented, May 9, 2022

that was pretty back in time so i forgot how we resolved it… it could be a synchronization/timing issue where classloader-s are reset and then reverted back… a code inspection might narrow down the problem while reproducing is quite difficult

Read more comments on GitHub >

github_iconTop Results From Across the Web

java.lang.NoClassDefFoundError: org/mvel2/compiler ...
When I was run compileKotlin task then I got an error. I'm confused for cause of error kapt or codegen > Task :wrapper...
Read more >
MVEL Error Caused by: java.lang.NoClassDefFoundError: org ...
I got an error msg after executing my program: Caused by: java.lang.NoClassDefFoundError: org/mvel2/ConversionHandler .
Read more >
java.lang.NoClassDefFoundError: org/mvel2/compiler/Accessor
I have 51 classes with @DataObject(generateConverter = true) If I was compile I got a kapt error. But When I delete any of...
Read more >
Drools application throws ClassNotFoundException when ...
Exception in thread "main" java.lang.NoClassDefFoundError: some/application/Class at ASMAccessorImpl_XXXXXXXXXXXXXXXXXX.
Read more >
(JBRULES-2358) ClassNotFoundException when using "mvel ...
getReducedValueAccelerated(BinaryOperation.java:102) at org.mvel2.compiler.ExecutableAccessor.getValue(ExecutableAccessor.java:41) at ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found