我有一个单独的类,它有一个JMXContext和一个注入它的队列。
@Singleton
@Startup
@SuppressWarnings("unused")
public class MyTask extends Thread {
@Inject
private JMSContext mJmsContext;
@Resource(lookup = "java:/queue/InjectionQueue")
private Queue mJmsQueue;
.
.
.
在post构造方法中,该类产生一个线程来列出消息 来自(ZeroMQ)套接字:
@PostConstruct
@SuppressWarnings("unused")
public void postConstruct() {
start();
}
希望创建一条JMX消息并将其传递给MDB,以使用此新数据更新数据库。但是,在成功解码从套接字接收的消息后,当我尝试创建JMX消息时,我得到以下异常:
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
在以下代码行中:
final MapMessage msg = mJmsContext.createMapMessage();
一如既往地感谢您提供的任何帮助。