Hi,
I have written an embedded EJB application which extracts data from a series of CSV files and writes them to a MySQL 4.0.27 database. When it has been running for some time, I get the following error and exception (The stack trace is quite long so I have only included what I think is important):
Code:
WARN 19-09 17:35:46,385 (Log4JLogger.java:warn:104) -SQL Error: 0, SQLState: null
ERROR 19-09 17:35:46,385 (Log4JLogger.java:error:114) -Transaction is not active: tx=TransactionImpl:XidImpl[FormatId=257, GlobalId=null:1158683427861/16, BranchQual=null:1158683427861, localId=0:16]; - nested throwable: (javax.resource.ResourceException: Transaction is not active: tx=TransactionImpl:XidImpl[FormatId=257, GlobalId=null:1158683427861/16, BranchQual=null:1158683427861, localId=0:16])
ERROR 19-09 17:35:46,401 (Log4JLogger.java:error:119) -get failed
javax.persistence.PersistenceException: org.hibernate.exception.GenericJDBCException: Cannot open connection
at org.hibernate.ejb.AbstractEntityManagerImpl.throwPersistenceException(AbstractEntityManagerImpl.java:567)
at org.hibernate.ejb.QueryImpl.getResultList(QueryImpl.java:56)
at com.triggersoft.model.dao.AccountTxHome.findEarlierByAccount(AccountTxHome.java:166)
From what I could find out from Googling it seems as though this is caused by a transaction timeout. Adding code to get the time when the data import begins and when the exception occurs suggests backs this up as the error always occurs after 5 minutes - this seems like a reasonable default timeout period. I have been unable to find out how I can change the timeout value however.
Thanks
Simon