Weblogic EJB connection to external Tibco EMS JMS Queue

ChrisM picture ChrisM · Jul 25, 2011 · Viewed 7k times · Source

I'm trying to connect a Weblogic (10.3) MDB to a Tibco EMS JMS queue. I've read from the queue using a simple Java/Spring JNDI connection so I know the foreign JNDI lookup names are valid. My WL foreign server details:

JNDI Initial Context Factory: com.tibco.tibjms.naming.TibjmsInitialContextFactory
JNDI Connection URL: tcp://ems-dit-am-uat-1.app.xxx.net:30055
JNDI Properties:
java.naming.factory.initial=com.tibco.tibjms.naming.TibjmsInitialContextFactory
java.naming.provider.url=tcp://ems-dit-am-uat-1.app.xxx.net:30055
java.naming.security.principal=rdsuat
java.naming.factory.url.pkgs=com.tibco.tibjms.naming
(password entered in Properties Credential box).

Destination:

Name, Local JNDI Name and Remote JNDI name all set to Q.NY.DERIV.DRD.RFI

Connection Factory:

Name, Local JNDI Name and Remote JNDI name all set to DRDRFIQueueConnectionFactory
(which simply changes the default connection factory port).
User/password also set here (same as before).

weblogic-ejb-jar.xml

    <weblogic-enterprise-bean>
    <ejb-name>MessageReceiver</ejb-name>
    <message-driven-descriptor>
        <pool>
            <max-beans-in-free-pool>2</max-beans-in-free-pool>
        </pool>
        <destination-jndi-name>Q.NY.DERIV.DRD.RFI</destination-jndi-name>
        <connection-factory-jndi-name>DRDRFIQueueConnectionFactory</connection-factory-jndi-name>
    </message-driven-descriptor>
</weblogic-enterprise-bean>

The error I get is: The Message-Driven EJB: MessageReceiver is unable to connect to the JMS destination: Q.NY.DERIV.DRD.RFI. The Error was: Can not get distribute destination information. The destination JNDI name is Q.NY.DERIV.DRD.RFI, the provider URL is null

I've tried moving the config into the weblogic-ejb-jar.xml (ie:

    <weblogic-enterprise-bean>
    <ejb-name>MessageReceiver</ejb-name>
    <message-driven-descriptor>
        <pool>
            <max-beans-in-free-pool>2</max-beans-in-free-pool>
        </pool>
        <destination-jndi-name>Q.NY.DERIV.DRD.RFI</destination-jndi-name>
        <initial-context-factory>com.tibco.tibjms.naming.TibjmsInitialContextFactory</initial-context-factory>
        <provider-url>tcp://ems-dit-am-uat-1.app.xxx.net:30055</provider-url>
        <connection-factory-jndi-name>DRDRFIQueueConnectionFactory</connection-factory-jndi-name>
    </message-driven-descriptor>
</weblogic-enterprise-bean>

but I get a different error: Exception activating module: EJBModule(rfiloader.jar) Unable to deploy EJB: MessageReceiver from rfiloader.jar: unable to find EndPointFinder for tcp://ems-dit-am-uat-1.app.xxx.net:30055

...any ideas?

Thanks Chris

Answer

ChrisM picture ChrisM · Jul 28, 2011

Have finally achieved this - due to a bug in Weblogic 10.3 this isn't as simple as it should be.

  1. Create a foreign server with all the normal details (local/remote JNDI lookup names for destination and connection factories).

  2. Create a local WL user with the same name as the remote EMS user, including password.

  3. Create an ejb credential mapping (NOT security credential mapping)

    • do this by clicking on the relevant deployment, click on the relevant ejb name in the list, then Security tab then Credentials Mapping tab.
    • add the same name for WLS and Remote users (password doesn't seem to be necessary here).

Add the following sections in config files:

weblogic-ejb-jar.xml

At the bottom of this file, after the closing 'weblogic-enterprise-bean' tag and before the ending 'weblogic-ejb-jar' tag add the following:

<security-role-assignment>
    <role-name>rficonsumer</role-name>
    <principal-name>rdsuat</principal-name>
</security-role-assignment>

The 'rficonsumer' role only exists in these 2 config files and can be anything as long as it is consistent in all 3 sections described here. The principal-name 'rdsuat' must match the user created in the WL Admin console section and therefore must match the EMS queue user.

ejb-jar.xml

  1. In the 'message-driven' tag section for the relevant MDB add the following section at the end before the closing 'message-driven' tag:

    rficonsumer

  2. At the very end of the file, after the closing 'enterprise-beans' tag, before the ending 'ejb-jar' closing tag add the following:

    rficonsumer