类javax.tranxaction.xa.XAResource存在于两个jar中

时间:2014-01-24 14:54:14

标签: java java-ee jboss classloader

我尝试使用非常特殊的XA配置运行JBoss7x以启用FCF。我配置了我的数据源和东西,现在想要启动应用程序。不幸的是,我得到以下例外:

Caused by: java.lang.LinkageError: loader constraint violation: loader (instance of <bootloader>) previously initiated loading for a different type with name "javax/transaction/xa/XAResource"
at java.lang.Class.getDeclaredMethods0(Native Method) [rt.jar:1.7.0_25]
at java.lang.Class.privateGetDeclaredMethods(Class.java:2521) [rt.jar:1.7.0_25]
at java.lang.Class.privateGetPublicMethods(Class.java:2641) [rt.jar:1.7.0_25]

JBoss有两个不同的位置来加载这个特殊的类或接口。 JEE6 jar和jdk7本人。首先为什么?其次,如何解决这个问题?

这是数据源的配置,但问题与数据源无关。这个班级在两个官方神谕中出现的主要问题

<xa-datasource jta="true" jndi-name="java:/RedSheepOraDS" pool-name="RedSheepOraDSRem" enabled="true" use-java-context="true" use-ccm="true">
                <xa-datasource-property name="URL">
                    jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS_LIST=(LOAD_BALANCE=ON) (ADDRESS=(PROTOCOL=TCP)(HOST=node1)(PORT=1521))(ADDRESS=(PROTOCOL=TCP) (HOST=node2)(PORT=1521)))(CONNECT_DATA=(SERVICE_NAME=REDSHEEP_RAC.WORLD)))
                </xa-datasource-property>
                <xa-datasource-property name="ONSConfiguration">
                    nodes=node1:6200,node2:6200
                </xa-datasource-property>
                <xa-datasource-property name="MinPoolSize">
                    200
                </xa-datasource-property>
                <xa-datasource-property name="MaxPoolSize">
                    200
                </xa-datasource-property>
                <xa-datasource-property name="InactiveConnectionTimeout">
                    5
                </xa-datasource-property>
                <xa-datasource-property name="TimeToLiveConnectionTimeout">
                    5
                </xa-datasource-property>
                <xa-datasource-property name="AbandonedConnectionTimeout">
                    5
                </xa-datasource-property>
                <xa-datasource-property name="ConnectionWaitTimeout">
                    5
                </xa-datasource-property>
                <xa-datasource-property name="PropertyCycle">
                    900
                </xa-datasource-property>
                <xa-datasource-property name="ValidateConnectionOnBorrow">
                    true
                </xa-datasource-property>
                <xa-datasource-property name="ConnectionPoolName">
                    xaPool
                </xa-datasource-property>
                <xa-datasource-property name="FastConnectionFailoverEnabled">
                    true
                </xa-datasource-property>
                <xa-datasource-property name="ConnectionFactoryClassName">
                    oracle.jdbc.xa.client.OracleXADataSource
                </xa-datasource-property>
                <xa-datasource-class>oracle.ucp.jdbc.PoolXADataSourceImpl</xa-datasource-class>
                <driver>ojdbc6.jar</driver>
                <security>
                    <user-name>****</user-name>
                    <password>****</password>
                </security>
                <validation>
                    <valid-connection-checker class-name="org.jboss.jca.adapters.jdbc.vendor.OracleValidConnectionChecker"/>
                    <check-valid-connection-sql>select 1 from dual</check-valid-connection-sql>
                    <stale-connection-checker class-name="org.jboss.jca.adapters.jdbc.vendor.OracleStaleConnectionChecker"/>
                    <exception-sorter class-name="org.jboss.jca.adapters.jdbc.extensions.oracle.OracleExceptionSorter"/>
                </validation>
                <timeout>
                    <blocking-timeout-millis>3000</blocking-timeout-millis>
                    <idle-timeout-minutes>1</idle-timeout-minutes>
                </timeout>
            </xa-datasource>
            <drivers>
                <driver name="ojdbc6.jar" module="com.oracle.db">
                    <xa-datasource-class>oracle.ucp.jdbc.PoolXADataSourceImpl</xa-datasource-class>
                </driver>
                <driver name="h2" module="com.h2database.h2">
                    <xa-datasource-class>org.h2.jdbcx.JdbcDataSource</xa-datasource-class>
                </driver>
            </drivers>

谢谢,

麦克

1 个答案:

答案 0 :(得分:0)

JBoss 7x似乎不支持将UCP连接器作为托管连接池。如果你想使用UCP,你必须自己管理池和jndi。

否则,请使用oracle.jdbc.xa.client.OracleXADataSource作为驱动程序类。