Bug 1309174
| Summary: | [GSS] (6.4.z) LinkageError due to javax.transaction.xa being in javax.transaction module and system loader | ||||||
|---|---|---|---|---|---|---|---|
| Product: | [JBoss] JBoss Enterprise Application Platform 6 | Reporter: | James Livingston <jlivings> | ||||
| Component: | Class Loading | Assignee: | Dmitrii Tikhomirov <dtikhomi> | ||||
| Status: | CLOSED CURRENTRELEASE | QA Contact: | Peter Mackay <pmackay> | ||||
| Severity: | unspecified | Docs Contact: | |||||
| Priority: | unspecified | ||||||
| Version: | 6.4.6 | CC: | bbaranow, bmaxwell, david.lloyd, dereed, dtikhomi, joallen, jtruhlar, pmackay | ||||
| Target Milestone: | CR1 | ||||||
| Target Release: | EAP 6.4.8 | ||||||
| Hardware: | Unspecified | ||||||
| OS: | Unspecified | ||||||
| Whiteboard: | |||||||
| Fixed In Version: | Doc Type: | Bug Fix | |||||
| Doc Text: | Story Points: | --- | |||||
| Clone Of: | Environment: | ||||||
| Last Closed: | 2017-01-17 12:38:03 UTC | Type: | Bug | ||||
| Regression: | --- | Mount Type: | --- | ||||
| Documentation: | --- | CRM: | |||||
| Verified Versions: | Category: | --- | |||||
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |||||
| Cloudforms Team: | --- | Target Upstream Version: | |||||
| Embargoed: | |||||||
| Bug Depends On: | |||||||
| Bug Blocks: | 1279553, 1310484 | ||||||
| Attachments: |
|
||||||
|
Description
James Livingston
2016-02-17 04:48:57 UTC
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. |