Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Illegal type in constant pool #27

Open
kreksbeks opened this issue Dec 6, 2013 · 15 comments
Open

Illegal type in constant pool #27

kreksbeks opened this issue Dec 6, 2013 · 15 comments

Comments

@kreksbeks
Copy link

@kreksbeks kreksbeks commented Dec 6, 2013

Environment:
Windows 7, amd64
MVEL: 2.1.7.Final, 2.1.4.Final
java version "1.8.0-ea"
Java(TM) SE Runtime Environment (build 1.8.0-ea-b118)
Java HotSpot(TM) 64-Bit Server VM (build 25.0-b60, mixed mode)

**** COMPILER BUG! REPORT THIS IMMEDIATELY AT http://jira.codehaus.org/browse/mvel2
Expression: (name.first in persons)
Exception in thread "main" java.lang.VerifyError: (class: ASMAccessorImpl_4458843621386333353870, method: getKnownEgressType signature: ()Ljava/lang/Class;) Illegal type in constant pool
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Class.java:2650)
at java.lang.Class.getConstructor0(Class.java:2956)
at java.lang.Class.newInstance(Class.java:403)
at org.mvel2.optimizers.impl.asm.ASMAccessorOptimizer._initializeAccessor(ASMAccessorOptimizer.java:725)
at org.mvel2.optimizers.impl.asm.ASMAccessorOptimizer.compileAccessor(ASMAccessorOptimizer.java:859)
at org.mvel2.optimizers.impl.asm.ASMAccessorOptimizer.optimizeAccessor(ASMAccessorOptimizer.java:243)
at org.mvel2.optimizers.dynamic.DynamicGetAccessor.optimize(DynamicGetAccessor.java:90)
at org.mvel2.optimizers.dynamic.DynamicGetAccessor.getValue(DynamicGetAccessor.java:64)
at org.mvel2.ast.ASTNode.getReducedValueAccelerated(ASTNode.java:108)
at org.mvel2.compiler.ExecutableAccessor.getValue(ExecutableAccessor.java:38)
at org.mvel2.ast.Fold.getReducedValue(Fold.java:137)
at org.mvel2.MVELInterpretedRuntime.parseAndExecuteInterpreted(MVELInterpretedRuntime.java:106)
at org.mvel2.MVELInterpretedRuntime.parse(MVELInterpretedRuntime.java:49)
at org.mvel2.MVEL.eval(MVEL.java:165)
at com.pontiki.core.datasource.MVELTestCase.testCase(MVELTestCase.java:23)
at com.pontiki.core.datasource.MVELTestCase.main(MVELTestCase.java:15)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)


To reproduce the issue use the following test case.

import org.mvel2.MVEL;
import test.domain.Name;
import test.domain.Person;

import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;

public class MVELTestCase {

public static void main(String[] args) {
    testCase();
}

public static void testCase() {
    Collection<Person> persons = getPersons(200);
    Map<String, Object> vars = new HashMap<>();
    vars.put("persons", persons);

    Object eval = MVEL.eval("(name.first in persons)", vars);
    System.out.println(eval);
}

private static Collection<Person> getPersons(int number) {
    Collection<Person> persons = new ArrayList<>();
    for (int i = 0; i < number; i++)
    {
        Person person2 = new Person();
        person2.setName(new Name(toLetter(i) + "name", "Last"));
        persons.add(person2);
    }
    return persons;
}

private static char toLetter(int i) {
    return (char) (i % (90 - 65 + 1)  + 65);
}
}
@alvarojoao

This comment has been minimized.

Copy link

@alvarojoao alvarojoao commented Jun 5, 2014

I'm experiencing this problem too.
But I'm using update from elasticsearch, in setScript(_) I'm trying to do the same thing and It's not working for some process... not all of them

@steveluo

This comment has been minimized.

Copy link

@steveluo steveluo commented Sep 15, 2015

Any updates on this issue? We are also suffering this issue when upgrading to Java 8.

@toamitmaurya

This comment has been minimized.

Copy link

@toamitmaurya toamitmaurya commented Jan 4, 2016

Hi Steveluo ,
Did you find any solution to this issue?

@steveluo

This comment has been minimized.

Copy link

@steveluo steveluo commented Jan 4, 2016

@toamitmaurya
No, we simply replace the MVEL with groovy.

@mkornipati

This comment has been minimized.

Copy link

@mkornipati mkornipati commented Feb 2, 2016

I reproduced the same issue with Java8 and investigated little bit here and root cause seems to be here
https://github.com/mikebrock/mvel/blob/master/src/main/java/org/mvel2/optimizers/impl/asm/ASMAccessorOptimizer.java#L81-L89

in case javaVersion 1.8, it is using OPCODES_VERSION = Opcodes.V1_2;

