Pages

Wednesday, June 13, 2012

WebLogic JMS / AQ bridge with JBoss AS 7

There are different ways to exchange JMS messages between WebLogic and JBoss Application Server 7. In this blogpost I will explain how you can retrieve JMS messages from JBoss ( with the help of a WebLogic Foreign Server ) and how to push messages to JBoss AS ( with the help of a WebLogic JMS Bridge). This even works with AQ.

For JBoss AS 7 I will use the JMS ( HornetQ ) / JBoss configuration which I already explained in this blogpost. On the WebLogic side I will use WebLogic 11gR1 PS5 or version 10.3.6.

Before we start we need to add the jboss / hornetq jars to the lib folder of your domain. Use jboss-client.jar from the bin/client jboss folder and we need to download the lates HornetQ libraries ( hornetq-2.2.14.Final) . Use the hornetq-jms-client.jar from the HornetQ lib folder.

The best way to retrieve JMS messages from JBoss AS 7 is using a WebLogic Foreign Server. In the current version of JBoss 7.1.1 it is not possible to setup bridging in the console or in one of the instances xml's.

Create a Foreign Server in a JMS module and use default targetting or target this to a WebLogic server

JNDI Initial Contect Factory is org.jboss.naming.remote.client.InitialContextFactory
JNDI Connection URL is remote://yourJbossServer:4447
Provide the remote password
In the JNDI properties add the remote username  java.naming.security.principal=xxxxx


Provide the Remote JNDI name of the Queue.


Provide the remote JNDI name of the JBoss Connection Factory -> jms/RemoteConnectionFactory


Now you deploy a MDB or a OSB process which listens on the local JNDI CF and Queue.


Second part is setting up a JMS bridge between WebLogic and JBoss. This way local messages in a local JMS or AQ Queue can be pushed to JBoss AS.

First we need to deploy two resource adapters jms-notran-adp and jms-xa-adp these rar files are located at the wlserver_10.3\server\lib. Deploy them as application and target them to the right weblogic servers.

Add a JMS Bridge Destination ( JBoss AS), this configuration is almost the same as the JBoss Foreign Server configuration.
Only choose eis/jms/WLSConnectionFactoryJNDIXA as Adapter JNDI Name.


The JMS Bridge Source ( WebLogic side )


Add a Bridge where we select the Destination and Source. Important, use Atmost-once for Quality of Service. Exactly once won't work.

Enable the started checkbox.


Add some messages to the WebLogic Queue and see if it delivered to JBoss.

Last part is to use Oracle Database AQ as source for this JMS bridge. For all the information, how to setup AQ on WebLogic see this excellent Oracle Documentation.

Create a Foreign Server, target this to a WebLogic server and use oracle.jms.AQjmsInitialContextFactory as JNDI Initial Context Factory also add a JNDI property with the JDBC datasource as value.


Add the AQ Queue name with its local WebLogic JNDI name.


Also define the Connection Factory.

And here the matching JMS bridge source which will work on the AQ Foreign server.


Happy messaging.

