Greycon
Greycon

Reputation: 789

JMS issue connecting from WebSphere Liberty to Apache TomEE Plume

I need to connect from code running in WebSphere Liberty to an MDB in Apache TomEE Plume. I am using activemq-rar-5.16.3.

Here is the Java code:

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");
}

No matter what I try, the code hangs at jmsFactory.createContext(). There's no exception. It just hangs.

I can see from the Apache TomEE logs that an ActiveMQ listener has been created on tcp://127.0.0.1:61616 and verified this with a netstat command.

I can't move to the later version of the rar because it relies upon a Java 11 JRE.

Does anyone have any ideas how I can debug this? Wireshark shows nothing, and changing the Liberty definition to point the ActiveMQ Connection Factory to 61615 changes nothing - so I don't think the createContext method is getting as far as contacting the ActiveMQ broker. It's hardly relevant, but this method runs in an asynchronous CDI event handler in Liberty. There is nothing untoward in the Liberty logs, and no FFDC events.

Some more details:

My server.xml (relevent bits):

<!-- 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-->
<!--============================================= -->

Upvotes: 0

Views: 325

Answers (1)

Justin Bertram
Justin Bertram

Reputation: 35038

My main concern here is the use of createContext() in your notifyListeners method. ActiveMQ "Classic" (i.e. 5.x) doesn't fully support JMS 2 so you can't use the JMSContext API with it. JMS 2 is backwards compatible with JMS 1.1 (which ActiveMQ "Classic" fully supports) so you can still integrate using the ActiveMQ "Classic" JCA RA. You just can't use any APIs which are specific to JMS 2 (e.g. createContext()).

Upvotes: 1

Related Questions