for now, I went a head and updated locally, for Java version 1.8, using OPCODES_VERSION = Opcodes.V1_7; and it works!!

mkornipati pushed a commit to mkornipati/mvel that referenced this issue Feb 10, 2016
jscattergood added a commit to jscattergood/mvel that referenced this issue Mar 24, 2016
@arun2arunraj

This comment has been minimized.

Copy link

@arun2arunraj arun2arunraj commented May 11, 2016

@mkornipati : Could you please elaborate what you have done to fix the issue ? I am just confused where to change the String ( OPCODES_VERSION ).

@kobe2000

This comment has been minimized.

Copy link

@kobe2000 kobe2000 commented Jan 17, 2017

I met the same problem, and it is blocking me. How to solve this problem without changing JDK?

@rajmalarapu

This comment has been minimized.

Copy link

@rajmalarapu rajmalarapu commented Jan 20, 2017

Code within org.mvel2.optimizers.impl.asm.ASMAccessorOptimizer should be fixed as shown in below article:
http://copyrightdev.tumblr.com/post/146315831773/getting-drools-5x-to-operate-smoothly-with-java-8

Also, this code issue has been fixed in mvel2 2.2.0.Final version.

@NagarjunaReddyBadolla

This comment has been minimized.

Copy link

@NagarjunaReddyBadolla NagarjunaReddyBadolla commented Sep 24, 2018

Hi, Some one can suggest the any solution for below issue. i have added janino compiler after wrong class format, again i am getting some thing like below
org.drools.RuntimeDroolsException: java.lang.ClassNotFoundException: com.xxx.xxx.drools.rules.Rule_xxx_Value_Adjustment_0ConsequenceInvoker
[09/24 09:50:44.847][ERROR]DroolsServlet:75 - Loading Drools Failed :org.drools.RuntimeDroolsException: java.lang.ClassNotFoundException: com.xxx.xxx.drools.rules.Rule_xxx_Value_Adjustment_0ConsequenceInvoker

stephanborn pushed a commit to stephanborn/mvel that referenced this issue Mar 14, 2019
…el#27 - on unpatched sources it failes with Java8, patched it runs fine.
@vikasbo

This comment has been minimized.

Copy link

@vikasbo vikasbo commented May 13, 2019

@mkornipati Hello Mohan - where have you published the alternate mvel-2.1.3-Final-Patch jar? I would like to use it. Please let me know.

@dstine

This comment has been minimized.

Copy link

@dstine dstine commented May 13, 2019

Our updated artifact is published to an internal repository.

But this is the code change:
image

@vikasbo

This comment has been minimized.

Copy link

@vikasbo vikasbo commented May 13, 2019

Thanks @dstine. Actually, I could locate the patch and diff. Its here as the top commit on this branch. https://github.com/mkornipati/mvel/tree/2.1.9.Final.Patch However, in order to use it, I need either of:

  1. mvel jar for 2.1.9.Final.Patch
  2. Instructions to build the jar from maven project https://github.com/mkornipati/mvel/tree/2.1.9.Final.Patch

Both are elusive. When I try to build locally, I get this error:

`[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile (default-compile) on project mvel2: Compilation failure
[ERROR] ~/mvel/src/main/java/org/mvel2/util/JITClassLoader.java:[49,33] error: method defineClass in class Unsafe cannot be applied to given types;
[ERROR]
[ERROR] -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile (default-compile) on project mvel2: Compilati
on failure
~/mvel/src/main/java/org/mvel2/util/JITClassLoader.java:[49,33] error: method defineClass in class Unsafe cannot be applied to given types;

at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:213)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:154)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:146)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:117)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:81)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:309)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:194)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:107)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:993)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:345)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:191)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)

Caused by: org.apache.maven.plugin.CompilationFailureException: Compilation failure
~/mvel/src/main/java/org/mvel2/util/JITClassLoader.java:[49,33] error: method defineClass in class Unsafe cannot be applied to given types;

at org.apache.maven.plugin.AbstractCompilerMojo.execute(AbstractCompilerMojo.java:656)
at org.apache.maven.plugin.CompilerMojo.execute(CompilerMojo.java:128)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
... 20 more

`

Appreciate help on either of the above 2.

@vikasbo

This comment has been minimized.

Copy link

@vikasbo vikasbo commented May 13, 2019

I could do mvn package after downgrading current java to Java 7. Thanks.

@dstine

This comment has been minimized.

Copy link

@dstine dstine commented May 13, 2019

Ah, okay. FWIW, we used JDK 6u33.

@vikasbo

This comment has been minimized.

Copy link

@vikasbo vikasbo commented May 15, 2019

Hello @dstine ! Is this patch purported to fix the drools rules v5.0.1 compilation with Java 8? If that is the goal, it hasn't worked for me. Do you have any pointers for me?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
You can’t perform that action at this time.