這兩天在作seam的時候不時遇到“org.jboss.util.NestedSQLException: Transaction is not active”的錯誤信息,后來到jboss的wiki上發現了問題的原因和解決方法:
How do I set the Transaction Timeout?
Transaction timeout (unit is always seconds) can be configured in various ways:
This argument is the same no matter if you are using JBossTM(<=4.0.5) or JBossJTA-Arjuna(>=4.2).
Version <= 4.0.5
This part is the same for either JBossTM or JBossJTA and is the same for ejb2 and ejb3
-
Per-method basis: Modifying the <transaction-timeout>
element inside the <method> element of a session or entity bean.
This is located in the META-INF/jboss.xml deployment descriptor of a
session bean. When the transaction timeout is specified at the method
level, it overrides the default timeout. Further information about this
element can be found in jboss-x.x.x/docs/dtd/jboss_4_0.dtd. Example
taken from the testsuite:
@TransactionTimeout(1500)