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

Multiple NoClassDefFoundError with SVM built with jdk11u #8081

Closed
galderz opened this issue Mar 23, 2020 · 23 comments
Closed

Multiple NoClassDefFoundError with SVM built with jdk11u #8081

galderz opened this issue Mar 23, 2020 · 23 comments
Assignees
Labels
area/spring Issues relating to the Spring integration kind/bug Something isn't working triage/out-of-date This issue/PR is no longer valid or relevant

Comments

@galderz
Copy link
Member

galderz commented Mar 23, 2020

jdk11u now contains the necessary bits to build a JDK with static libraries, which is required to build substratevm. While testing a snapshot JDK built out of there the following error has appeared:

Caused by: java.lang.NoClassDefFoundError: [Lorg/springframework/http/HttpMethod;
        at java.base/java.lang.Class.getDeclaredMethods0(Native Method)
        at java.base/java.lang.Class.privateGetDeclaredMethods(Class.java:3166)
        at java.base/java.lang.Class.getDeclaredMethods(Class.java:2309)
        at jdk.internal.vm.ci/jdk.vm.ci.hotspot.HotSpotResolvedObjectTypeImpl.getDeclaredMethods(HotSpotResolvedObjectTypeImpl.java:932)
        at com.oracle.svm.hosted.classinitialization.ClassInitializationFeature.declaresDefaultMethods(ClassInitializationFeature.java:375)
        at com.oracle.svm.hosted.classinitialization.ConfigurableClassInitialization.processInterfaces(ConfigurableClassInitialization.java:580)
        at com.oracle.svm.hosted.classinitialization.ConfigurableClassInitialization.computeInitKindAndMaybeInitializeClass(ConfigurableClassInitialization.java:556)
        at com.oracle.svm.hosted.classinitialization.ConfigurableClassInitialization.computeInitKindAndMaybeInitializeClass(ConfigurableClassInitialization.java:130)
        at com.oracle.svm.hosted.classinitialization.ConfigurableClassInitialization.maybeInitializeHosted(ConfigurableClassInitialization.java:158)
        at com.oracle.svm.hosted.SVMHost.registerType(SVMHost.java:200)

Longer output can be found here.

We've had a little Zulip conversation here, and we've discovered that HttpMethod is not included in the jar. The question is, why does it get into the pointsto analysis with this particular JDK? Further analysis is required.

@galderz galderz added the kind/bug Something isn't working label Mar 23, 2020
@quarkusbot quarkusbot added the area/spring Issues relating to the Spring integration label Mar 23, 2020
@quarkusbot
Copy link

/cc @geoand

@galderz galderz self-assigned this Mar 23, 2020
@galderz
Copy link
Member Author

galderz commented Mar 24, 2020

The labs JDK contains newer JVMCI code that invokes into CompilerToVm.getDeclaredMethods() which does not fail if a method referencing a not found type is found. jdk11u is still using the old style which means this kind of CNFEs can happen, even if ResponseEntity$HeadersBuilder.allow(HttpMethod[]) method is not in use. I'm looking into the commits that added these changes to see if they can be backported to jdk11u.

@geoand
Copy link
Contributor

geoand commented Mar 24, 2020

Thanks for the update @galderz!

@galderz
Copy link
Member Author

galderz commented Mar 24, 2020

The code changes required to bring JVMCI code up to the newer version are too much. So, for the time being we're going to explore the option of adding missing classes to jars.

These extra classes do not make it to the final native image, nor do they have an impact on the JVM mode. So, it's a relatively safe option. Next few days I will explore which other classes are required to satisfy this.

@aureamunoz
Copy link
Member

Ok @galderz let us know when and what you want to add;

@galderz
Copy link
Member Author

galderz commented Mar 25, 2020

Another one impacted (longer output):

Caused by: java.lang.NoClassDefFoundError: org/openxmlformats/schemas/wordprocessingml/x2006/main/CTTextDirection
	at java.base/java.lang.Class.getDeclaredMethods0(Native Method)
	at java.base/java.lang.Class.privateGetDeclaredMethods(Class.java:3166)
	at java.base/java.lang.Class.getDeclaredMethods(Class.java:2309)
	at jdk.internal.vm.ci/jdk.vm.ci.hotspot.HotSpotResolvedObjectTypeImpl.getDeclaredMethods(HotSpotResolvedObjectTypeImpl.java:932)
	at com.oracle.svm.hosted.classinitialization.ClassInitializationFeature.declaresDefaultMethods(ClassInitializationFeature.java:375)

@geoand
Copy link
Contributor

geoand commented Mar 25, 2020

Looks like an issue with Tika, no?

@galderz
Copy link
Member Author

galderz commented Mar 26, 2020

Yeah, an issue in one of the jars. I'm looking into that this morning.

@galderz galderz changed the title NoClassDefFoundError org/springframework/http/HttpMethod with SVM built with jdk11u Multiple NoClassDefFoundError with SVM built with jdk11u Mar 26, 2020
@galderz
Copy link
Member Author

galderz commented Mar 26, 2020

Changed the description to encompass other possible situations, not just spring web.

@geoand
Copy link
Contributor

geoand commented Mar 26, 2020

Good idea!

@galderz
Copy link
Member Author

galderz commented Mar 26, 2020

The tika/poi issue is fixed with #8185.

galderz added a commit to galderz/quarkus that referenced this issue Mar 26, 2020
@galderz
Copy link
Member Author

galderz commented Mar 26, 2020

Main quarkus native testsuite passes now.

@geoand, you can go ahead and merge the spring-web api PR. Could you also release a new version and upgrade quarkus tree?

@geoand
Copy link
Contributor

geoand commented Mar 26, 2020

@galderz of course.

Thanks for checking.
I will let you know when a new release is available.

@galderz
Copy link
Member Author

galderz commented Mar 26, 2020

I've noticed yet another one, but this time in the quarkus-platform testsuite:

[quarkus-universe-integration-tests-camel-aws-999-SNAPSHOT-runner:26810]     analysis:   4,843.12 ms,  1.19 GB
Fatal error:org.graalvm.compiler.debug.GraalError: Unable to resolve all classes in class: org.apache.camel.spi.ModelJAXBContextFactory
	at com.oracle.svm.hosted.classinitialization.ClassInitializationFeature.declaresDefaultMethods(ClassInitializationFeature.java:386)
	...
Caused by: java.lang.NoClassDefFoundError: javax/xml/bind/JAXBContext
	at java.base/java.lang.Class.getDeclaredMethods0(Native Method)
	at java.base/java.lang.Class.privateGetDeclaredMethods(Class.java:3166)
	at java.base/java.lang.Class.getDeclaredMethods(Class.java:2309)
	at jdk.internal.vm.ci/jdk.vm.ci.hotspot.HotSpotResolvedObjectTypeImpl.getDeclaredMethods(HotSpotResolvedObjectTypeImpl.java:932)
	at com.oracle.svm.hosted.classinitialization.ClassInitializationFeature.declaresDefaultMethods(ClassInitializationFeature.java:378)

Longer output here.

@geoand
Copy link
Contributor

geoand commented Mar 26, 2020

@lburgazzoli ^

@lburgazzoli
Copy link
Contributor

@ppalaga @jamesnetherton ^

sberyozkin added a commit that referenced this issue Mar 26, 2020
Add missing ooxml-schemas dependency #8081
@galderz
Copy link
Member Author

galderz commented Mar 27, 2020

Re:camel, when running with labs JDK, I see this message:

16:36:14,396 WARN [com.ama.uti.Base64] JAXB is unavailable. Will fallback to SDK implementation which may be less performant.If you are using Java 9+, you will need to include javax.xml.bind:jaxb-api as a dependency.

@galderz
Copy link
Member Author

galderz commented Mar 30, 2020

A similar issue was appearing with Labs JDK, so I expect this latest failure with jdk11u-dev to go away. I'll test in the next few days.

@galderz
Copy link
Member Author

galderz commented Apr 6, 2020

@geoand Have you already updated the Spring dependency to avoid this issue? If not, any estimates when you expect to do this?

@geoand
Copy link
Contributor

geoand commented Apr 6, 2020

@galderz yes, the fix is in Quarkus master

@galderz
Copy link
Member Author

galderz commented Apr 6, 2020

Awesome @geoand, one less patch I need to keep track of :)

@galderz
Copy link
Member Author

galderz commented Apr 6, 2020

With the spring and ooxml-schemas issues integrated, I think I can close this for now. I still need to test Camel, but if that fails I'll open an issue on their project. Thx everyone for their help!

@galderz galderz closed this as completed Apr 6, 2020
@geoand
Copy link
Contributor

geoand commented Apr 6, 2020

Thanks for reporting and for your help @galderz!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/spring Issues relating to the Spring integration kind/bug Something isn't working triage/out-of-date This issue/PR is no longer valid or relevant
Projects
None yet
Development

No branches or pull requests

6 participants