0

I have singleton class that has a JMXContext and a Queue injected into it.

@Singleton
@Startup
@SuppressWarnings("unused")
public class MyTask extends Thread {

    @Inject
    private JMSContext mJmsContext;

    @Resource(lookup = "java:/queue/InjectionQueue")
    private Queue mJmsQueue;
.
.
.

In the post construct method the class spawns a thread to list for messages from the (ZeroMQ) socket:

@PostConstruct
@SuppressWarnings("unused")
public void postConstruct() {
    start();
}

The desire is to create a JMX message and pass it to a MDB to update the database with this new data. However, after successfully decoding the message received from the socket, when I try to create the JMX message I get the following exception:

 javax.naming.NameNotFoundException: java:comp/TransactionSynchronizationRegistry
    at org.jboss.as.messaging.deployment.JMSContextProducer$JMSContextWrapper.getDelegate(JMSContextProducer.java:217) [wildfly-messaging-8.2.0.Final.jar:8.2.0.Final]
    at org.jboss.as.messaging.deployment.JMSContextProducer$JMSContextWrapper.createMapMessage(JMSContextProducer.java:300) [wildfly-messaging-8.2.0.Final.jar:8.2.0.Final]
    at org.dobbo.cloud.MyTask.received(MyTask.java:170) [cloud-ejb.jar:]
    at org.dobbo.cloud.MyTask.received(MyTask.java:138) [cloud-ejb.jar:]
    at org.dobbo.cloud.MyTask.received(MyTask.java:128) [cloud-ejb.jar:]
    at org.dobbo.cloud.MyTask.run(MyTask.java:107) [galaxy-cloud-ejb.jar:]
Caused by: javax.naming.NameNotFoundException: java:comp/TransactionSynchronizationRegistry
    at org.jboss.as.naming.InitialContext$DefaultInitialContext.findContext(InitialContext.java:187)
    at org.jboss.as.naming.InitialContext$DefaultInitialContext.lookup(InitialContext.java:231)
    at org.jboss.as.naming.NamingContext.lookup(NamingContext.java:188)
    at org.jboss.as.naming.NamingContext.lookup(NamingContext.java:184)
    at javax.naming.InitialContext.lookup(InitialContext.java:417) [rt.jar:1.8.0_45]
    at javax.naming.InitialContext.lookup(InitialContext.java:417) [rt.jar:1.8.0_45]
    at org.jboss.as.messaging.deployment.JMSContextProducer$JMSContextWrapper.getDelegate(JMSContextProducer.java:199) [wildfly-messaging-8.2.0.Final.jar:8.2.0.Final]
    ... 5 more

on the following line of code:

final MapMessage msg = mJmsContext.createMapMessage();

As always many thanks for any help you can provide.

Dobbo
  • 1,188
  • 3
  • 16
  • 27

0 Answers0