Adding module causes classloading issues

Michael Hall mik3hall at gmail.com
Tue Nov 28 01:22:26 UTC 2017


> On Nov 27, 2017, at 7:15 PM, Alex Buckley <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

import javax.transaction.UserTransaction;

public class ModuleForClass {

	public static void main(String[] args) {
		try {
			Module m = Class.forName("javax.transaction.UserTransaction").getModule();
			System.out.println(m.getName());
		}
		catch (Throwable tossed) { tossed.printStackTrace(); }
	}
}


More information about the jigsaw-dev mailing list