<tx:jta-transaction-manager/>
我收集这意味着Spring会自动发现基础的JTA实现.所以当我们启动JBoss时,我们看到这些消息,而Spring搜索:
[JtaTransactionManager] [ ] No JTA TransactionManager found at fallback JNDI location [java:comp/Tran sactionManager] javax.naming.NameNotFoundException: TransactionManager not bound <<Big stack trace>> <<More of the same>>
然后最终看到:
[JtaTransactionManager] [ ] JTA TransactionManager found at fallback JNDI location [java:/Transaction Manager] [JtaTransactionManager] [ ] Using JTA UserTransaction: org.jboss.tm.usertx.client.ServerVMClientUserT ransaction@1f78dde
问题是 – 我们如何编辑我们的< tx:jta-transaction-manager />标签显式配置java:/ Transaction Manager JTA实现,所以我们避免了日志中的所有堆栈跟踪? (我不想只是更改Log4J日志记录级别)
更新:我替换了< tx:jta-transaction-manager />与下面的配置,它似乎工作..我猜这是没事的?
<bean id="transactionManager" class="org.springframework.transaction.jta.JtaTransactionManager"> <property name="transactionManagerName" value="java:/TransactionManager"/> </bean>
解决方法
java:/ TransactionManager是JBoss在默认情况下绑定的地方;其他servlet容器将默认为java:/ comp / TransactionManager,我认为这应该是TM的“标准”位置.
从Spring reference documentation:
For standard scenarios,including
WebLogic,WebSphere and OC4J,consider
using the convenient
<tx:jta-transaction-manager/>
configuration element. This will
automatically detect the underlying
server and choose the best transaction
manager available for the platform.
This means that you won’t have to
configure server-specific adapter
classes (as discussed in the following
sections) explicitly; they will rather
be chosen automatically,with the
standardJtaTransactionManager
as default fallback.