example of printing classloader and jar that loaded classes

System.out.println(getFromJNDI("UserTransaction").getClass().getClassLoader())
System.out.println(TransactionManager.class.getClassLoader())
System.out.println(TransactionManager.class.getProtectionDomain().getCodeSource().getLocation().toURI())
System.out.println(getFromJNDI("UserTransaction").getClass().getProtectionDomain().getCodeSource().getLocation().toURI())

Comments