Reputation: 439
I get many JMSRuntimeExceptions when I send a entity to a topic. The JMSContext is container managed by the JBoss EAP 7. Here is the code for sending the entity to topic and queue. I get many stacktraces and my log file exceeds the limit of 30 GB in a few hours:
@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());
}
}
This is the entity:
@Entity
public class MyChangeEntity implements Serializable {
private static final long serialVersionUID = 1L;
private long id;
private Instant created = Instant.now();
private Integer customVersion;
...
}
And here is the exception:
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]
The consumer (MDB) tries to merge the received entiy. But the merge fails and on rollback I receive a RollBackException:
javax.ejb.EJBTransactionRolledbackException: javax.jms.JMSRuntimeException: Could not create a session: IJ000460: Error checking for a transaction
It seems that JBoss EAP 7 has a problem with session or with checking for a transaction because the error occurs very often. Could anybody help me? If you need more information please ask me.
Many thanks.
Upvotes: 0
Views: 436
Reputation: 439
Thanks for the reply.
The problem was not in JMS. It has been a database transaction which was broken. So the exception in the the database transaction was responsible for the JMSRuntimeException. It was not a real JMS problem.
Upvotes: 0
Reputation: 722
It seems there is no active transaction in the context of the method.
How is the class configuration ({{ejb-jar.xml}}, used annotations)? Is it a cdi bean or ejb?
Is there some more {{Caused by:}} clauses in the log for the particular exception?
Or the transaction was already terminated for some reason and the context is gone - kind of long running transaction is terminated because of timeout - check the timeout for transactions settings, your code explicitely already rolled-back the transaction (possibly RuntimeException was thrown).
Upvotes: 1