8

现在我遇到了一个不愉快的问题。我有 6 个项目在我的 JBoss AS 7 上运行。它们以独立模式部署。工作了一段时间(5-25 小时)后,我开始在我的所有项目中收到相同的错误:javax.enterprise.event.ObserverException

这是堆栈:

ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[site.technorational.kz]] (http--192.168.1.2-80-3) Exception sending request initialized lifecycle event to listener instance of class org.jboss.seam.transaction.TransactionServletListener: javax.enterprise.event.ObserverException
        at sun.reflect.GeneratedConstructorAccessor136.newInstance(Unknown Source) [:1.6.0_21]
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) [rt.jar:1.6.0_21]
        at java.lang.reflect.Constructor.newInstance(Constructor.java:513) [rt.jar:1.6.0_21]
        at java.lang.Class.newInstance0(Class.java:355) [rt.jar:1.6.0_21]
        at java.lang.Class.newInstance(Class.java:308) [rt.jar:1.6.0_21]
        at org.jboss.weld.util.reflection.SecureReflections$16.work(SecureReflections.java:343) [weld-core-1.1.5.AS71.Final.jar:2012-02-10 15:31]
        at org.jboss.weld.util.reflection.SecureReflectionAccess.run(SecureReflectionAccess.java:52) [weld-core-1.1.5.AS71.Final.jar:2012-02-10 15:31]
        at org.jboss.weld.util.reflection.SecureReflectionAccess.runAsInstantiation(SecureReflectionAccess.java:173) [weld-core-1.1.5.AS71.Final.jar:2012-02-10 15:31]
        at org.jboss.weld.util.reflection.SecureReflections.newInstance(SecureReflections.java:340) [weld-core-1.1.5.AS71.Final.jar:2012-02-10 15:31]
        at org.jboss.weld.injection.Exceptions.rethrowException(Exceptions.java:33) [weld-core-1.1.5.AS71.Final.jar:2012-02-10 15:31]
        at org.jboss.weld.injection.Exceptions.rethrowException(Exceptions.java:73) [weld-core-1.1.5.AS71.Final.jar:2012-02-10 15:31]
        at org.jboss.weld.injection.MethodInjectionPoint.invokeOnInstanceWithSpecialValue(MethodInjectionPoint.java:162) [weld-core-1.1.5.AS71.Final.jar:2012-02-10 15:31]
        at org.jboss.weld.event.ObserverMethodImpl.sendEvent(ObserverMethodImpl.java:241) [weld-core-1.1.5.AS71.Final.jar:2012-02-10 15:31]
        at org.jboss.weld.event.ObserverMethodImpl.sendEvent(ObserverMethodImpl.java:229) [weld-core-1.1.5.AS71.Final.jar:2012-02-10 15:31]
        at org.jboss.weld.event.ObserverMethodImpl.notify(ObserverMethodImpl.java:207) [weld-core-1.1.5.AS71.Final.jar:2012-02-10 15:31]
        at org.jboss.weld.manager.BeanManagerImpl.notifyObservers(BeanManagerImpl.java:569) [weld-core-1.1.5.AS71.Final.jar:2012-02-10 15:31]
        at org.jboss.weld.manager.BeanManagerImpl.fireEvent(BeanManagerImpl.java:564) [weld-core-1.1.5.AS71.Final.jar:2012-02-10 15:31]
        at org.jboss.weld.event.EventImpl.fire(EventImpl.java:68) [weld-core-1.1.5.AS71.Final.jar:2012-02-10 15:31]
        at org.jboss.seam.transaction.TransactionServletListener.requestInitialized(TransactionServletListener.java:117) [seam-transaction-3.1.0.Final.jar:3.1.0.Final]
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:143) [jbossweb-7.0.13.Final.jar:]
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) [jbossweb-7.0.13.Final.jar:]
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) [jbossweb-7.0.13.Final.jar:]
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:368) [jbossweb-7.0.13.Final.jar:]
        at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877) [jbossweb-7.0.13.Final.jar:]
        at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:671) [jbossweb-7.0.13.Final.jar:]
        at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:930) [jbossweb-7.0.13.Final.jar:]
        at java.lang.Thread.run(Thread.java:619) [rt.jar:1.6.0_21]
Caused by: javax.transaction.NotSupportedException: BaseTransaction.checkTransactionState - ARJUNA016051: thread is already associated with a transaction!
        at com.arjuna.ats.internal.jta.transaction.arjunacore.BaseTransaction.begin(BaseTransaction.java:63)
        at com.arjuna.ats.jbossatx.BaseTransactionManagerDelegate.begin(BaseTransactionManagerDelegate.java:65)
        at org.jboss.tm.usertx.client.ServerVMClientUserTransaction.begin(ServerVMClientUserTransaction.java:142)
        at org.jboss.seam.transaction.UTTransaction.begin(UTTransaction.java:51) [seam-transaction-3.1.0.Final.jar:3.1.0.Final]
        at org.jboss.seam.transaction.DefaultSeamTransaction.begin(DefaultSeamTransaction.java:88) [seam-transaction-3.1.0.Final.jar:3.1.0.Final]
        at org.jboss.seam.transaction.TransactionServletListener.requestInitialized(TransactionServletListener.java:110) [seam-transaction-3.1.0.Final.jar:3.1.0.Final]
        ... 8 more
