我需要连接从运行在WebSphere自由的代码到Apache TomEE羽流中的MDB。我用的是activemq-rar-5.16.3。
以下是Java代码:
public void notifyListeners(String caseId) {
logger.debug("+notifyListeners");
int timeToLive = 15 * 1000; // 15 seconds
try {
logger.debug("Creating context");
InitialContext ic = new InitialContext();
logger.debug("Got Initial context");
ConnectionFactory jmsFactory = (ConnectionFactory)ic.lookup("jndi/JMS_BASE_QCF");
logger.debug("Got Factory");
JMSContext context = jmsFactory.createContext();
logger.debug("Creating text message");
TextMessage msg = context.createTextMessage(caseId);
logger.debug("Sending text message");
context.createProducer().setTimeToLive(timeToLive).send(jmsSendQueue, msg);
logger.debug("Text message sent");
} catch (Throwable e) {
logger.error("Caught Exception sending ActiveMQ Message : " + e, e);
}
logger.debug("-notifyListeners");
}无论我尝试什么,代码都挂在jmsFactory.createContext()上。也不例外。它只是挂着。
我可以从Apache TomEE日志中看到,已经在tcp://127.0.0.1:61616上创建了一个ActiveMQ侦听器,并使用netstat命令验证了这一点。
我不能转到rar的后期版本,因为它依赖于Java11JRE。
有人知道我怎么调试这个吗?Wireshark没有显示任何内容,将ActiveMQ连接工厂更改为61615的自由定义也不会改变什么--所以我认为createContext方法还没有联系到ActiveMQ代理。这与此无关,但此方法在this中的异步CDI事件处理程序中运行。自由日志中没有任何不正常的内容,也没有FFDC事件。
更多细节:
(wlp-1.0.48.cl210120210113-1459)
我的server.xml (相关比特):
<!-- language: xml -->
<featureManager>
<feature>ejbLite-3.2</feature>
<feature>jaxws-2.2</feature>
<feature>jndi-1.0</feature>
<feature>jpa-2.2</feature>
<feature>jpaContainer-2.2</feature>
<feature>jsp-2.3</feature>
<feature>localConnector-1.0</feature>
<feature>mdb-3.2</feature>
<feature>microProfile-3.3</feature>
<feature>monitor-1.0</feature>
<feature>wasJmsClient-2.0</feature>
<feature>wasJmsSecurity-1.0</feature>
<feature>wasJmsServer-1.0</feature>
<feature>wmqJmsClient-2.0</feature>
<feature>jms-2.0</feature>
</featureManager>
<!--============================================= -->
<!-- Liberty to TomEE JMS over ActiveMQ Config -->
<!--============================================= -->
<resourceAdapter id="activemq" location="C:\apps\liberty\ActiveMQRAR\activemq-rar-5.16.3.rar">
<properties.activemq ServerUrl="tcp://127.0.0.1:61616"/>
</resourceAdapter>
<jmsQueueConnectionFactory jndiName="jndi/JMS_BASE_QCF">
<properties.activemq serverUrl="tcp://127.0.0.1:61616"/>
</jmsQueueConnectionFactory>
<jmsQueue jndiName="jndi/worklistQueue">
<properties.activemq PhysicalName="jms/worklistQueue"/>
</jmsQueue>
<!--============================================= -->
<!-- Liberty to TomEE JMS over ActiveMQ Config end-->
<!--============================================= -->发布于 2022-08-17 12:55:39
这里我主要关注的是createContext()在notifyListeners方法中的使用。ActiveMQ“经典”( 5.x)并不完全支持JMS 2,因此您不能在其中使用JMS。JMS 2向后兼容JMS1.1( ActiveMQ“经典”完全支持JMS1.1),因此仍然可以使用ActiveMQ“经典”JCA进行集成。您只是不能使用任何特定于JMS 2的API(例如createContext())。
https://stackoverflow.com/questions/73366860
复制相似问题