https://issues.jboss.org/browse/WFLY-6117 and linked issues report a problem caused by javax.transaction.xa.* classes being exported by the javax.transaction module which are different from the ones in system loader that javax.sql sees. After trying a javax.sql module for a while, upstream switched to simply making javax.transaction re-export the system loader's classes, by adding this to the module.xml: <exports> <exclude path="javax/transaction/xa"/> </exports> <dependencies> <system export="true"> <paths> <path name="javax/transaction/xa"/> </paths> </system> </dependencies> Although the technical change is quite small, the impact may not be, and we will need to do some decent testing to make sure such a change does not break any rarely used code.
Dennis noted you can force the problem to occur: -- I've been able to reproduce the error locally with a simple example class. package example; import javax.sql.XAConnection; import javax.transaction.xa.XAResource; import java.sql.Connection; import javax.sql.ConnectionEventListener; import javax.sql.StatementEventListener; public class Test implements XAConnection { public XAResource getXAResource() { return null; } public void addConnectionEventListener( ConnectionEventListener listener ) {} public void addStatementEventListener ( StatementEventListener listener ) {} public void close () {} public Connection getConnection () { return null; } public void removeConnectionEventListener ( ConnectionEventListener listener ){} public void removeStatementEventListener ( StatementEventListener listener ) {} } Packaged in a module, with the recommended dependencies for the Oracle driver: <module name="javax.api"/> <module name="javax.transaction.api"/> If the following three lines are run, in any order, an error occurs in the 3rd one: Class.forName ( "javax.transaction.xa.XAResource", true, example.Test.class.getClassLoader() ); Class.forName ( "javax.transaction.xa.XAResource", true, javax.sql.XAConnection.class.getClassLoader() ); new example.Test(); If example.Test is last, the error is: ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/test].[jsp]] (http-/127.0.0.1:8080-1) JBWEB000236: Servlet.service() for servlet jsp threw exception: java.lang.LinkageError: loader constraint violation in interface itable initialization: when resolving method "example.Test.getXAResource()Ljavax/transaction/xa/XAResource;" the class loader (instance of org/jboss/modules/ModuleClassLoader) of the current class, example/Test, and the class loader (instance of <bootloader>) for interface javax/sql/XAConnection have different Class objects for the type tion/xa/XAResource; used in the signature If one of the Class.forNames is last, the error is (with a different classloader for each): ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/test].[jsp]] (http-/127.0.0.1:8080-1) JBWEB000236: Servlet.service() for servlet jsp threw exception: java.lang.LinkageError: loader constraint violation: loader (instance of org/jboss/modules/ModuleClassLoader) previously initiated loading for a different type with name "javax/transaction/xa/XAResource" -- A customer experienced this through what appears to be regular usage of a connection, there is likely to be some kind of race where it works unless a variety of classes are loaded in exactly the right order.
Created attachment 1142722 [details] bz1309174-test.zip Attached test case. See included README for details on running it.
Verified with EAP 6.4.8.CP.CR2
Jiri Pallich <jpallich> updated the status of jira JBEAP-3340 to Closed
Retroactively bulk-closing issues from released EAP 6.4 cumulative patches.