Cannot connect MDB to IBM MQ queue via destinationLookup

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Cannot connect MDB to IBM MQ queue via destinationLookup

ptie-2
Hi all,

We 're having trouble with connecting message driven beans to an IBM MQ
queue with TomEE 7.1.0

Annotations on MDB:

@MessageDriven(activationConfig = {
    @ActivationConfigProperty(propertyName = "destinationLookup",
propertyValue = "openejb:Resource/jms/SomeQueueResource"),
    @ActivationConfigProperty(propertyName = "destinationType",
propertyValue = "javax.jms.Queue"),
    @ActivationConfigProperty(propertyName = "connectionFactoryLookup",
propertyValue = "openejb:Resource/jms/SomeConnectionFactory")
})
class SomeMdb implements MessageListener { ... }


openejb-jar.xml:

<openejb-jar xmlns="http://www.openejb.org/openejb-jar/1.1">
  <ejb-deployment ejb-name="SomeMdb"
    deployment-id="SomeMdb" container-id="wmq">
  </ejb-deployment>
</openejb-jar>


tomee.xml:

<tomee>
  <Deployments dir="apps" />
  <Deployments dir="ibm_rar" />

  <Container id="wmq" type="MESSAGE">
    ResourceAdapter=wmqRA
    MessageListenerInterface=javax.jms.MessageListener
    ActivationSpecClass=com.ibm.mq.connector.inbound.ActivationSpecImpl
  </Container>

  <Resource id="wmqRA"
    type="com.ibm.mq.connector.ResourceAdapterImpl"
    class-name="com.ibm.mq.connector.ResourceAdapterImpl">
    connectionConcurrency=5
    maxConnections=10
    logWriterEnabled=false
    reconnectionRetryCount=5
    reconnectionRetryInterval=300000
    traceEnabled=false
    traceLevel=3
  </Resource>

  <Resource id="jms/SomeConnectionFactory"
    type="javax.jms.ConnectionFactory"
    class-name="com.ibm.mq.connector.outbound.ManagedConnectionFactoryImpl">
    TransactionSupport=none
    ResourceAdapter=wmqRA
    HostName=${MQ_HOST}
    Port=${MQ_PORT}
    QueueManager=${MQ_MGR}
    Channel=${MQ_CHANNEL}
    TransportType=Client
    UserName=${MQ_USER}
    Password=${MQ_PASSWORD}
  </Resource>

  <Resource id="jms/SomeQueueResource" type="javax.jms.Queue"
    class-name="com.ibm.mq.connector.outbound.MQQueueProxy">
    arbitraryProperties
    baseQueueManagerName=${MQ_MGR}
    baseQueueName=MyQueue
    CCSID=819
    encoding=NATIVE
    expiry=APP
    failIfQuiesce=true
    persistence=APP
    priority=APP
    readAheadClosePolicy=ALL
    targetClient=JMS
  </Resource>
</tomee>


Exception:

com.ibm.msg.client.jms.DetailedInvalidDestinationException: JMSWMQ2008:
Failed to open MQ queue 'jms/SomeQueueResource'.
JMS attempted to perform an MQOPEN, but IBM MQ reported an error.
Use the linked exception to determine the cause of this error. Check that
the specified queue and queue manager are defined correctly.
        at
com.ibm.msg.client.wmq.common.internal.Reason.reasonToException(Reason.java:513)
        at
com.ibm.msg.client.wmq.common.internal.Reason.createException(Reason.java:215)
        at
com.ibm.msg.client.wmq.internal.WMQMessageConsumer.checkJmqiCallSuccess(WMQMessageConsumer.java:222)
        at
com.ibm.msg.client.wmq.internal.WMQMessageConsumer.checkJmqiCallSuccess(WMQMessageConsumer.java:156)
        at
com.ibm.msg.client.wmq.internal.WMQConsumerShadow.initialize(WMQConsumerShadow.java:1188)
        at
com.ibm.msg.client.wmq.internal.WMQAsyncConsumerShadow.initialize(WMQAsyncConsumerShadow.java:974)
        at
com.ibm.msg.client.wmq.internal.WMQConnectionBrowser.<init>(WMQConnectionBrowser.java:1463)
        at
com.ibm.msg.client.wmq.internal.WMQConnection.createConnectionBrowser(WMQConnection.java:882)
        at
com.ibm.msg.client.jms.internal.JmsConnectionImpl.createConnectionBrowser(JmsConnectionImpl.java:1360)
        at
com.ibm.msg.client.jms.internal.JmsConnectionConsumerImpl.createConnectionBrowser(JmsConnectionConsumerImpl.java:259)
        at
com.ibm.msg.client.jms.internal.JmsConnectionConsumerImpl.<init>(JmsConnectionConsumerImpl.java:180)
        at
com.ibm.msg.client.jms.internal.JmsConnectionConsumerImpl.<init>(JmsConnectionConsumerImpl.java:125)
        at
com.ibm.msg.client.jms.internal.JmsConnectionImpl.createConnectionConsumer(JmsConnectionImpl.java:658)
        at
com.ibm.mq.jms.MQConnection.createConnectionConsumer(MQConnection.java:204)
        at
com.ibm.mq.connector.inbound.MessageEndpointDeployment.createConnectionConsumer(MessageEndpointDeployment.java:912)
        at
com.ibm.mq.connector.inbound.MessageEndpointDeployment.startDeliveryASF(MessageEndpointDeployment.java:519)
        at
com.ibm.mq.connector.inbound.MessageEndpointDeployment.startDelivery(MessageEndpointDeployment.java:437)
        ... 24 more
Caused by: com.ibm.mq.MQException: JMSCMQ0001: IBM MQ call failed with
compcode '2' ('MQCC_FAILED') reason '2085' ('MQRC_UNKNOWN_OBJECT_NAME').
        at
com.ibm.msg.client.wmq.common.internal.Reason.createException(Reason.java:203)
        ... 39 more

TomEE does pick up the connectionFactoryLookup property, loading the
jms/SomeConnectionFactory resources and making connection to the MQ server
with the connection properties inside the resource. That 's nice.

But for the destinationLookup property, it does not use the baseQueueName
property inside the jms/SomeQueueResource resource, but it seems to use the
resource id itself for the queue name. Which is incorrect, because the queue
name is MyQueue, not jms/SomeQueueResource.

How can we solve this?

Thanks!
Peter




--
Sent from: http://tomee-openejb.979440.n4.nabble.com/TomEE-Users-f979441.html
Reply | Threaded
Open this post in threaded view
|

Re: Cannot connect MDB to IBM MQ queue via destinationLookup

ptie-2
Reply | Threaded
Open this post in threaded view
|

Re: Cannot connect MDB to IBM MQ queue via destinationLookup

jgallimore
I'll dig out the app I had working with Websphere MQ and get back to you
later today. Apologies for missing the previous message.

Jon

On Fri, Jan 17, 2020 at 4:00 PM ptie <[hidden email]> wrote:

> Anybody?
>
> Thanks!
> Peter
>
>
>
> --
> Sent from:
> http://tomee-openejb.979440.n4.nabble.com/TomEE-Users-f979441.html
>