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

ClassLoader cannot load model classes under OpenJDK 11. Is Java 11 even supported? #803

Closed
lpld opened this issue Oct 24, 2018 · 28 comments
Closed

Comments

@lpld
Copy link

lpld commented Oct 24, 2018

Trying to migrate our apps to Java 11. Got an error while starting the app, definitely something related to instrumentation. Using latest available version of ActiveJDBC (2.2). Error happens under AdoptOpenJDK jdk-11.28.
I couldn't find any info about the supported Java versions in ActiveJDBC. Is Java 11 supported?
Here's the log:

java.lang.ClassFormatError: Nest member class_info_index 10 has bad constant type in class file com/company/model/MyModelClass
        at java.base/java.lang.ClassLoader.defineClass1(Native Method)
        at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1016)
        at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:174)
        at org.apache.catalina.loader.WebappClassLoaderBase.findClassInternal(WebappClassLoaderBase.java:2337)
        at org.apache.catalina.loader.WebappClassLoaderBase.findClass(WebappClassLoaderBase.java:829)
        at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1278)
        at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1137)
        at java.base/java.lang.Class.getDeclaredMethods0(Native Method)
        at java.base/java.lang.Class.privateGetDeclaredMethods(Class.java:3167)
        at java.base/java.lang.Class.getDeclaredMethods(Class.java:2310)
        at org.glassfish.jersey.server.model.IntrospectionModeller$2.run(IntrospectionModeller.java:255)
        at java.base/java.security.AccessController.doPrivileged(Native Method)
        at org.glassfish.jersey.server.model.IntrospectionModeller.getAllDeclaredMethods(IntrospectionModeller.java:249)
        at org.glassfish.jersey.server.model.IntrospectionModeller.checkForNonPublicMethodIssues(IntrospectionModeller.java:174)
        at org.glassfish.jersey.server.model.IntrospectionModeller.doCreateResourceBuilder(IntrospectionModeller.java:121)
        at org.glassfish.jersey.server.model.IntrospectionModeller.access$000(IntrospectionModeller.java:82)
        at org.glassfish.jersey.server.model.IntrospectionModeller$1.call(IntrospectionModeller.java:114)
        at org.glassfish.jersey.server.model.IntrospectionModeller$1.call(IntrospectionModeller.java:111)
        at org.glassfish.jersey.internal.Errors.process(Errors.java:316)
        at org.glassfish.jersey.internal.Errors.process(Errors.java:298)
        at org.glassfish.jersey.internal.Errors.processWithException(Errors.java:256)
        at org.glassfish.jersey.server.model.IntrospectionModeller.createResourceBuilder(IntrospectionModeller.java:111)
        at org.glassfish.jersey.server.model.Resource.from(Resource.java:800)
        at org.glassfish.jersey.server.ResourceBagConfigurator.init(ResourceBagConfigurator.java:79)
        at org.glassfish.jersey.server.ApplicationHandler.initialize(ApplicationHandler.java:354)
        at org.glassfish.jersey.server.ApplicationHandler.lambda$initialize$1(ApplicationHandler.java:316)
        at org.glassfish.jersey.internal.Errors.process(Errors.java:316)
        at org.glassfish.jersey.internal.Errors.process(Errors.java:298)
        at org.glassfish.jersey.internal.Errors.processWithException(Errors.java:256)
        at org.glassfish.jersey.server.ApplicationHandler.initialize(ApplicationHandler.java:315)
        at org.glassfish.jersey.server.ApplicationHandler.<init>(ApplicationHandler.java:282)
        at org.glassfish.jersey.servlet.WebComponent.<init>(WebComponent.java:335)
        at org.glassfish.jersey.servlet.ServletContainer.init(ServletContainer.java:178)
        at org.glassfish.jersey.servlet.ServletContainer.init(ServletContainer.java:370)
        at javax.servlet.GenericServlet.init(GenericServlet.java:158)
        at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1144)
        at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:986)
        at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4978)
        at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5290)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
        at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1420)
        at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1410)
        at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
        at java.base/java.lang.Thread.run(Thread.java:834)

Thank you.

@ipolevoy
Copy link
Member

Sorry, but we are not supporting JDK above 8.x yet

@lpld
Copy link
Author

lpld commented Oct 24, 2018

Any plans to support them in the near future?

@ipolevoy
Copy link
Member

@lpld good question, I do not see reasons why not, also considering the current state of Java, we should migrate to OpenJDK and probably skip versions 9, 10 and start supporting v 11.
But before that, we probably need to make the last release for v8

thoughts?

@lpld
Copy link
Author

lpld commented Oct 24, 2018

Well, I like the plan :) Supporting 9 and 10 definitely wouldn't make any sense.

BTW, is there any way I can help? I won't be able to spend too much time, but I think I could find some.

@ipolevoy
Copy link
Member

@lpld that would be great! Can you fork, and run the build on OpenJDK 9 first? Then v 11.

Some work for JDK9 has already been done on this branch: https://github.com/javalite/activejdbc/commits/java9, so you may look into that.

As you find issues, we can collaborate here. Once the local build is working on 9 and 11, we will configure a new build on Travis.

@lpld
Copy link
Author

lpld commented Oct 24, 2018

