« Creating a new Weblogic Domain. | Main | JDeveloper 11g Production Released »

Steps to connect to Weblogic 9.2 using JMS Adapter in Oracle BPEL / ESB

Oracle JMS Adapter is a very special JMS client that can connect to any JMS server whether it is OC4J (In-memory or DB) or a 3rd-party JMS servers like Weblogic, Websphere, Tibco, MQseries or OpenJMS or any other. Once the configuration is correct, it is as simple as connecting to a local queue and producing and consuming the messages.

The following are steps (these are not my steps :) .. I have taken these steps from SOA Best practises document) to connect to Weblogic 9.2 using JMS Adapter in Oracle BPEL / ESB:

Weblogic.jar is a file, which contains almost most of the logic to connect to the Weblogic and tune the configuration of the weblogic server. The best part of Weblogic is that this file alone is enough to connect to the Weblogic and manage it.

1. So, first step to connect to Weblogic is to copy weblogic.jar (from $WL_HOME/weblogic92/server/lib, where WL_HOME is the directory where Weblogic is installed) to the $SOA_ORACLE_HOME/j2ee/[instance_name]/connectors/JmsAdapter/JmsAdapter directory, where SOA_ORACLE_HOME is the directory where SOA Suite is installed.

2. Add the following entry (connection factory properties) to oc4j-ra.xml ($SOA_ORACLE_HOME/j2ee/[instance_name]/application-deployments/default/JmsAdapter):

<connector-factory location="[location_of_the JNDI]" connector-name="[Logical_name_of_this_connection_factory]">
<config-property name="connectionFactoryLocation" value="[global-jndi-name-of-your-non-XA-jmsconnectionfactory-in-weblogic]"/>
<config-property name="factoryProperties" value="java.naming.factory.initial=weblogic.jndi.WLInitialContextFactory;java.naming.provider.url=t3://[host:port];java.naming.security.principal=[username];java.naming.security.credentials=[password]"/<
<config-property name="acknowledgeMode" value="AUTO_ACKNOWLEDGE"/>
<config-property name="isTopic" value="false"/>
<config-property name="isTransacted" value="true"/>
<config-property name="username" value=""/>
<config-property name="password" value=""/>
</connector-factory>


Example:

<connector-factory location="eis/wljms/WLQueue" connector-name="Connection_factory_2_WL">
<config-property name="connectionFactoryLocation" value="pvj/PvjConnectionFactory"/>
<config-property name="factoryProperties" value="java.naming.factory.initial=weblogic.jndi.WLInitialContextFactory;java.naming.provider.url=t3://[host:port];java.naming.security.principal=[username];java.naming.security.credentials=[password]"/<
<config-property name="acknowledgeMode" value="AUTO_ACKNOWLEDGE"/>
<config-property name="isTopic" value="false"/>
<config-property name="isTransacted" value="true"/>
<config-property name="username" value=""/>
<config-property name="password" value=""/>
</connector-factory>

If it the end-point is a topic, then change the isTopic property to true. For queue, this property will be false.

Since the WebLogic Server does its authentication during JNDI InitialContext creation, we should not specify a value for the "username" and "password" config-property fields. These fields must be present and set to empty strings as shown above. The WebLogic username and password are specified only as the java naming properties as specified above.

Note:

a. The isTransacted config-property value can be set to true or false. If set to true, this tells the JMS adapter to use a JMS transacted session (which means that only JMS operations performed on this JMS session are included in a transaction). Currently, XA integration with WebLogic JMS is not currently supported.

b. For all WebLogic JMS versions, ensure that the JMS adapter ActivationSpec property UseMessageListener is set to false.

c. For enabling transactions across your BPELs/ ESBs, the acknowledgeMode should be set to CLIENT_ACKNOWLEDGE instead of AUTO_ACKNOWLEDGE.

3. WebLogic 9.x changed the JNDI client-side implementation in a way that causes OC4J JNDI lookups to fail. As a result, you must make the following changes to your Oracle
SOA Suite configuration. Failure to do so generates Oracle BPEL Process Manager and Oracle ESB errors related to not finding JMS destinations and transaction errors.

server.xml — ($SOA_ORACLE_HOME/j2ee/[instance-name]/config directory) Add the property environment-naming-url-factory-enabled="true" in the server.xml configuration file for your instance for any application that includes weblogic.jar from WebLogic 9.x as follows:

