Seam Transaction illegal state
zeeman Jan 31, 2012 2:01 AMHi all,
I'm using AS7 7.1.CR1b, Seam 3.1 Final. Postgres and latest JDBC driver.
I use seam faces and I have the transaction interceptor enabled. While I debug the app in Eclipse, I get the below exception. It seems like the transaction times out, but it also kills AS7 (gets hung) and the app stops working. Is this a bug in seam transaction? Or do I need to handle this exception? In either case what do you recommend to deal with this? I also Have infinispan span enabled as Hibernate 2nd level cache.
Error:
javax.enterprise.event.ObserverException sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) java.lang.reflect.Constructor.newInstance(Constructor.java:513) java.lang.Class.newInstance0(Class.java:355) java.lang.Class.newInstance(Class.java:308) org.jboss.weld.util.reflection.SecureReflections$16.work(SecureReflections.java:343) org.jboss.weld.util.reflection.SecureReflectionAccess.run(SecureReflectionAccess.java:52) org.jboss.weld.util.reflection.SecureReflectionAccess.runAsInstantiation(SecureReflectionAccess.java:173) org.jboss.weld.util.reflection.SecureReflections.newInstance(SecureReflections.java:340) org.jboss.weld.injection.Exceptions.rethrowException(Exceptions.java:33) org.jboss.weld.injection.Exceptions.rethrowException(Exceptions.java:73) org.jboss.weld.injection.MethodInjectionPoint.invokeOnInstanceWithSpecialValue(MethodInjectionPoint.java:162) org.jboss.weld.event.ObserverMethodImpl.sendEvent(ObserverMethodImpl.java:241) org.jboss.weld.event.ObserverMethodImpl.sendEvent(ObserverMethodImpl.java:229) org.jboss.weld.event.ObserverMethodImpl.notify(ObserverMethodImpl.java:207) org.jboss.weld.manager.BeanManagerImpl.notifyObservers(BeanManagerImpl.java:569) org.jboss.weld.manager.BeanManagerImpl.fireEvent(BeanManagerImpl.java:564) org.jboss.weld.event.EventImpl.fire(EventImpl.java:68) org.jboss.seam.transaction.TransactionServletListener.requestInitialized(TransactionServletListener.java:117) org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:362) org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:897) org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:626) org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:2033) java.lang.Thread.run(Thread.java:662) root cause javax.transaction.NotSupportedException: BaseTransaction.checkTransactionState - ARJUNA016051: thread is already associated with a transaction! com.arjuna.ats.internal.jta.transaction.arjunacore.BaseTransaction.begin(BaseTransaction.java:65) org.jboss.seam.transaction.UTTransaction.begin(UTTransaction.java:51) org.jboss.seam.transaction.DefaultSeamTransaction.begin(DefaultSeamTransaction.java:88) org.jboss.seam.transaction.TransactionServletListener.requestInitialized(TransactionServletListener.java:110) org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:362) org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:897) org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:626) org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:2033) java.lang.Thread.run(Thread.java:662) root cause java.lang.IllegalStateException: BaseTransaction.checkTransactionState - ARJUNA016051: thread is already associated with a transaction! com.arjuna.ats.internal.jta.transaction.arjunacore.BaseTransaction.checkTransactionState(BaseTransaction.java:259) com.arjuna.ats.internal.jta.transaction.arjunacore.BaseTransaction.begin(BaseTransaction.java:61) org.jboss.seam.transaction.UTTransaction.begin(UTTransaction.java:51) org.jboss.seam.transaction.DefaultSeamTransaction.begin(DefaultSeamTransaction.java:88) org.jboss.seam.transaction.TransactionServletListener.requestInitialized(TransactionServletListener.java:110) org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:362) org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:897) org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:626) org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:2033) java.lang.Thread.run(Thread.java:662)
Persistence.xml: I have two objects (Property and Action) that I need to evict manually via jmx from the cache. Otherwise, they shall be cached live forever.
<persistence-unit name="myProject-PU" transaction-type="JTA"> <description>myProject Persistence Unit</description> <provider>org.hibernate.ejb.HibernatePersistence</provider> <jta-data-source>java:jboss/datasources/PostgresDS</jta-data-source> <exclude-unlisted-classes>false</exclude-unlisted-classes> <shared-cache-mode>ENABLE_SELECTIVE</shared-cache-mode> <properties> <property name="hibernate.dialect" value="org.hibernate.dialect.PostgreSQLDialect" /> <property name="hibernate.hbm2ddl.auto" value="create-drop" /> <!-- create-drop --> <property name="hibernate.jdbc.batch_size" value="0" /> <property name="hibernate.show_sql" value="false" /> <property name="hibernate.id.new_generator_mappings" value="true" /> <property name="hibernate.generate_statistics" value="false" /> <property name="hibernate.cache.use_query_cache" value="true" /> <property name="hibernate.cache.use_second_level_cache" value="true"/> <property name="hibernate.cache.infinispan.use_synchronization" value="false"/> <property name="hibernate.cache.infinispan.statistics" value="true"/> <property name="hibernate.cache.infinispan.cachemanager" value="java:jboss/infinispan/hibernate" /> <property name="hibernate.cache.infinispan.com.myProject.model.Action.eviction.strategy" value= "NONE"/> <property name="hibernate.cache.infinispan.com.myProject.model.Action.eviction.wake_up_interval" value= "1000000"/> <property name="hibernate.cache.infinispan.com.myProject.model.Action.eviction.max_entries" value= "300"/> <property name="hibernate.cache.infinispan.com.myProject.model.Action.expiration.lifespan" value= "1000000000"/> <property name="hibernate.cache.infinispan.com.myProject.model.Action.expiration.max_idle" value= "1000000000"/> <property name="hibernate.cache.infinispan.com.myProject.model.Property.eviction.strategy" value= "NONE"/> <property name="hibernate.cache.infinispan.com.myProject.model.Property.eviction.wake_up_interval" value= "1000000"/> <property name="hibernate.cache.infinispan.com.myProject.model.Property.eviction.max_entries" value= "300"/> <property name="hibernate.cache.infinispan.com.myProject.model.Property.expiration.lifespan" value= "1000000000"/> <property name="hibernate.cache.infinispan.com.myProject.model.Property.expiration.max_idle" value= "1000000000"/> <!-- <property name="hibernate.transaction.flush_before_completion" value="true"/> --> <!-- use a file system based index in prod --> <property name="hibernate.search.default.directory_provider" value="org.hibernate.search.store.impl.FSDirectoryProvider" /> <property name="hibernate.search.default.indexBase" value="myProjectindexes" /> <!-- <property name="hibernate.search.default.directory_provider" value="ram" /> --> <property name="hibernate.search.lucene_version" value="LUCENE_34" /> <property name="hibernate.search.default.exclusive_index_use" value="true" /> <property name="hibernate.search.analyzer" value="org.apache.lucene.analysis.standard.StandardAnalyzer"/> <property name="hibernate.search.worker.execution" value="async"/> <property name="hibernate.search.worker.thread_pool.size" value="1"/> <property name="hibernate.search.worker.buffer_queue.max" value="100"/> </properties> </persistence-unit>