Great, thanks. I will keep you informed then.
What's the reason for getting the build to work on 9 first? Is it because you've already done some work on it?

@ipolevoy
Copy link
Member

@lpld simply showing you what changes you may need to make on the 11.

@lpld
Copy link
Author

lpld commented Oct 24, 2018

Ahh I see. I thought you wanted to do it in some kind of incremental way: Java 9, then Java 11. Ok, so I will post my updates here as I move on.

@ipolevoy
Copy link
Member

@lpld 👍

@lpld
Copy link
Author

lpld commented Oct 25, 2018

Stuck for now. Maven plugin-plugin uses maven-plugin-tools (latest version is 3.5.2), which in turn uses ASM 5. ASM starts supporting Java 11 from version 7 and is now only in beta. Thought I could trick plugin-tools by specifying ASM 7-beta dependency directly, but it turns out that plugin-tools specify ASM api version in the code: https://github.com/apache/maven-plugin-tools/blob/maven-plugin-tools-3.5.2/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/extractor/annotations/scanner/visitors/MojoAnnotationVisitor.java

super( Opcodes.ASM5 );

So it fails even with ASM 7. Looks like we'll have to wait until maven-plugin-tools 3.6.0 is out.

And maybe it was a good idea to start incrementally, from Java 9 :)

@ipolevoy
Copy link
Member

haha, maybe. However, that -brings more complexities. Some people will stay on the v8 for a long time, meaning we will have to support all features and bugs in multiple branches and have multiple Travis builds for different versions of JavaLite. This is one reason why we stopped at v8 for now.

@lpld
Copy link
Author

lpld commented Oct 25, 2018

Agree. Let's wait for ASM 7 and maven-plugin-tools releases then. Will see how it builds after that.

@ipolevoy
Copy link
Member

👍

@lpld
Copy link
Author

lpld commented Oct 30, 2018

Just saw the news: ASM 7.0 released
https://asm.ow2.io/
Looks like maven-plugin-tools did too (according to their github), but I can't still find them in maven-central. Probably have to wait a bit.

@ipolevoy
Copy link
Member

when I release new versions of JavaLite, it takes a day/two for them to show on Maven central

@jacktang
Copy link

jacktang commented May 9, 2019

Hello, does 2.3-20190203.171650-13 snapshot support jdk11?
I got the below error

java.lang.ClassFormatError: Nest member class_info_index 14 has bad constant type in class file app/models/Case
	at java.base/java.lang.ClassLoader.defineClass1(Native Method)
	at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1016)
	at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:151)

The compiler:

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.8.0</version>
                <configuration>
                    <release>11</release>
                </configuration>
            </plugin> 

@jacktang
Copy link

jacktang commented May 9, 2019

2.3-SNAPSHOT works great 👍

@ipolevoy
Copy link
Member

ipolevoy commented May 9, 2019

@jacktang you got lucky, we are not yet supporting Java 11 officially. Will be soon though!

@pguillardp
Copy link

Will be soon though!
clever! Good new! 2.3-SNAPSHOT works well. Thank you jacktang.
Igor, keep up the good work. Activejdbc is OUTSTANDING!!!!!!!!!!!

@jacktang
Copy link

@ipolevoy FormItem has some bugs on JDK11.

  1. isFile() return false when the FormItem is multi-part
  2. Can't get other normal form items.
    I rolled back to JDK1.8 ...

@ipolevoy
Copy link
Member

@jacktang , we will be releasing the 2.3 version in the next week/two and after that, will be migrating to Java 11 for 2.4 release.

@npmarrin
Copy link

npmarrin commented Jun 5, 2019

@ipolevoy what is the current timeline for 2.3 and 2.4?

@ipolevoy
Copy link
Member

ipolevoy commented Jun 5, 2019

@npmarrin we are working to restore the Travis build which broke for some reason. When that is done (@jfcabral promises this weekend), we will focus on releasing 2.3. After that, we will set a new snapshot version 3.0-SNAPSHOT (not 2.4) and focus on Java 11 support. I hope we can do both before mid-July.

@npmarrin
Copy link

npmarrin commented Jun 6, 2019

@ipolevoy 👍

@jamesmarcjon
Copy link

@ipolevoy just checking in, curious if you are still generally on track with 2.4 for mid July or sooner?

@ipolevoy
Copy link
Member

ipolevoy commented Jul 9, 2019

we just released 2.3 and will be working on releasing 3.0 on Java 11m however that work will start some tine this week, so hard to tell, but we are shooting for end of July at least.

@ipolevoy
Copy link
Member

ipolevoy commented Jul 22, 2019

Hey guys, good news. The Java11 support is around the corner. The first snapshot is published: https://oss.sonatype.org/content/repositories/snapshots/org/javalite/activejdbc/3.0-SNAPSHOT/.
Please, take it for a spin and see if this is working for you. This was pushed out directly from my dev box.
The Travis build is being taken care of too, so once this is complete: #870, you will have a 3.0-SNAPSHOT regularly updated in the snapshot repo.

Can you please take this shanshot for a spin and let me know if it resolves this issue, so I could close it.

@ipolevoy
Copy link
Member

@lpld I will be closing this issue in lieu of my comment above #803 (comment) and #869. If you run into problems, you can reopen this issue or open a new one.

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

No branches or pull requests

6 participants