Adding module causes classloading issues
Alex Buckley
alex.buckley at oracle.com
Tue Nov 28 01:40:48 UTC 2017
On 11/27/2017 5:22 PM, Michael Hall wrote:
>> On Nov 27, 2017, at 7:15 PM, Alex Buckley <alex.buckley at oracle.com
>> <mailto:alex.buckley at oracle.com>> wrote:
>>
>> --add-modules java.transaction
>
> Tried to simplify.
>
> java -cp . --patch-module java.transaction=jta.jar --add-modules
> java.transaction ModuleForClass javax.transaction.UserTransaction
> Error occurred during initialization of boot layer
> java.lang.LayerInstantiationException: Package javax.transaction.xa in
> both module java.transaction and module java.sql
Oh yes, jta.jar includes the XA package, so force-patching that package
into java.transaction will conflict with the same package in java.sql.
If your app doesn't use JDBC, then you could prevent java.sql from being
resolved by passing the JDK modules that you DO want to be resolved to
the --limit-modules option. Being precise about your app's use of JDK
modules is a down payment on writing its module declaration.
But most likely, you need the new, XA-less JTA jar which is coming soon
from the JSR 907 Maintenance Lead.
Alex
More information about the jigsaw-dev
mailing list