Hi there,
I am having a strange problem with JBoss+Hibernate+MySQL.
I am getting a ABORT_ONLY transaction status caused by Hibernate when trying to connect to MySQL.
It only happens on 1 every 10 Struts requests, not always. I'l tried it with JBoss 4.2.1 & 4.2.2, MySQL 4, 5.0 & 5.1 and JDK 5 and 6.
The first exception:
Code:
aused by: javax.persistence.PersistenceException: org.hibernate.exception.GenericJDBCException: Can
not open connection
at org.hibernate.ejb.AbstractEntityManagerImpl.throwPersistenceException(AbstractEntityManagerImpl.
java:629)
at org.hibernate.ejb.QueryImpl.getResultList(QueryImpl.java:73)
at com.servengine.news.NewsManagerBean.getArticles(NewsManagerBean.java:32)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:112)
at org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:166)
at org.jboss.ejb3.interceptor.EJB3InterceptorsInterceptor.invoke(EJB3InterceptorsInterceptor.java:6
3)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor.invoke(TransactionScopedEntityMa
nagerInterceptor.java:54)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.ejb3.AllowedOperationsInterceptor.invoke(AllowedOperationsInterceptor.java:47)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.aspects.tx.TxPolicy.invokeInCallerTx(TxPolicy.java:126)
... 77 more
Caused by: org.hibernate.exception.GenericJDBCException: Cannot open connection
at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:103
)
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:91)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:29)
at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:426)
at org.hibernate.jdbc.ConnectionManager.getConnection(ConnectionManager.java:144)
at org.hibernate.jdbc.AbstractBatcher.prepareQueryStatement(AbstractBatcher.java:139)
at org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1547)
at org.hibernate.loader.Loader.doQuery(Loader.java:673)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:236)
at org.hibernate.loader.Loader.doList(Loader.java:2220)
at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2104)
at org.hibernate.loader.Loader.list(Loader.java:2099)
at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:378)
at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:338)
at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:172)
at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1121)
at org.hibernate.impl.QueryImpl.list(QueryImpl.java:79)
at org.hibernate.ejb.QueryImpl.getResultList(QueryImpl.java:64)
... 91 more
Caused by: org.jboss.util.NestedSQLException: Transaction is not active: tx=TransactionImple < ac, BasicAction: -3c244179:e8b0:47438336:2ca7 status: ActionStatus.ABORT_ONLY >; - nested throwable: (javax.resource.ResourceException: Transaction is not active: tx=TransactionIm
ple < ac, BasicAction: -3c244179:e8b0:47438336:2ca7 status: ActionStatus.ABORT_ONLY >)
at org.jboss.resource.adapter.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:94)
at org.hibernate.ejb.connection.InjectedDataSourceConnectionProvider.getConnection(InjectedDataSour
ceConnectionProvider.java:47)
at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:423)
... 105 more
Caused by: javax.resource.ResourceException: Transaction is not active: tx=TransactionImple < ac, BasicAction: -3c244179:e8b0:47438336:2ca7 status: ActionStatus.ABORT_ONLY >
at org.jboss.resource.connectionmanager.TxConnectionManager.getManagedConnection(TxConnectionManage
r.java:304)
at org.jboss.resource.connectionmanager.BaseConnectionManager2.allocateConnection(BaseConnectionMan
ager2.java:396)
at org.jboss.resource.connectionmanager.BaseConnectionManager2$ConnectionManagerProxy.allocateConne
ction(BaseConnectionManager2.java:842)
at org.jboss.resource.adapter.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:88)
... 107 more
Caused by:
Code:
2007-11-27 12:51:11,831 ERROR [org.hibernate.util.JDBCExceptionReporter] Transaction is not active:
tx=TransactionImple < ac, BasicAction: -3c244179:b941:474afb45:611e status: ActionStatus.ABORT_ONLY >; - nested throwable: (javax.resource.ResourceException: Transaction is not active: tx=TransactionIm
ple < ac, BasicAction: -3c244179:b941:474afb45:611e status: ActionStatus.ABORT_ONLY >)
2007-11-27 12:51:11,831 DEBUG [com.arjuna.ats.jta.logging.logger] BaseTransaction.setRollbackOnly
2007-11-27 12:51:11,831 DEBUG [com.arjuna.ats.jta.logging.logger] TransactionImple.setRollbackOnly
2007-11-27 12:51:11,831 DEBUG [com.arjuna.ats.jta.logging.logger] TransactionImple.setRollbackOnly
2007-11-27 12:51:11,832 ERROR [com.servengine.filepublisher.Actions] org.hibernate.exception.Generic
JDBCException: Cannot open connection
javax.ejb.EJBTransactionRolledbackException: org.hibernate.exception.GenericJDBCException: Cannot op
en connection
at org.jboss.ejb3.tx.Ejb3TxPolicy.handleInCallerTx(Ejb3TxPolicy.java:87)
at org.jboss.aspects.tx.TxPolicy.invokeInCallerTx(TxPolicy.java:130)
at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:195)
The origin of this is:
Code:
Caused by: javax.persistence.PersistenceException: org.hibernate.exception.GenericJDBCException: Can
not open connection
at org.hibernate.ejb.AbstractEntityManagerImpl.throwPersistenceException(AbstractEntityManagerImpl.
java:629)
at org.hibernate.ejb.QueryImpl.getResultList(QueryImpl.java:73)
at com.servengine.filepublisher.FilePublisherManagerBean.getRootCategories(FilePublisherManagerBean
.java:515)
at sun.reflect.GeneratedMethodAccessor428.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
I've already asked in JBoss forums and put there the full stack trace and logs:
http://www.jboss.com/index.html?module=bb&op=viewtopic&t=124299I got the Idea from JBoss team that it might be a MySQL problem with transactions, but I've seen in this forum a similar problem of another user with Postgres.
Thanks for any ideas/directions on how to solve this.
Code: