我遇到了mariaDB jar的问题
12:42:54,194 ERROR [org.jboss.jca.core.tx.jbossts.XAResourceRecoveryImpl] (Periodic Recovery) IJ000906: Error during crash recovery: java:jboss/datasources/myDS (Could not create connection): javax.resource.ResourceException: Could not create connection
at org.jboss.jca.adapters.jdbc.xa.XAManagedConnectionFactory.getXAManagedConnection(XAManagedConnectionFactory.java:525)
at org.jboss.jca.adapters.jdbc.xa.XAManagedConnectionFactory$1.run(XAManagedConnectionFactory.java:416)
at org.jboss.jca.adapters.jdbc.xa.XAManagedConnectionFactory$1.run(XAManagedConnectionFactory.java:413)
at java.security.AccessController.doPrivileged(Native Method) [rt.jar:1.8.0_45]
at javax.security.auth.Subject.doAs(Subject.java:422) [rt.jar:1.8.0_45]
at org.jboss.jca.adapters.jdbc.xa.XAManagedConnectionFactory.createManagedConnection(XAManagedConnectionFactory.java:412)
at org.jboss.jca.core.tx.jbossts.XAResourceRecoveryImpl.open(XAResourceRecoveryImpl.java:343)
at org.jboss.jca.core.tx.jbossts.XAResourceRecoveryImpl.getXAResources(XAResourceRecoveryImpl.java:170)
at com.arjuna.ats.internal.jbossatx.jta.XAResourceRecoveryHelperWrapper.getXAResources(XAResourceRecoveryHelperWrapper.java:51) [jbossjts-integration-4.17.29.Final-redhat-1.jar:4.17.29.Final-redhat-1 (revision: ede35097ddd6c0f539ba06e78df7794c0e06d68d)]
at com.arjuna.ats.internal.jta.recovery.arjunacore.XARecoveryModule.resourceInitiatedRecoveryForRecoveryHelpers(XARecoveryModule.java:510) [jbossjts-jacorb-4.17.29.Final-redhat-1.jar:4.17.29.Final-redhat-1]
at com.arjuna.ats.internal.jta.recovery.arjunacore.XARecoveryModule.periodicWorkFirstPass(XARecoveryModule.java:176) [jbossjts-jacorb-4.17.29.Final-redhat-1.jar:4.17.29.Final-redhat-1]
at com.arjuna.ats.internal.arjuna.recovery.PeriodicRecovery.doWorkInternal(PeriodicRecovery.java:747) [jbossjts-jacorb-4.17.29.Final-redhat-1.jar:4.17.29.Final-redhat-1]
at com.arjuna.ats.internal.arjuna.recovery.PeriodicRecovery.run(PeriodicRecovery.java:375) [jbossjts-jacorb-4.17.29.Final-redhat-1.jar:4.17.29.Final-redhat-1]
Caused by: java.lang.ClassCastException: org.mariadb.jdbc.Driver cannot be cast to javax.sql.XADataSource
at org.jboss.jca.adapters.jdbc.xa.XAManagedConnectionFactory.getXADataSource(XAManagedConnectionFactory.java:647)
at org.jboss.jca.adapters.jdbc.xa.XAManagedConnectionFactory.getXAManagedConnection(XAManagedConnectionFactory.java:508)
... 12 more
我从mariadb网站下载了mariadb-java-client-1.1.9并创建了以下module.xml文件,该文件位于jboss_home \ modules \ org \ mariadb \ main
<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.0" name="org.mariadb">
<resources>
<resource-root path="mariadb-java-client-1.1.9.jar"/>
</resources>
<dependencies>
<module name="javax.api"/>
<module name="javax.transaction.api"/>
</dependencies>
</module>
这是我的standalone.xml
<datasources>
<datasource jndi-name="java:jboss/datasources/rDS" pool-name="rDS" enabled="true">
<connection-url>jdbc:mariadb://localhost:3306/soccer</connection-url>
<driver>mariadb</driver>
<pool>
<min-pool-size>1</min-pool-size>
<max-pool-size>100</max-pool-size>
</pool>
<security>
<user-name>user_name</user-name>
<password>my_password</password>
</security>
<statement>
<prepared-statement-cache-size>100</prepared-statement-cache-size>
<share-prepared-statements>false</share-prepared-statements>
</statement>
</datasource>
<xa-datasource jndi-name="java:jboss/datasources/myDS" pool-name="myDS" enabled="true">
<xa-datasource-property name="ServerName">
localhost
</xa-datasource-property>
<xa-datasource-property name="PortNumber">
3306
</xa-datasource-property>
<xa-datasource-property name="DatabaseName">
soccer
</xa-datasource-property>
<driver>mariadb</driver>
<xa-pool>
<min-pool-size>1</min-pool-size>
<max-pool-size>100</max-pool-size>
</xa-pool>
<security>
<user-name>user_name</user-name>
<password>my_password</password>
</security>
<statement>
<prepared-statement-cache-size>100</prepared-statement-cache-size>
<share-prepared-statements>false</share-prepared-statements>
</statement>
</xa-datasource>
<drivers>
<driver name="mariadb" module="org.mariadb">
<xa-datasource-class>org.mariadb.jdbc.Driver</xa-datasource-class>
</driver>
</drivers>
</datasources>
由于
答案 0 :(得分:5)
org.mariadb.jdbc.Driver未实现javax.sql.XADataSource。 请将您的DS更改为org.mariadb.jdbc.MySQLDataSource,它会起作用。