Caused by: java.lang.IllegalStateException: BaseTransaction.checkTransactionState - ARJUNA016051: thread is already associated with a transaction!
        at com.arjuna.ats.internal.jta.transaction.arjunacore.BaseTransaction.checkTransactionState(BaseTransaction.java:257)
        at com.arjuna.ats.internal.jta.transaction.arjunacore.BaseTransaction.begin(BaseTransaction.java:59)
        ... 13 more

在我在日志中搜索答案后,我发现有时这会在上一个异常出现之前出现:

22:19:21,872 INFO  [org.jboss.as.server] (Controller Boot Thread) JBAS018559: Deployed "project1-web.war"
22:19:21,873 INFO  [org.jboss.as.server] (Controller Boot Thread) JBAS018559: Deployed "project2-web.war"
22:19:21,873 INFO  [org.jboss.as.server] (Controller Boot Thread) JBAS018559: Deployed "project3-web.war"
22:19:21,875 INFO  [org.jboss.as.server] (Controller Boot Thread) JBAS018559: Deployed "project4-web.war"
22:19:21,875 INFO  [org.jboss.as.server] (Controller Boot Thread) JBAS018559: Deployed "project5-web.war"
22:19:21,876 INFO  [org.jboss.as.server] (Controller Boot Thread) JBAS018559: Deployed "project6-web.war"
22:19:21,888 INFO  [org.jboss.as] (Controller Boot Thread) JBAS015961: Http management interface listening on http://192.168.2.1:9990/management
22:19:21,889 INFO  [org.jboss.as] (Controller Boot Thread) JBAS015951: Admin console listening on http://192.168.2.1:9990
22:19:21,889 INFO  [org.jboss.as] (Controller Boot Thread) JBAS015874: JBoss AS 7.2.0.Alpha1-SNAPSHOT "Steropes" started in 31119ms - Started 4319 of 4426 services (98 services are passive or on-demand)
22:24:59,256 WARN  [com.arjuna.ats.arjuna] (Transaction Reaper) ARJUNA012117: TransactionReaper::check timeout for TX 0:ffffc0a80107:2c60f317:50914f6c:4d in state  RUN
22:24:59,259 WARN  [com.arjuna.ats.arjuna] (Transaction Reaper Worker 0) ARJUNA012095: Abort of action id 0:ffffc0a80107:2c60f317:50914f6c:4d invoked while multiple threads active within it.
22:24:59,259 WARN  [com.arjuna.ats.arjuna] (Transaction Reaper Worker 0) ARJUNA012108: CheckedAction::check - atomic action 0:ffffc0a80107:2c60f317:50914f6c:4d aborting with 1 threads active!
22:24:59,260 WARN  [com.arjuna.ats.arjuna] (Transaction Reaper Worker 0) ARJUNA012121: TransactionReaper::doCancellations worker Thread[Transaction Reaper Worker 0,5,main] successfully canceled TX 0:ffffc0a80107:2c60f317:50914f6c:4d

我对这个问题进行了很多思考。我的建议之一是 MySQL 导致了这种情况,因为有很多方法使用JPA CriteriaBuilder从数据库中检索信息。当我检查 MySQL 的状态时,我可以看到大约有 100 个慢查询。

在我的项目中,我使用 SEAM、Hibernate、JPA、PrimeFaces。

我设法找到了一些类似的问题,但仍然没有答案。

提前致谢, 伊利亚·西多罗维奇

4

2 回答 2

4

这里遇到了同样的问题:https ://community.jboss.org/thread/179047?_sscc=t

禁用侦听器并手动注释类/方法将是修复它的一种方法。如果事务被标记为回滚,则侦听器将回滚它。

也有可能,一个线程试图开始已经回滚的事务。因此,在 TransactionServletListener.requestInitialized() 中,事务状态为 4(回滚)。

请参阅讨论链接以获取更多详细信息。

于 2012-11-11T18:53:06.817 回答
1

当我的事务被 JBoss (AS 7) 过期时,我有这个堆栈跟踪。您可以在standalone.xml 上更改此配置来增加您的事务生命周期:

节点内部:

<subsystem xmlns="urn:jboss:domain:transactions:1.2">

更改此属性:

<coordinator-environment default-timeout="600">

超时以秒为单位。

注意:此错误可能是由其他原因引起的(谢尔盖的回答就是其中之一)。通常它发生在您的事务已完成或标记为回滚并且您的进程仍然需要它时。

于 2013-01-23T18:26:29.140 回答