1
votes

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)'.

1
Did you use ejb_3_2 xsd in ejb-jar.xml? Not sure you need resource-adapter-jndi-name in weblogic-ejb-jar. Also notice that in your description you inverted CF JNDI and Queue JNDI nameRouliboy
Thanks for pointing out the typo in the ejb-jar.xml. I simplified from their full JNDI names for this post but got them the wrong way round. They're correct in my actual ejb-jar.xml :-). I need the resource-adapter-jndi-name in the weblogic-ejb-jar to bind the MDB application to the deployed MQ-RA. Without it, WebLogic wasn't trying to even activate it. I followed docs.oracle.com/middleware/12212/wls/ADAPT/…. I tried both ejb_3_2 xsd and ejb_2_1 xsd but neither worked for me.a_cornish_pasty
You just want to read, in MDB in weblogic, messages from MQ? Why do you need a resource adapter? I implemented such MDB using following link : weblogic-wonders.com/weblogic/2010/11/24/… but I must be missing something.Rouliboy
Do you have the linked MQ exception that goes along with the JMSWMQ0018 error you observed? Does the queue managers AMQERR01.LOG have anything at the same time you attempt to connect?JoshMc
The linked exception is just a socket connect error because when the endpoint is activated it is connecting using the default information (localhost / 1414 / SYSTEM.DEF.SVRCONN). This is because the ActSpec from the MQ-RA has not had the JNDI ConnFac name set on it via the act-config-prop in the ejb-jar.xml. As such the ActSpec has no way to lookup the correct connection factory from the CF. so I think the key question is why aren't the act-confit-props being set on the ActSpec object before endpointActivation is called by the WLS EJB container?a_cornish_pasty

1 Answers

3
votes

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.