Search code examples
jakarta-eeweblogicibm-mqweblogic12c

activation-config-properties in ejb-jar.xml not being set on MQ ActivationSpecification in WebLogic


I am attempting to configure the IBM MQ Resource Adapter (MQ-RA) inside of WebLogic Server for inbound messaging to a message-driven bean (MDB) from an MQ Queue Manager (QMgr) via an Activation Specification (ActSpec) provided by the MQ-RA.

The problem I am hitting is that the activation-config-property XML definitions (specifically ConnectionFactoryLookup and DestinationLookup) I have specified in my ejb-jar.xml deployment descriptor for my MDB are not being set by WebLogic on the ActSpec object provided by the MQ-RA. As such, when the MDB is deployed and WebLogic calls endpointActication as per the JCA spec, it is unable to connect to the MQ Queue Manager (QMgr) - because it is trying to connect using the default connection options and not the ones defined in the JNDI CF referenced by the ConnectionFactoryLookup property.

My understanding is that the EJB container (WebLogic) should be providing the MQ-RA with a configured ActSpec that has had the configuration information set on it, based on the activation-config-property entries, when creating/activating the message endpoint instance.

So my question:

Why are these activation-config-property entries in the ejb-jar.xml file not being set on the ActSpec created from the MQ-RA?

(Slight aside: If I deploy a simple Servlet application for outbound messaging, then this all works great and the EJB application uses the deployed MQ-RA to send messages to an MQ QMgr after looking up a ConnectionFactory and Destination from JNDI. So it looks as though the MQ-RA is deployed okay and its classes available.)

Below, I'll explain how I've set up WebLogic server thus far and how I've deployed my EJB apps and the MQ-RA. If anyone can off some advice or a nudge in the right direction so that I can deploy my MDB application against the MQ-RA in WebLogic successfully, that would be greatly appreciated! :-)


Product Versions Used:

WebLogic V12.2.1.2.0

MQ Server and RA V9.0.0.0

Configuration Steps Taken:

  1. Created a file based JNDI store (.bindings) to hold an MQ JMS ConnectionFactory and MQ JMS Destination object.
  2. Defined a "Foreign JNDI Provider" in WLS with the initial context factory "com.sun.jndi.fscontext.RefFSContextFactory" that points at my .bindings file.
  3. Created two Foreign JNDI Links with a local JNDI name (jms/CF and jms/Dest) mapping to the remote JNDI names in my .bindings file.
  4. Deployed the MQ-RA (via the Install button on the WLS Admin Console) "as an application" (not a library), giving it the JNDI name "mqrajndi" and setting "Global Access To Classes Enabled" to true.
  5. The following is a snippet from the ejb-jar.xml for the MDB app to be deployed showing the activation-config-property set an child elements of the message-driven parent.:

    <activation-config> <activation-config-property> <activation-config-property-name>DestinationLookup</activation-config-property-name> <activation-config-property-value>jms/Dest</activation-config-property-value> </activation-config-property> <activation-config-property> <activation-config-property-name>ConnectionFactoryLookup</activation-config-property-name> <activation-config-property-value>jms/CF</activation-config-property-value> </activation-config-property> </activation-config>

  6. In the weblogic-ejb-jar.xml file accompanies the ejb-jar.xml, I bind the MDB to the MQ-RA using the JNDI name I specified after deploying the MQ-RA:

    <weblogic-enterprise-bean> <ejb-name>BASIC_MDB</ejb-name> <message-driven-descriptor> <resource-adapter-jndi-name>mqrajndi</resource-adapter-jndi-name> </message-driven-descriptor> </weblogic-enterprise-bean>

  7. Deploy the MDB, as an application, and observe it cannot connect to my QMgr during the endpointActivation call with the exception JMSWMQ0018: Failed to connect to queue manager '' with connection mode 'Client' and host name 'localhost(1414)'.


Solution

  • After a bit more playing, I've found the solution. Posting an answer here in case it helps others :-)

    The activation-config-propertyproperties listed in my ejb-jar.xml file all began with an upper-case character, for example:

    <activation-config-property-name>DestinationLookup</activation-config-property-name>
    

    This seemed to mean that WebLogic Server was not setting them on the MQ-RA com.ibm.mq.connector.inbound.ActivationSpecImpl object that is passed into the endpointActivation(MessageEndpointFactory, ActivationSpec) call when initialising the MDB.

    Anyway, changing them to have a lower-case starting character, like so:

    <activation-config-property-name>destinationLookup</activation-config-property-name>
    

    causes WebLogic to set them on the MQ-RA ActSpecImpl object instance so that it is properly configured.

    I couldn't find any documentation or references in the server logs to say the casing of the first character of an ActSpec property was important or that any were being ignored. So that was quite annoying, grrrrr!.

    After addressing this, the second small problem I had was a java.lang.ClassCastException with JMS Connection Factory in JNDI referenced via the "connectionFactoryLookup" activation-config-property. As I was using a file based (.bindings) JNDI it wasn't creating the right of JMS MQ Connection Factory instance and so failing to extract the connection information from it. Removing this property and explicitly setting the hostName, port, channel in the ejb-jar.xml file:

    <activation-config-property>
        <activation-config-property-name>port</activation-config-property-name>
        <activation-config-property-value>1418</activation-config-property-value>
        </activation-config-property>
    <activation-config-property>
        <activation-config-property-name>channel</activation-config-property-name>
        <activation-config-property-value>WEBLOGIC.SVRCONN</activation-config-property-value>
    </activation-config-property>
    <activation-config-property>
        <activation-config-property-name>hostName</activation-config-property-name>
        <activation-config-property-value>myhost.mydomain.com</activation-config-property-value>
    </activation-config-property>
    

    did the trick and sorted the issue.