2017-08-12 52 views
0

當我將一個實體發送到一個主題時,我得到了很多JMSRuntimeException。 JMSContext是由JBoss EAP 7管理的容器。下面是將實體發送到主題和隊列的代碼。我得到很多的蹤跡和我的日誌文件超過30 GB的在幾個小時的限制:JBoss EAP 7.0引發了許多JMSRuntimeException

@Inject 
private JMSContext context; 

@Resource(name = "java:/jms/topic/my.status.topic") 
private Topic myStatusTopic; 

@Resource(name = "java:/jms/queue/my.status.queue") 
private Queue myStatusQueue; 

public void handleEntities(@Nonnull final MyList myList) 
    for (ListObject listElement: myList) { 
    myEntity = new MyEntity(); 
    notifyQueues(myEntity); 
    } 
} 

private void notifyQueues(@Nonnull final MyEntity myEntity) { 
    try { 
    JMSProducer producer = context.createProducer(); 
    producer.send(myStatusTopic, myEntity); 
    producer.send(myStatusQueue, myEntity); 
    } 
    catch(JMSRuntimeException e) { 
    logger.warn("Error while sending: " + e.getMessage()); 
    } 
} 

這是實體:

@Entity 
public class MyChangeEntity implements Serializable { 

    private static final long serialVersionUID = 1L; 
    private long id; 
    private Instant created = Instant.now(); 
    private Integer customVersion; 
    ... 
} 

這裏是例外:

javax.ejb.EJBTransactionRolledbackException: javax.jms.JMSRuntimeException: Could not create a session: IJ000460: Error checking for a transaction 
     at org.jboss.as.ejb3.tx.CMTTxInterceptor.handleInCallerTx(CMTTxInterceptor.java:159) [wildfly-ejb3-7.0.1.GA-redhat-2.jar:7.0.1.GA-redhat-2] 
     at org.jboss.as.ejb3.tx.CMTTxInterceptor.invokeInCallerTx(CMTTxInterceptor.java:256) [wildfly-ejb3-7.0.1.GA-redhat-2.jar:7.0.1.GA-redhat-2] 
     at org.jboss.as.ejb3.tx.CMTTxInterceptor.required(CMTTxInterceptor.java:329) [wildfly-ejb3-7.0.1.GA-redhat-2.jar:7.0.1.GA-redhat-2] 
     at org.jboss.as.ejb3.tx.CMTTxInterceptor.processInvocation(CMTTxInterceptor.java:239) [wildfly-ejb3-7.0.1.GA-redhat-2.jar:7.0.1.GA-redhat-2] 
     at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340) 
     at org.jboss.as.ejb3.component.interceptors.CurrentInvocationContextInterceptor.processInvocation(CurrentInvocationContextInterceptor.java:41) [wildfly-ejb3-7.0.1.GA-redhat-2.jar:7.0.1.GA-redhat-2] 
     at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340) 
     at org.jboss.as.ejb3.component.invocationmetrics.WaitTimeInterceptor.processInvocation(WaitTimeInterceptor.java:43) [wildfly-ejb3-7.0.1.GA-redhat-2.jar:7.0.1.GA-redhat-2] 
     at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340) 

Caused by: java.lang.RuntimeException: javax.jms.JMSRuntimeException: Could not create a session: IJ000460: Error checking for a transaction 
     at org.wildfly.extension.messaging.activemq.deployment.JMSContextProducer$JMSContextWrapper.getDelegate(JMSContextProducer.java:234) [wildfly-messaging-activemq-7.0.1.GA-redhat-2.jar:7.0.1.GA-redhat-2] 
     at org.wildfly.extension.messaging.activemq.deployment.JMSContextProducer$JMSContextWrapper.createProducer(JMSContextProducer.java:267) [wildfly-messaging-activemq-7.0.1.GA-redhat-2.jar:7.0.1.GA-redhat-2] 

消費者(MDB)試圖合併收到的實體。但合併失敗,回滾我收到RollBackException:

javax.ejb.EJBTransactionRolledbackException: javax.jms.JMSRuntimeException: Could not create a session: IJ000460: Error checking for a transaction 

看來,JBoss的EAP 7具有會話或因爲很多時候發生錯誤的交易檢查的問題。有人能幫助我嗎?如果您需要更多信息,請詢問我。

非常感謝。

回答

1

似乎在該方法的上下文中沒有活動事務。

類配置({{ejb-jar.xml}},使用註釋)如何?它是一個cdi bean還是ejb?

對於特定異常,日誌中是否還有一些{{引起者:}}子句?

或者由於某種原因,事務已經終止,上下文消失 - 長時間運行的事務由於超時而終止 - 檢查事務設置的超時,代碼明確已經回退事務(可能RuntimeException是拋出)。

0

感謝您的回覆。

問題不在JMS中。這是一個數據庫交易被打破。所以數據庫事務中的異常負責JMSRuntimeException。這不是一個真正的JMS問題。