<application-server xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://xmlns.oracle.com/oracleas/schema/application-server-10_1.xsd"
localhostIsAdmin="true"
application-directory="../applications"
check-for-updates="adminClientOnly"
deployment-directory="../application-deployments"
connector-directory="../connectors"
environment-naming-url-factory-enabled="true"
schema-major-version="10" schema-minor-version="0">

4. The following two patches on top of 10.1.3.3 are also required for an instance that has Oracle ESB installed (whether it is being used or not):

  • Patch 6081699 - Giving Error For Aqjms If Environment-Naming-Url-Factory-Enabled="True" Prop Set

  • Patch 6316554 - Consume Functionality Of Jms Adapter For Bea Weblogic Does Not Work
  • These 4 steps are enough to connect to Weblogic JMS server using JMS Adapter. I tested it with Weblogic 9.2 and it works perfectly.


    Additional Notes:

    1. Some more points here which initially I have spent time to understand due to terminology differences J is to find out what exactly is “global-jndi-name-of-your-non-XA-jmsconnectionfactory-in-weblogic

    To know this:

    a. Goto Weblogic console: http://host:port/console

    b. Under domain configuration, goto Services section and click on JMS Modules:

    JMSAdapter1.JPG

    c. Then click on one of the available modules you have, by default, only one module will be available unless we create any or any other deployment is done.

    d. In the Resources table, you will find the value of the JNDI name for the connection factory:

    JMSAdapter2.JPG

    2. Now this Connection Factory has to be a NON-XA enabled as Weblogic doesn’t support XA Configuration outside Weblogic (internally it is supported). To find out, if this connection factory is XA-enabled or not, these are steps:

    a. Click on the Connection Factory link to go to the configuration:

    JMSAdapter3.JPG

    b. Click on the Transactions tab to check if this is XA enabled or not:

    JMSAdapter4.JPG

    c. By default, this is checked. Uncheck this and then restart your Weblogic server to make the changes into effect.

    Please note that if this check box is checked, JMS Adapter will NOT be able to produce / consume the messages (in 10.1.3.3, producing the messages works, but consuming doesn’t work. In 10.1.3.4, both producing the messages into WL queue and consuming from the WL queue doesn’t work).

    To view this entry in a PDF, please click here to download the file.

    TrackBack

    TrackBack URL for this entry:
    http://blogs.oracle.com/mte1521/mt-tb.cgi/7899

    Comments (6)

    chandra sekhar:

    Hi this is chandra Sekhar. I 'm PL/SQL developer. I want to deployment total code into production. How it will take steps, how it is doing? What is Weblogic how u connect 2 weblogic.?

    Next one. If all the code is in Production. I want to put 2 proc in coding Proc1, Proc2 how it is possible how u can connect to weblogic and how it will do and resolve the problem.

    Pls give step to step information

    Soumitra Chakraborty:

    Please suggest the other way round. That is when we need to connect jms queues deployed in the oc4j from weblogic. Please suggest the steps involved

    Hi ,

    I am trying this with 10.1.3.4 and with Patch 6081699 ( little bit of hacking for 10.1.3.4)

    but still got a error , what has to be done for 10.1.3.4 to get this working

    ERRJMS_CONN_FAC_NOT_FOUND.
    Unable to instantiate connection factory. JMS adapter was unable to look up the connection factor jms/TestQF neither through JNDI nor instantiate it as a Java class [Caused by: Unable to resolve 'jms.TestQF'. Resolved 'jms']
    Please examine the log file to determine the problem.

    at oracle.tip.adapter.jms.JMS.JMSConnectionFactoryFactory.getConnectionFactory(JMSConnectionFactoryFactory.java:207)
    at oracle.tip.adapter.jms.JMS.JMSConnectionFactoryFactory.getQueueConnectionFactory(JMSConnectionFactoryFactory.java:98)
    at oracle.tip.adapter.jms.JMS.JMSConnection.init(JMSConnection.java:192)
    at oracle.tip.adapter.jms.JMS.JMSConnection.(JMSConnection.java:133)
    at oracle.tip.adapter.jms.JmsManagedConnectionFactory.createConnection(JmsManagedConnectionFactory.java:428)
    at oracle.tip.adapter.jms.JmsManagedConnectionFactory.createDefaultConnection(JmsManagedConnectionFactory.java:419)
    at oracle.tip.adapter.jms.JmsManagedConnectionFactory.createConnection(JmsManagedConnectionFactory.java:382)
    at oracle.tip.adapter.jms.JmsManagedConnectionFactory.createManagedConnection(JmsManagedConnectionFactory.java:106)
    at com.evermind.server.connector.ApplicationConnectionManager.createManagedConnection(ApplicationConnectionManager.java:1398)
    at oracle.j2ee.connector.ConnectionPoolImpl.createManagedConnectionFromFactory(ConnectionPoolImpl.java:327)
    at oracle.j2ee.connector.ConnectionPoolImpl.access$800(ConnectionPoolImpl.java:98)
    at oracle.j2ee.connector.ConnectionPoolImpl$NonePoolingScheme.getManagedConnection(ConnectionPoolImpl.java:1211)
    at oracle.j2ee.connector.ConnectionPoolImpl.getManagedConnection(ConnectionPoolImpl.java:785)
    at com.evermind.server.connector.ApplicationConnectionManager.getConnectionFromPool(ApplicationConnectionManager.java:1596)
    at com.evermind.server.connector.ApplicationConnectionManager.acquireConnectionContext(ApplicationConnectionManager.java:1541)
    at com.evermind.server.connector.ApplicationConnectionManager.allocateConnection(ApplicationConnectionManager.java:1486)
    at oracle.j2ee.connector.OracleConnectionManager.unprivileged_allocateConnection(OracleConnectionManager.java:238)
    at oracle.j2ee.connector.OracleConnectionManager.allocateConnection(OracleConnectionManager.java:192)
    at oracle.tip.adapter.jms.JmsConnectionFactory.getConnection(JmsConnectionFactory.java:113)
    at oracle.tip.adapter.jms.JMS.JMSMessageConsumer.createConsumer(JMSMessageConsumer.java:271)
    at oracle.tip.adapter.jms.JMS.JMSMessageConsumer.init(JMSMessageConsumer.java:227)
    at oracle.tip.adapter.jms.inbound.JmsConsumer.init(JmsConsumer.java:191)
    at oracle.tip.adapter.jms.JmsEndpoint.run(JmsEndpoint.java:151)
    at oracle.j2ee.connector.work.WorkWrapper.runTargetWork(WorkWrapper.java:242)
    at oracle.j2ee.connector.work.WorkWrapper.doWork(WorkWrapper.java:215)
    at oracle.j2ee.connector.work.WorkWrapper.run(WorkWrapper.java:190)
    at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:830)

    thanks Edwin


    Hi,

    Looks like the entry jms/TestQF is missing from the oc4j-ra.xml file that is present in the $SOA_ORACLE_HOME/j2ee/[instance_name]/application-deployments/default/JmsAdapter directory. Check if the entry jms/TestQF is correctly defined. Then bounce the server and check.

    Secondly, what kind of hacking did you do in the patch ? Was that anything related to the JmsAdapter JAR files ?

    Regards
    Pavan

    avijeet:

    Hi Pavan, pls edit this line in your blog - [host:port];java.naming.security.principal=[username];java.naming.security.credentials=[password]"/

    The closing bracket is not correct, we did a copy&paste and it stopped the JMSAdapter to start up :)


    We are trying this, getting errors related to WLContextFactory class not found.

    Thanks,
    Avijeet

    Nico Zapata:

    hi, im trying to get this work, but I think i have a problem when it comes to the configuration in de oc4j-ra file.
    I have a Connection Factory Called SMSConnectionFactory defined en weblogic 10gr3 in the jndi location weblogic.jndi.jms.SMSConnectionFactory, and I have 2 queues also defined (this is just for testing the interaction) the thing is.. what do i have to write in the location attribute in the connect-factory tag... my jndi addres in weblogic? or an invented one (like your eis/wljms/WLQueue) for OC4J?
    another doubt is regarding the config in the jms adapter configuration wizard in jdeveloper, have you done a toturial about this?
    thanks in advance
    Nico Zapata

    Post a comment

    (If you haven't left a comment here before, you may need to be approved by the site owner before your comment will appear. Until then, it won't appear on the entry. Thanks for waiting.)

    About This Entry

    This page contains a single entry from the blog posted on October 7, 2008 12:55 PM.

    The previous post in this blog was Creating a new Weblogic Domain..

    The next post in this blog is JDeveloper 11g Production Released.

    Many more can be found on the main index page or by looking through the archives.

    Creative Commons License
    This weblog is licensed under a Creative Commons License.
    Powered by
    Movable Type and Oracle