You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Problem with Jackson reflection and (I think) Javax.activation #2318
I've used dropwizard-core 1.3.0 targeting jdk 9. Don't know if it's something related to jdk 9.
I've run the simple program of the Getting Started guide on the website.
Here's the problem with Jackson reflection:
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.fasterxml.jackson.module.afterburner.util.MyClassLoader (file:/Users/fabio/IdeaProjects/smartcity/build/libs/hello-1.0-SNAPSHOT.jar) to method java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int)
WARNING: Please consider reporting this to the maintainers of com.fasterxml.jackson.module.afterburner.util.MyClassLoader
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
And here's the one with javax (I think), which disappear if I use the VM parameter "--add-modules java.activation" (Why?)
WARN [2018-03-30 01:39:45,151] org.glassfish.jersey.internal.Errors: The following warnings have been detected: WARNING: HK2 service reification failed for [org.glassfish.jersey.message.internal.DataSourceProvider] with an exception:
MultiException stack 1 of 2
java.lang.NoClassDefFoundError: javax/activation/DataSource
at java.base/java.lang.Class.getDeclaredConstructors0(Native Method)
at java.base/java.lang.Class.privateGetDeclaredConstructors(Class.java:3110)
at java.base/java.lang.Class.getDeclaredConstructors(Class.java:2314)
at org.jvnet.hk2.internal.Utilities$3.run(Utilities.java:1308)
at org.jvnet.hk2.internal.Utilities$3.run(Utilities.java:1304)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at org.jvnet.hk2.internal.Utilities.getAllConstructors(Utilities.java:1304)
at org.jvnet.hk2.internal.Utilities.findProducerConstructor(Utilities.java:1247)
at org.jvnet.hk2.internal.DefaultClassAnalyzer.getConstructor(DefaultClassAnalyzer.java:83)
...
Reacted by Ronald, joalder, KITAMI Taiyoh and Guillaume Simard
changed the title [-]Possible jdk 9 problem with Jackson reflection running the getting started code.[/-][+]Problem with Jackson reflection and (I think) Javax.activation[/+]on Mar 30, 2018
I'm seeing the same issue with Jackson as well. I think its the same issue reported in the Jackson repo.
I was also wondering, now that Dropwizard 1.3.0 supports JDK 9, I imagine more people will try to migrate their Dropwizard apps from 1.8 to 1.9 (or to 1.10). Is there a guide for this? Right now in order to run it I need to use --add-modules java.xml.bind both when compiling and when running the jar. I'm wondering if there's a cleaner way.
FWIW, I was able to work around this by explicitly adding javax.xml.bind:jaxb-api as a dependency — would it make sense for this to be added as dependency for Jackson itself?
@jmrodriguez Thank you very much! The only modifications I needed to make were the dependency based ones.
My source and target were set to 1.6. and the dependency setting fixed me right up. I suppose it doesn't hurt to set it to 1.9 :)
Does anyone have any idea why explicit references to those JAXB & JAVAX dependencies are needed for running the application if the application compiles fine without them?
Does anyone have any idea why explicit references to those JAXB & JAVAX dependencies are needed for running the application if the application compiles fine without them?
Activity
[-]Possible jdk 9 problem with Jackson reflection running the getting started code.[/-][+]Problem with Jackson reflection and (I think) Javax.activation[/+]nickbabcock commentedon Mar 30, 2018
Is this the same issue reported in the Jackson repo? FasterXML/jackson-modules-base#37
RohanNagar commentedon Mar 30, 2018
I'm seeing the same issue with Jackson as well. I think its the same issue reported in the Jackson repo.
I was also wondering, now that Dropwizard 1.3.0 supports JDK 9, I imagine more people will try to migrate their Dropwizard apps from 1.8 to 1.9 (or to 1.10). Is there a guide for this? Right now in order to run it I need to use
--add-modules java.xml.bindboth when compiling and when running the jar. I'm wondering if there's a cleaner way.arteam commentedon Mar 30, 2018
Yes, we run our tests on JDK10 with
--add-modules java.xml.bind: https://github.com/dropwizard/dropwizard/blob/master/pom.xml#L381Unfortunately Jersey requires it for JAXB support if I'm not mistaken. We can't do much until a modularized version of Jersey come out.
corcorb commentedon Apr 10, 2018
FWIW, I was able to work around this by explicitly adding
javax.xml.bind:jaxb-apias a dependency — would it make sense for this to be added as dependency for Jackson itself?jmrodriguez commentedon Apr 16, 2018
I fixed the java.lang.NoClassDefFoundError: javax/activation/DataSource error by adding the next dependency in the POM
and fixed the JAXB issues by adding these other dependencies
I also had to add these two properties to in the pom
The application now runs, however the Jackson reflection warning still shows up
Fix for Jersey-JAXB issue
Java 10 support and testing (#1837)
#1240: Switch to JDK11
#1240: Switch to JDK11
#1240: Switch to JDK11
mattc41190 commentedon Apr 12, 2019
@jmrodriguez Thank you very much! The only modifications I needed to make were the dependency based ones.
My source and target were set to 1.6. and the dependency setting fixed me right up. I suppose it doesn't hurt to set it to 1.9 :)
Does anyone have any idea why explicit references to those JAXB & JAVAX dependencies are needed for running the application if the application compiles fine without them?
joschi commentedon Apr 13, 2019
JAXB was part of Java until Java 8 and was removed (or rather un-bundled) in Java 9.
See also: https://jesperdj.com/2018/09/30/jaxb-on-java-9-10-11-and-beyond/
joschi commentedon Apr 22, 2019
This should work out of the box with Dropwizard 2.0.0-rc1 and later.
If you have problems with Dropwizard 2.0.0-rc1 (or later) and Java 11, please leave a comment.
Java 10 support and testing (#1837)
Java 10 support and testing (#1837)
Java 10 support and testing (#1837)