Saturday, May 14, 2016

Configuring WSO2 ESB with WebLogic Server Using JMS


This article gives the configuration details and the proxy service sample to connect the ESB as a JMS consumer and producer with WeblLogic Message Queue. Here the provided sample is tested with WSO2 ESB 4.9.0, WebLogic 12.1.3, JDK 1.8 and Ubuntu 14.04. At the end of this article mentioned about the other combinations of version, where this integration tested.

Setting up the WebLogic Server



Here used Weblogic 12.1.3. This can be downloaded from the below link.

Installation of Weblogic Server 12.1.3

 
After downloading the generic installer ( Installers with Oracle WebLogic Server and Oracle Coherence ) will get a jar named – fmw_12.1.3.0.0_wls.jar. Copy that to a specific folder and create another folder inside as weblogic_home to give it as a location for the installation during the installation step. Then using the terminal execute the below command.

java -jar fmw_12.1.3.0.0_wls.jar

Follow the screens, based on the instructions. The screen shots of each screen given below:














After the installation, if the configuration wizard not loaded, go to /weblogic_home/oracle_common/common and run the config.sh. Then will get the below screens and proceed with it.










 After completing the configuration, now can start the WebLogic Server 12.1.3.

Go to /home/ajanthan/wso2/weblogic_server5/weblogic_home/user_projects/domains/base_domain and start using startWebLogic.sh.

After a successful start the terminal will be look as below:


 Configuring Message Queue in WebLogic

 

Go to the URL http://ajanthan-thinkpad-t440p:7001/console


Follow the below steps to create the JMSServer, ConnectionFactory and Message Queue in WebLogic server.

Go to Domain Structure → base_domain → Services → Messaging → JMS Servers
Create New JMSServer.


Create a New Store and set a folder for file store location. Here it is filestorewso2 and then proceed with the below screens.





Now to configure JMS Queue and the Connection Factory, 
Go to Domain Structure → base_domain → Services → Messaging → JMS Modules and create a new module and follow the screens below.






Then Select the created JMS Module, here it is SystemModule1 and select the tab Subdeployments.Then follow the below screens.





Select the Module created ( SystemModule1 ) and follow the screens to create the connection factory.






Same way create the queue. Follow the screens as below:





That's it, the WebLogic based configurations done.

Configuring WSO2 ESB 4.9.0


As a first step, need to create the client jar of WebLogic server to support the WSO2 ESB.

Go to /home/ajanthan/wso2/weblogic_server5/weblogic_home/wlserver/server/lib
and run the below command.

java -jar wljarbuilder.jar

This will create a wlfullclient.jar inside the same location. Now need to remove the javax.jms package and javax.xml.namespace package from the wlfullclient.jar.
For this you can follow two options.

1)  Use the pom.xml in the https://docs.wso2.com/display/ESB490/Configure+with+WebLogic and build the bundle and copied it to ESB_HOME/repository/components/dropins.

2) Open the wlfullclient.jar using Archive Manager and remove the folders of the below packages manually. 
javax.jms
javax.xml.namespace
And copy the jar to ESB_HOME/repository/components/lib.

JMS Listener configuration in axis2.xml


<transportReceiver name="jms" class="org.apache.axis2.transport.jms.JMSListener">
        <parameter name="myQueueConnectionFactory" locked="false">
        <parameter name="java.naming.factory.initial" locked="false">weblogic.jndi.WLInitialContextFactory</parameter>
        <parameter name="java.naming.provider.url" locked="false">t3://localhost:7001</parameter>
        <parameter name="transport.jms.ConnectionFactoryJNDIName" locked="false">jms/TestConnectionFactory1</parameter>
        <parameter name="transport.jms.ConnectionFactoryType" locked="false">queue</parameter>
        <parameter name="transport.jms.UserName" locked="false">weblogic</parameter>
        <parameter name="transport.jms.Password" locked="false">Batticaloa@1A</parameter>
        </parameter>

        <parameter name="default" locked="false">
        <parameter name="java.naming.factory.initial" locked="false">weblogic.jndi.WLInitialContextFactory</parameter>
        <parameter name="java.naming.provider.url" locked="false">t3://localhost:7001</parameter>
        <parameter name="transport.jms.ConnectionFactoryJNDIName" locked="false">jms/TestConnectionFactory1</parameter>
        <parameter name="transport.jms.ConnectionFactoryType" locked="false">queue</parameter>
        <parameter name="transport.jms.UserName" locked="false">weblogic</parameter>
        <parameter name="transport.jms.Password" locked="false">Batticaloa@1A</parameter>
        </parameter>
</transportReceiver>

JMS Sender configuration


<transportSender name="jms" class="org.apache.axis2.transport.jms.JMSSender"/>

Consumer Proxy Service

<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
       name="WeblogicJMSConsumerProxy"
       transports="jms"
       statistics="disable"
       trace="disable"
       startOnLoad="true">
   <target>
      <inSequence>
         <log level="custom">
            <property name="STATUS:"
                      value="------Message consumed by WeblogicJMSConsumerProxy--------"/>
         </log>
         <log level="full"/>
      </inSequence>
      <outSequence>
         <send/>
      </outSequence>
   </target>
   <parameter name="transport.jms.Destination">jms/TestJMSQueue1</parameter>
   <description/>
</proxy>

Producer Proxy Service

<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
       name="WeblogicJMSSenderProxy"
       transports="http"
       statistics="disable"
       trace="disable"
       startOnLoad="true">
   <target>
      <inSequence>
         <property name="Accept-Encoding" scope="transport" action="remove"/>
         <property name="Content-Length" scope="transport" action="remove"/>
         <property name="Content-Type" scope="transport" action="remove"/>
         <property name="User-Agent" scope="transport" action="remove"/>
         <log level="custom">
            <property name="STATUS:"
                      value="------Message Sent by WeblogicJMSConsumerProxy--------"/>
         </log>
         <property name="OUT_ONLY" value="true"/>
         <property name="FORCE_SC_ACCEPTED" value="true" scope="axis2"/>
         <send>
            <endpoint>
               <address uri="jms:/jms/TestJMSQueue1?transport.jms.ConnectionFactoryJNDIName=jms/TestConnectionFactory1&java.naming.factory.initial=weblogic.jndi.WLInitialContextFactory&java.naming.provider.url=t3://localhost:7001&transport.jms.DestinationType=queue"/>
            </endpoint>
         </send>
      </inSequence>
      <outSequence>
         <send/>
      </outSequence>
   </target>
   <description/>
</proxy>

Test Results

Tested Environment Combinations


1) ESB 4.7.0 / JDK1.7 / Weblogic 10.3.6 - Weblogic 11g.
2) ESB 4.9.0 / JDK1.7 / Weblogic 10.3.6 - Weblogic 11g.
3) ESB 4.9.0 / JDK1.8 / Weblogic 12.1.3

References


[1] https://docs.wso2.com/display/ESB490/Configure+with+WebLogic
[2] https://blogs.oracle.com/soaproactive/entry/how_to_create_a_simple
[3] http://lasanthatechlog.blogspot.com/2013/06/integrating-wso2-esb-with-weblogic-as.html
[4] https://docs.oracle.com/cd/E12840_01/wls/docs103/client/jarbuilder.html



No comments:

Post a Comment