8 Replies Latest reply on Nov 4, 2009 5:44 AM by Tim Fox

    Sending messages from jboss to other application server(webs

    mariqn nenchev Novice

      Hi, I have a system deployed on jboss AS. It uses jms messaging for many things. Now i need to send JMS messages to other system, that uses websphere AS. Is it possible jboss to make bridge with websphere and how?
      If not how to do it? I read about servicemix, but things are not very clear.
      I also tried to bridge 2 separate(running on different machines) jboss servers. I added this in my service.xml in my ear (SQUEUE is source queue, and DQUEUE is destination queue - DQUEUE is declared in JS_HOME/server/all/deploy/messaging/destinations-service.xml):

      <mbean code="org.jboss.jms.server.destination.QueueService"
       name="jboss.messaging.destination:service=Queue,name=SQUEUE"
       xmbean-dd="xmdesc/Queue-xmbean.xml">
       <attribute name="JNDIName">queue/SQUEUE
       </attribute>
       <depends optional-attribute-name="ServerPeer">
       jboss.messaging:service=ServerPeer</depends>
       <depends>jboss.messaging:service=PostOffice
       </depends>
       <attribute name="Clustered">true</attribute>
       </mbean>
      
       <mbean code="org.jboss.jms.server.bridge.BridgeService"
       name="jboss.messaging:service=Bridge,name=TestBridge"
       xmbean-dd="xmdesc/Bridge-xmbean.xml">
      
       <!-- The JMS provider loader that is used to lookup the source destination -->
       <depends optional-attribute-name="SourceProviderLoader">jboss.messaging:service=JMSProviderLoader,name=JMSProvider</depends>
      
       <!-- The JMS provider loader that is used to lookup the target destination -->
       <depends optional-attribute-name="TargetProviderLoader">jboss.messaging:service=JMSProviderLoader,name=RemoteJMSProvider</depends>
      
       <!-- The JNDI lookup for the source destination -->
       <attribute name="SourceDestinationLookup">/queue/SQUEUE</attribute>
      
       <!-- The JNDI lookup for the target destination -->
       <attribute name="TargetDestinationLookup">jnp://192.168.2.104:1099/queue/DQUEUE</attribute>
      
       <!-- The username to use for the source connection
       <attribute name="SourceUsername">bob</attribute>
       -->
      
       <!-- The password to use for the source connection
       <attribute name="SourcePassword">cheesecake</attribute>
       -->
      
       <!-- The username to use for the target connection
       <attribute name="TargetUsername">mary</attribute>
       -->
      
       <!-- The password to use for the target connection
       <attribute name="TargetPassword">hotdog</attribute>
       -->
      
       <!-- Optional: The Quality Of Service mode to use, one of:
       QOS_AT_MOST_ONCE = 0;
       QOS_DUPLICATES_OK = 1;
       QOS_ONCE_AND_ONLY_ONCE = 2; -->
       <attribute name="QualityOfServiceMode">0</attribute>
      
       <!-- JMS selector to use for consuming messages from the source
       <attribute name="Selector">specify jms selector here</attribute>
       -->
      
       <!-- The maximum number of messages to consume from the source before sending to the target -->
       <attribute name="MaxBatchSize">1</attribute>
      
       <!-- The maximum time to wait (in ms) before sending a batch to the target even if MaxBatchSize is not exceeded.
       -1 means wait forever -->
       <attribute name="MaxBatchTime">-1</attribute>
      
       <!-- If consuming from a durable subscription this is the subscription name
       <attribute name="SubName">mysub</attribute>
       -->
      
       <!-- If consuming from a durable subscription this is the client ID to use
       <attribute name="ClientID">myClientID</attribute>
       -->
      
       <!-- The number of ms to wait between connection retrues in the event connections to source or target fail -->
       <attribute name="FailureRetryInterval">5000</attribute>
      
       <!-- The maximum number of connection retries to make in case of failure, before giving up
       -1 means try forever-->
       <attribute name="MaxRetries">-1</attribute>
      
       </mbean>
      


      As you can see i am using RemoteJMSProvider. I do not know if this is correct, but i added the following code in my JB_HOME/server/all/deploy/messaging/jms-ds.xml :
       <mbean code="org.jboss.jms.jndi.JMSProviderLoader"
       name="jboss.jms:service=JMSProviderLoader,name=RemoteJMSProvider">
       <attribute name="ProviderName">RemoteJMSProvider</attribute>
       <attribute name="ProviderAdapterClass">org.jboss.jms.jndi.JNDIProviderAdapter</attribute>
       <attribute name="FactoryRef">XAConnectionFactory</attribute>
       <attribute name="QueueFactoryRef">XAConnectionFactory</attribute>
       <attribute name="TopicFactoryRef">XAConnectionFactory</attribute>
       <attribute name="Properties">
       java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
       java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
       java.naming.provider.url=192.168.2.104:1099
       </attribute>
       </mbean>
      


      But, nothing happen, i receive error that this jmsprovider could not be created. If i use JMSProvider for the DQUEUE i get DQUEUE is not bound(it is declared in the second(destination) jboss).
      So, how can i send messages to other AS (websphere).
      Regards.

        • 1. Re: Sending messages from jboss to other application server(
          mariqn nenchev Novice

          My bad, It is weblogic NOT websphere. :)

          • 2. Re: Sending messages from jboss to other application server(
            Yong Hao Gao Master

            Did you run JBM's bridge example successfully? If so, all you need to do is pretty much the configuration of JMSProviders. You need to install the JMS JCA adapter for your other server (weblogic) in JBoss.

            • 3. Re: Sending messages from jboss to other application server(
              Tim Fox Master

              The JMS bridge does not require a JCA adaptor to connect to the source or target systems - it just uses the standard JMS API, so just requires the normal JMS client libraries.

              • 4. Re: Sending messages from jboss to other application server(
                mariqn nenchev Novice

                HI, thanks for the response. Actually the other server will be websphere as i first said. I found some tutorial
                on IBM:
                http://www.ibm.com/developerworks/websphere/library/techarticles/0710_ritchie/0710_ritchie.html
                and
                on JBOSS:
                http://209.85.135.132/search?q=cache:KyhQ6p2pV6oJ:www.jboss.org/community/docs/DOC-12536+jboss+websphere+jms+messaging&cd=7&hl=bg&ct=clnk&gl=bg&client=firefox-a
                I am trying the one from ibm and i installed test server and WMQ. After that I deployed the RAR and wmq.jmsra-ds.xml:

                <?xml version="1.0" encoding="UTF-8"?>
                
                <connection-factories>
                 <!-- connection factory definition -->
                 <tx-connection-factory>
                
                 <jndi-name>IVTCF</jndi-name>
                 <xa-transaction />
                 <rar-name>wmq.jmsra.rar</rar-name>
                
                 <connection-definition>
                 javax.jms.ConnectionFactory
                 </connection-definition>
                
                 <config-property name="channel" type="java.lang.String">
                 SYSTEM.DEF.SVRCONN
                 </config-property>
                 <config-property name="hostName" type="java.lang.String">
                 localhost
                 </config-property>
                 <config-property name="port" type="java.lang.String">
                 1414
                 </config-property>
                 <config-property name="queueManager" type="java.lang.String">
                 ExampleQM
                 </config-property>
                 <config-property name="transportType" type="java.lang.String">
                 CLIENT
                 </config-property>
                
                 <security-domain-and-application>JmsXARealm</security-domain-and-application>
                 </tx-connection-factory>
                
                 <!-- admin object definition -->
                 <mbean code="org.jboss.resource.deployment.AdminObject"
                 name="jca.wmq:name=ivtqueue">
                
                 <attribute name="JNDIName">
                 IVTQueue
                 </attribute>
                 <depends optional-attribute-name="RARName">
                 jboss.jca:service=RARDeployment,name='wmq.jmsra.rar'
                 </depends>
                 <attribute name="Type">javax.jms.Queue</attribute>
                
                 <attribute name="Properties">
                 baseQueueManagerName=ExampleQM
                 baseQueueName=SYSTEM.DEFAULT.LOCAL.QUEUE
                 </attribute>
                 </mbean>
                </connection-factories>
                


                But when i try to run some IVT i get
                javax.resource.ResourceException: MQJCA1012:Failed to create a JMS connection factory.
                 at com.ibm.mq.connector.services.JCAExceptionBuilder.buildException(JCAExceptionBuilder.java:101)
                 at com.ibm.mq.connector.outbound.ManagedConnectionFactoryImpl.createConnection(ManagedConnectionFactoryImpl.java:331)
                 at com.ibm.mq.connector.outbound.ManagedConnectionImpl.<init>(ManagedConnectionImpl.java:108)
                 at com.ibm.mq.connector.outbound.ManagedConnectionFactoryImpl.createManagedConnection(ManagedConnectionFactoryImpl.java:144)
                 at org.jboss.resource.connectionmanager.InternalManagedConnectionPool.createConnectionEventListener(InternalManagedConnectionPool.java:633)
                 at org.jboss.resource.connectionmanager.InternalManagedConnectionPool.getConnection(InternalManagedConnectionPool.java:267)
                 at org.jboss.resource.connectionmanager.JBossManagedConnectionPool$BasePool.getConnection(JBossManagedConnectionPool.java:622)
                 at org.jboss.resource.connectionmanager.BaseConnectionManager2.getManagedConnection(BaseConnectionManager2.java:404)
                 at org.jboss.resource.connectionmanager.TxConnectionManager.getManagedConnection(TxConnectionManager.java:381)
                 at org.jboss.resource.connectionmanager.BaseConnectionManager2.allocateConnection(BaseConnectionManager2.java:496)
                 at org.jboss.resource.connectionmanager.BaseConnectionManager2$ConnectionManagerProxy.allocateConnection(BaseConnectionManager2.java:941)
                 at com.ibm.mq.connector.outbound.ConnectionFactoryImpl.createManagedJMSConnection(ConnectionFactoryImpl.java:174)
                 at com.ibm.mq.connector.outbound.ConnectionFactoryImpl.createConnectionInternal(ConnectionFactoryImpl.java:133)
                 at com.ibm.mq.connector.outbound.ConnectionFactoryImpl.createConnection(ConnectionFactoryImpl.java:118)
                 at com.ibm.mq.connector.outbound.ConnectionFactoryImpl.createConnection(ConnectionFactoryImpl.java:103)
                 at IVT.doGet(IVT.java:290)
                 at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
                 at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
                 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
                 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                 at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
                 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
                 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                 at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:235)
                 at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
                 at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:190)
                 at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:92)
                 at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.process(SecurityContextEstablishmentValve.java:126)
                 at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:70)
                 at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
                 at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
                 at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158)
                 at org.jboss.web.tomcat.service.sso.ClusteredSingleSignOn.invoke(ClusteredSingleSignOn.java:672)
                 at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
                 at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:330)
                 at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:829)
                 at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:598)
                 at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
                 at java.lang.Thread.run(Thread.java:619)
                Caused by: javax.jms.JMSException: MQJMS1006: invalid value for channel:
                 SYSTEM.DEF.SVRCONN
                
                 at com.ibm.mq.jms.services.ConfigEnvironment.newException(ConfigEnvironment.java:634)
                 at com.ibm.mq.jms.MQConnectionFactory.setChannel(MQConnectionFactory.java:1788)
                 at com.ibm.mq.connector.ConnectionFactoryBuilder.createConnectionFactory(ConnectionFactoryBuilder.java:240)
                 at com.ibm.mq.connector.outbound.ManagedConnectionFactoryImpl.createConnectionFactory(ManagedConnectionFactoryImpl.java:363)
                 at com.ibm.mq.connector.outbound.ManagedConnectionFactoryImpl.createConnection(ManagedConnectionFactoryImpl.java:327)
                 ... 37 more
                


                Any ideas what to do next? Seems that this wmq.jmsra-ds.xml does not create this JMS channel(i never used any channels for jms with jboss!). Am i doing something wrong?
                Regards.

                • 5. Re: Sending messages from jboss to other application server(
                  mariqn nenchev Novice

                  NOTE: The wmq.jmsra.rar (the RAR) and wmq.jmsra-ds.xml are deployed on jboss 5.1.0GA and i got the RAR from webshpere 6.1

                  • 6. Re: Sending messages from jboss to other application server(
                    Yong Hao Gao Master

                    Hi,

                    As Tim said the JCA layer is not needed for a bridge to work.

                    Sorry I gave you the wrong info.

                    Howard

                    • 7. Re: Sending messages from jboss to other application server(
                      mariqn nenchev Novice

                      Up to now no success with this. I want just to send messages to websphere server. The people that develop the application using websphere gave me
                      queue.manager.name=...
                      queue.manager.host=...
                      queue.manager.port=...
                      queue.manager.channel=...
                      queuename=...

                      And told me to send messages there. How to do it no idea.
                      I tried this configuration:

                      <?xml version="1.0" encoding="UTF-8"?>
                      
                      <connection-factories>
                      
                       <!-- connection factory definition -->
                       <tx-connection-factory>
                       <jndi-name>TESTCF</jndi-name>
                       <xa-transaction />
                       <rar-name>wmq.jmsra.rar</rar-name>
                       <connection-definition>javax.jms.ConnectionFactory</connection-definition>
                       <config-property name="channel" type="java.lang.String">TEST.CHANNEL</config-property>
                       <config-property name="hostName" type="java.lang.String">192.168.2.100</config-property>
                       <config-property name="port" type="java.lang.String">1414</config-property>
                       <config-property name="queueManager" type="java.lang.String">TESTQM</config-property>
                       <config-property name="transportType" type="java.lang.String">CLIENT</config-property>
                       <security-domain-and-application>JmsXARealm</security-domain-and-application>
                       </tx-connection-factory>
                      
                       <!-- admin object definition -->
                       <mbean code="org.jboss.resource.deployment.AdminObject" name="jca.wmq:name=testqueue">
                       <attribute name="JNDIName">testqueue</attribute>
                       <depends optional-attribute-name="RARName">
                       jboss.jca:service=RARDeployment,name='wmq.jmsra.rar'
                       </depends>
                       <attribute name="Type">javax.jms.Queue</attribute>
                       <attribute name="Properties">
                       baseQueueManagerName=TESTQM
                       baseQueueName=testqueue
                       expiry=EXP_UNLIMITED
                       </attribute>
                       </mbean>
                      </connection-factories>
                      


                      It is deployed, but when i attempt to send message the QueueConnectionFactory lookup returns me ConnectionFactoryImpl
                      and so it throws classcastexception
                      Error:
                      java.lang.ClassCastException: com.ibm.mq.connector.outbound.ConnectionFactoryImpl cannot be cast to javax.jms.QueueConnectionFactory




                      • 8. Re: Sending messages from jboss to other application server(
                        Tim Fox Master

                        Like we have already said - *you are posting on the wrong forum*.

                        Sending messages to WSMQ is not something that is done by JBoss Messaging.

                        Configuring JBoss AS to talk to WSMQ is configured at the JCA adapter - so *please post on the JCA user forum*.

                        The JCA adaptor is a completely different module to JBoss Messaging!!