13 comments:

  1. This comment has been removed by a blog administrator.

    ReplyDelete
  2. Hi, I am trying almost same configuration. Weblogic 10.3.5 <-> jboss 7.1.2 ( hornetq 2.2.16). But I am getting an exception,

    << eis/jms/WLSConnectionFactoryJNDIXA > ResourceAllocationException thrown by resource adapter on call to ManagedConnectionFactory.createManagedConnection(): "javax.resource.ResourceException: Failed to start the connection ">
    Sep 7, 2012 1:13:59 PM org.jboss.naming.remote.protocol.v1.RemoteNamingStoreV1$MessageReceiver handleEnd
    ERROR: Channel end notification received, closing channel Channel ID c5670a81 (outbound) of Remoting connection 28d72e3f to localhost/127.0.0.1:7447
    Sep 7, 2012 1:13:59 PM org.jboss.naming.remote.protocol.v1.RemoteNamingStoreV1$MessageReceiver handleEnd
    ERROR: Channel end notification received, closing channel Channel ID 893bf1c3 (outbound) of Remoting connection 4d0abc94 to localhost/127.0.0.1:7447
    Sep 7, 2012 1:13:59 PM org.hornetq.core.logging.impl.JULLogDelegate error
    SEVERE: Failed to decode
    java.lang.IllegalArgumentException: Invalid type: 0
    at org.hornetq.core.protocol.core.impl.PacketDecoder.decode(PacketDecoder.java:550)
    at org.hornetq.core.protocol.core.impl.RemotingConnectionImpl.bufferReceived(RemotingConnectionImpl.java:479)
    at org.hornetq.core.client.impl.ClientSessionFactoryImpl$DelegatingBufferHandler.bufferReceived(ClientSessionFactoryImpl.java:1543)
    at org.hornetq.core.remoting.impl.netty.HornetQChannelHandler.messageReceived(HornetQChannelHandler.java:73)
    at org.jboss.netty.channel.SimpleChannelHandler.handleUpstream(SimpleChannelHandler.java:100)
    at org.jboss.netty.channel.StaticChannelPipeline.sendUpstream(StaticChannelPipeline.java:372)
    at org.jboss.netty.channel.StaticChannelPipeline$StaticChannelHandlerContext.sendUpstream(StaticChannelPipeline.java:534)
    at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:287)
    at org.hornetq.core.remoting.impl.netty.HornetQFrameDecoder2.decode(HornetQFrameDecoder2.java:169)
    at org.hornetq.core.remoting.impl.netty.HornetQFrameDecoder2.messageReceived(HornetQFrameDecoder2.java:134)
    at org.jboss.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:80)
    at org.jboss.netty.channel.StaticChannelPipeline.sendUpstream(StaticChannelPipeline.java:372)
    at org.jboss.netty.channel.StaticChannelPipeline.sendUpstream(StaticChannelPipeline.java:367)
    at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:274)
    at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:261)
    at org.jboss.netty.channel.socket.oio.OioWorker.run(OioWorker.java:100)
    at org.jboss.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:108)
    at org.jboss.netty.util.internal.DeadLockProofWorker$1.run(DeadLockProofWorker.java:44)
    at org.jboss.netty.util.VirtualExecutorService$ChildExecutorRunnable.run(VirtualExecutorService.java:181)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
    at java.lang.Thread.run(Thread.java:619)

    Do you have any idea what could be wrong?

    Thanks
    Reddy

    ReplyDelete
    Replies
    1. Hi,

      can you check if you have the ip adress on the jboss public , unsecure and admin interfaces ( standalone.xml) , else it will only listen on the localhost.

      also XA won't work outside jboss

      thanks

      Delete
  3. Hi Edwin,

    I am running weblogic and jboss on localhost. I have the ip address 127.0.0.1 on my standalone.xml management, public and unsecure. RemoteConnectionFactory has netty connector which has socket binding of messaging 7445, remoting has 7447, which is default configuration. In your example, they are 5445 and 4447 respectively.


    Reddy

    ReplyDelete
    Replies
    1. Hi,

      Do you also have in the socket binding group , besides messaging and remoting also messaging throughput.
      and try if changing the jboss localhost parameter to your network ip, see if that helps.

      your port numbers are not default ones in jboss 7 . can you change it to 5445 for msg , 5455 msg throughput and remoting to 4447.
      this guy got the same error with a wrong port number https://community.jboss.org/thread/203529

      thanks

      Delete
  4. Hi Edwin,

    Thanks for the input. It was my mistake, I had looked up the wrong standalone xml, where netty socket binding was modified for EJB remote call testing.

    Now, the bridge successfully pushes messages from Weblogic to Jboss, if I post to Weblogic queue. But, other way, it seems not working. I just reversed Bridge configuration of Source Bridge Destination -> "JMS Bridge Destination" and Target Bridge Destination -> "JMS Bridge Source". Should it work with automatically or anything more needs to be done?

    Thanks
    Reddy

    ReplyDelete
    Replies
    1. Hi,
      Don't know if that can work. The best way is to Push it from jboss but this bridge is not yet supported in jboss 7.1 .
      But what works is to add a foreign server in WebLogic which connects to jboss and add the remote queue plus connection factory.
      This foreign server has the same config settings as the bridge.
      Now you can use the local jndi of the queue and cf

      Good luck

      Delete
  5. Thank you very much Edwin for the input. We are actually fighting to make some sort of solution working with jboss 7.1.2 and weblogic 10.3.5. We need two way bridge.

    If I understand correctly, weblogic is only making outbound connections with jboss remoting. and Jboss is accepting these connections. I will try to make outbound connection from jboss to weblogic. I did it from jboss 7 to jboss 4 with a sar module. will give you feedback if it works.

    Thanks
    Reddy

    ReplyDelete
    Replies
    1. Hi,

      Let me know if it works, I know with jboss 5 it worked but now with hornetq in jboss7 there are not ready with finishing all the old features.

      Delete
  6. Edwin - what's your take on Pubsubhub for publishing data?

    https://code.google.com/p/pubsubhubbub/

    Looking at the web it appears that its mostly used for content feed (mostly used by google) and its mostly used by the web sites/blog to publish/pull content

    do you recommend Pubsubhub for business systems communication? i.e. use Pubsubhub to send Oracle XML from Siebel to peoplesoft instead of JMS

    ReplyDelete
    Replies
    1. Hi,

      it is not the industry standard, so always use WS-RM or JMS, else it will get you in big problems when something goes wrong or if it is not so reliable. until something else will be the industry standard.

      thanks

      Delete
  7. Hi Edwin,
    We have the same scenario as above. In our scenario, WLS will consume message from WAS. WAS JMS was configured as a foreign server in WLS JMS. We are getting "org.omg.CORBA.TRANSIENT: initial and forwarded IOR inaccessible vmcid: 0x4942f000 minor code: 3591 completed: No" error. All the required JAR files are added in the class path.

    ReplyDelete
  8. Hi Edwin Biemond,

    I have tried the First Option(Connecting to jboss AS7 using Weblogic Foreign Server), but i'm facing the below error in JNDI tree of osb server.

    This page displays details about this bound object.
    Failed to create remoting connection.

    Please check and do needful.

    Regards,
    Narendra

    ReplyDelete