将EE应用程序部署到JBoss-5.1.0.GA
时,我收到以下异常:
2013-08-12 12:00:40,363 WARN [com.arjuna.ats.internal.jta.recovery.xarecovery1] Local XARecoveryModule.xaRecovery got XA exception javax.transaction.xa.XAException: Error trying to connect to provider java:/DefaultJMSProvider, XAException.XAER_RMERR com.arjuna.ats.jta.logging.loggerI18N Thread-12
2013-08-12 12:00:40,363 ERROR ********************************Failed to connect to server "javax.naming.NameNotFoundException: DefaultJMSProvider not bound
at org.jnp.server.NamingServer.getBinding(NamingServer.java:771)
at org.jnp.server.NamingServer.getBinding(NamingServer.java:779)
at org.jnp.server.NamingServer.getObject(NamingServer.java:785)
at org.jnp.server.NamingServer.lookup(NamingServer.java:443)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:726)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:686)
at javax.naming.InitialContext.lookup(InitialContext.java:392)
at org.jboss.jms.server.recovery.MessagingXAResourceWrapper.getConnectionFactory(MessagingXAResourceWrapper.java:343)
at org.jboss.jms.server.recovery.MessagingXAResourceWrapper.connect(MessagingXAResourceWrapper.java:300)
at org.jboss.jms.server.recovery.MessagingXAResourceWrapper.getDelegate(MessagingXAResourceWrapper.java:259)
at org.jboss.jms.server.recovery.MessagingXAResourceWrapper.recover(MessagingXAResourceWrapper.java:107)
at com.arjuna.ats.internal.jta.recovery.arjunacore.XARecoveryModule.xaRecovery(XARecoveryModule.java:795)
at com.arjuna.ats.internal.jta.recovery.arjunacore.XARecoveryModule.resourceInitiatedRecovery(XARecoveryModule.java:665)
at com.arjuna.ats.internal.jta.recovery.arjunacore.XARecoveryModule.getNewXAResource(XARecoveryModule.java:244)
at com.arjuna.ats.internal.jta.resources.arjunacore.XAResourceRecord.getNewXAResource(XAResourceRecord.java:1257)
at com.arjuna.ats.internal.jta.resources.arjunacore.XAResourceRecord.restore_state(XAResourceRecord.java:1092)
at com.arjuna.ats.arjuna.coordinator.RecoveryAbstractRecord.restore_state(RecoveryAbstractRecord.java:214)
at com.arjuna.ats.arjuna.coordinator.BasicAction.restore_state(BasicAction.java:1482)
at com.arjuna.ats.arjuna.coordinator.BasicAction.activate(BasicAction.java:717)
at com.arjuna.ats.arjuna.coordinator.BasicAction.activate(BasicAction.java:679)
at com.arjuna.ats.arjuna.recovery.RecoverAtomicAction.<init>(RecoverAtomicAction.java:60)
at com.arjuna.ats.internal.arjuna.recovery.AtomicActionRecoveryModule.doRecoverTransaction(AtomicActionRecoveryModule.java:178)
at com.arjuna.ats.internal.arjuna.recovery.AtomicActionRecoveryModule.processTransactionsStatus(AtomicActionRecoveryModule.java:294)
at com.arjuna.ats.internal.arjuna.recovery.AtomicActionRecoveryModule.periodicWorkSecondPass(AtomicActionRecoveryModule.java:128)
at com.arjuna.ats.internal.arjuna.recovery.PeriodicRecovery.doWorkInternal(PeriodicRecovery.java:799)
at com.arjuna.ats.internal.arjuna.recovery.PeriodicRecovery.run(PeriodicRecovery.java:412)" org.jboss.jms.server.recovery.MessagingXAResourceWrapper Thread-12
在我看来,这指出了我的默认数据源中的问题,目前看起来像这样:
<?xml version="1.0" encoding="UTF-8"?>
<datasources>
<xa-datasource>
<jndi-name>DefaultDS</jndi-name>
<use-java-context>true</use-java-context>
<user-name>my-user</user-name>
<password>passwd</password>
<transaction-isolation>TRANSACTION_READ_COMMITTED</transaction-isolation>
<xa-datasource-class>com.mysql.jdbc.jdbc2.optional.MysqlXADataSource</xa-datasource-class>
<xa-datasource-property name="URL">jdbc:mysql://localhost:3306/MyDb?allowMultiQueries=true</xa-datasource-property>
<xa-datasource-property name="DefaultFetchSize">1000</xa-datasource-property>
<xa-resource-timeout>3600</xa-resource-timeout>
<exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.MySQLExceptionSorter</exception-sorter-class-name>
<!-- Timeouts -->
<set-tx-query-timeout>false</set-tx-query-timeout>
<!-- Caches -->
<prepared-statement-cache-size>0</prepared-statement-cache-size>
<share-prepared-statements>0</share-prepared-statements>
<!-- pooling parameters -->
<use-strict-min>true</use-strict-min>
<min-pool-size>5</min-pool-size>
<max-pool-size>30</max-pool-size>
<blocking-timeout-millis>60000</blocking-timeout-millis>
<idle-timeout-minutes>5</idle-timeout-minutes>
<prefill>true</prefill>
<!-- use commit to avoid MySQL XA-Exception -->
<new-connection-sql>SELECT 1;commit</new-connection-sql>
<check-valid-connection-sql>SELECT 1;commit</check-valid-connection-sql>
<track-statements>yes</track-statements>
<no-tx-separate-pools/>
<track-connection-by-tx>true</track-connection-by-tx>
<!-- corresponding type-mapping in the standardjbosscmp-jdbc.xml (optional) -->
<metadata>
<type-mapping>mySQL</type-mapping>
</metadata>
</xa-datasource>
</datasources>
最奇怪的是,DefaultDS似乎在arjuna之外工作。
有人知道解决这个问题吗?
答案 0 :(得分:0)
看起来有些奇怪的原因MySQL / arjuna需要一些额外的配置
[...]
<user-name>my-user</user-name>
<password>passwd</password>
[...]
似乎和以下一样重要:
[...]
<xa-datasource-property name="User">my-user</xa-datasource-property>
<xa-datasource-property name="Password">passwd</xa-datasource-property>
[...]
现在工作正常。 :)