Adding module causes classloading issues
Alex Buckley
alex.buckley at oracle.com
Tue Nov 28 00:40:47 UTC 2017
On 11/27/2017 3:16 PM, Michael Hall wrote:
> JMX attach keeps telling me that RMI is not a accepted protocol.
> I wondered if possibly this was a modular issue, I checked my main app jar…
> jdeps halfpipe.jar
> ...
> halfpipe.jar -> java.corba
> …
>
> which seems to say I need java.corba which I didn’t have.
> If I add that with jlink I get…
>
> java.lang.NoClassDefFoundError: javax/transaction/UserTransaction
>
> from the quartz scheduler. This class should come from the included jta.jar, and usually does without the java.corba module.
java --list-modules
// Will show java.corba in your jlinked image
java --describe-module java.corba
// Will show 'requires java.transaction'
// Since this is an implementation dependency, it's not listed in
https://docs.oracle.com/javase/9/docs/api/java.corba-summary.html
java --show-module-resolution -jar halfpipe.jar
// Will show java.transaction being resolved in support of java.corba
Because java.transaction is resolved, the miniature javax.transaction
package that it exports will "win", and the full-strength
javax.transaction package in jta.jar on the classpath will "lose".
The story of java.transaction is unfortunate and complicated (see
http://openjdk.java.net/jeps/8189188) but you can augment it with the
stuff in jta.jar:
java --patch-module java.transaction=jta.jar -jar halfpipe.jar
// See http://openjdk.java.net/jeps/261#Patching-module-content
Alex
More information about the jigsaw-dev
mailing list