3 Replies Latest reply on Mar 11, 2010 11:35 AM by Adrian Brock

    connect from JBoss MQ client to Jboss Messaging queue

    nie feng Newbie

      Hi all,

       

      I have encountered the following exception when i try to delegate a jms msg to a Jboss Messaging queue.

       

      18:03:11,053 ERROR [ALERT] [JmsRetryListenerMDBean.invoke] Error occured while s

      ending the jms msg: Destination is not an instance of SpyDestination JBossQueue[

      GtasNotificationReceiveQueue]

      javax.jms.InvalidDestinationException: Destination is not an instance of SpyDestination JBossQueue[GtasNotificationReceiveQueue]

              at org.jboss.mq.SpyMessageProducer.send(SpyMessageProducer.java:232)

              at org.jboss.mq.SpyMessageProducer.send(SpyMessageProducer.java:206)

       

       

      My JMS client is deployed in JBOSS4.2.2GA (it uses JBOSS MQ, in machine A) and the remote queue is deployed in JBOSS5.1GA (it uses JBOSS Messaging in machine B).

       

      Code snippet for the JMS Client

      JNDIFinder jndiFinder = new JNDIFinder(jmsDest.getLookupProperties());

       

      conn = createConnection(connFactory, jmsDest);
      session = createSession(conn, false, Session.AUTO_ACKNOWLEDGE);
      Destination dest = lookupDestination(jmsDest.getJndiName(), jndiFinder);
               
      producer = createProducer(session, dest);

      .......

      .......

      TextMessage textMsg = session.createTextMessage();

      ......

      ......

      producer.send(textMsg );

       

       

       

      The JNDI lookup and the connection factory JNDI used by the JMS client

      java.naming.provider.url=remoteHost:1099
      java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
      java.naming.factory.url.pkgs=org.jboss.naming

       

      connection factory JNDI name   = java:/ConnectionFactory

       

      RemoteQueue JNDI Name

      queue/GtasNotificationReceiveQueue

       

      Could I know what are the configuration i need to configure in JBOSS4.2.2 so that it can "talk" to the remote queue deploy in JBOSS5.1 GA?

       

      Thanks for your help

       

      Regards

      NieFeng

        • 1. Re: connect from JBoss MQ client to Jboss Messaging queue
          Adrian Brock Master

          You need to install the JBoss Messaging client code and look up its ConnectionFactory and destinations

          using remote jndi. See the FAQ and docs about configuring remote jndi providers.

           

          You certainly can't use java:/ConnectionFactory remotely. Nothing in java:/ works outside the server it is configured on.

          • 2. Re: connect from JBoss MQ client to Jboss Messaging queue
            nie feng Newbie

            Hi Adrian, thanks for the quick reply.

             

            I have made the following changes in the Jboss4.2.2 (Jboss MQ Client)

            1) add remote JNDI provider in deploy/jms/jms-ds.xml by following guide (http://community.jboss.org/wiki/HowDoIConfigureAnMDBToTalkToARemoteQueue)

            2) add jboss-messaging-client.jar under jboss-4.2.2.GA\server\default\lib

            3) use the new jndi name for the ConfigurationFactory defined in step 1.

             

            however i found out new exception occured in both client (JBOSS MQ) and server end (JBOSS Messaging).

             

            Error thrown in Client

            Header 1
            3:10-00:42:11,055] [ERROR:org.jboss.resource.adapter.jms.JmsSessionFactoryImpl] [JMS SessionPool Worker-7] could not create session
            org.jboss.resource.JBossResourceException: Unexpected throwable while trying to create a connection: null; - nested throwable: (java.lang.RuntimeException: Failed to download and/or install client side AOP stack)
                at org.jboss.resource.JBossResourceException.rethrowAsResourceException(JBossResourceException.java:61)
                at org.jboss.resource.connectionmanager.InternalManagedConnectionPool.getConnection(InternalManagedConnectionPool.java:293)
                at org.jboss.resource.connectionmanager.JBossManagedConnectionPool$BasePool.getConnection(JBossManagedConnectionPool.java:500)
                at org.jboss.resource.connectionmanager.BaseConnectionManager2.getManagedConnection(BaseConnectionManager2.java:341)
                at org.jboss.resource.connectionmanager.TxConnectionManager.getManagedConnection(TxConnectionManager.java:315)
                at org.jboss.resource.connectionmanager.BaseConnectionManager2.allocateConnection(BaseConnectionManager2.java:396)
                at org.jboss.resource.connectionmanager.BaseConnectionManager2$ConnectionManagerProxy.allocateConnection(BaseConnectionManager2.java:842)
                at org.jboss.resource.adapter.jms.JmsSessionFactoryImpl.allocateConnection(JmsSessionFactoryImpl.java:389)
                at org.jboss.resource.adapter.jms.JmsSessionFactoryImpl.createSession(JmsSessionFactoryImpl.java:369)

            ...................

            ...................

            Caused by: java.lang.RuntimeException: Failed to download and/or install client side AOP stack
                at org.jboss.jms.client.JBossConnectionFactory.createConnectionInternal(JBossConnectionFactory.java:199)
                at org.jboss.jms.client.JBossConnectionFactory.createXAConnection(JBossConnectionFactory.java:128)
                at org.jboss.jms.ConnectionFactoryHelper.createConnection(ConnectionFactoryHelper.java:78)
                at org.jboss.resource.adapter.jms.JmsManagedConnection.setup(JmsManagedConnection.java:743)
                at org.jboss.resource.adapter.jms.JmsManagedConnection.<init>(JmsManagedConnection.java:184)
                at org.jboss.resource.adapter.jms.JmsManagedConnectionFactory.createManagedConnection(JmsManagedConnectionFactory.java:106)
                at org.jboss.resource.connectionmanager.InternalManagedConnectionPool.createConnectionEventListener(InternalManagedConnectionPool.java:577)
                at org.jboss.resource.connectionmanager.InternalManagedConnectionPool.getConnection(InternalManagedConnectionPool.java:262)
                ... 36 more
            Caused by: org.jboss.jms.exception.MessagingNetworkFailureException
                at org.jboss.jms.client.delegate.DelegateSupport.handleThrowable(DelegateSupport.java:245)
                at org.jboss.jms.client.delegate.DelegateSupport.doInvoke(DelegateSupport.java:205)
                at org.jboss.jms.client.delegate.DelegateSupport.doInvoke(DelegateSupport.java:160)
                at org.jboss.jms.client.delegate.ClientConnectionFactoryDelegate.org$jboss$jms$client$delegate$ClientConnectionFactoryDelegate$getClientAOPStack$aop(ClientConnectionFactoryDelegate.java:237)
                at org.jboss.jms.client.delegate.ClientConnectionFactoryDelegate.getClientAOPStack(ClientConnectionFactoryDelegate.java)
                at org.jboss.jms.client.ClientAOPStackLoader.load(ClientAOPStackLoader.java:75)
                at org.jboss.jms.client.JBossConnectionFactory.createConnectionInternal(JBossConnectionFactory.java:192)
                ... 43 more
            Caused by: org.jboss.remoting.InvocationFailureException: Unable to perform invocation; nested exception is:
                java.io.EOFException
                at org.jboss.remoting.transport.socket.SocketClientInvoker.handleException(SocketClientInvoker.java:142)
                at org.jboss.remoting.transport.socket.MicroSocketClientInvoker.transport(MicroSocketClientInvoker.java:901)
                at org.jboss.remoting.transport.bisocket.BisocketClientInvoker.transport(BisocketClientInvoker.java:426)
                at org.jboss.remoting.MicroRemoteClientInvoker.invoke(MicroRemoteClientInvoker.java:165)
                at org.jboss.remoting.Client.invoke(Client.java:1724)
                at org.jboss.remoting.Client.invoke(Client.java:629)
                at org.jboss.remoting.Client.invoke(Client.java:617)
                at org.jboss.jms.client.delegate.DelegateSupport.doInvoke(DelegateSupport.java:189)
                ... 48 more
            Caused by: java.io.EOFException
                at java.io.DataInputStream.readInt(DataInputStream.java:358)
                at org.jboss.jms.wireformat.JMSWireFormat.read(JMSWireFormat.java:288)
                at org.jboss.remoting.transport.socket.MicroSocketClientInvoker.versionedRead(MicroSocketClientInvoker.java:1222)
                at org.jboss.remoting.transport.socket.MicroSocketClientInvoker.transport(MicroSocketClientInvoker.java:850)
                ... 54 more

             

            Error thrown in Jboss Messaging host

            Header 1
            2010-03-11 00:42:11,039 ERROR [org.jboss.remoting.transport.socket.ServerThread] (WorkerThread#0[127.0.0.1:4963]) WorkerThread#0[127.0.0.1:4963] exception occurred during first invocation
            java.io.IOException: Can not read data for version 0.  Supported versions: 1,2,22
                at org.jboss.remoting.transport.socket.ServerThread.versionedRead(ServerThread.java:863)
                at org.jboss.remoting.transport.socket.ServerThread.completeInvocation(ServerThread.java:707)
                at org.jboss.remoting.transport.socket.ServerThread.processInvocation(ServerThread.java:697)
                at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:524)
                at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:232)

             

            Could I know what can be the possible cause of the above error? I read from the forum discussion thread (http://community.jboss.org/message/368507#368507) mentioning it may due to the version of jboss-remoting.jar is different; hence i copied the jboss-remoting.jar from the Jboss5.1 to Jboss422. however, the above error still occured.

             

             

            I included the changes i make in the jboss4.2.2 jms-ds.xml in the following section

            Header 1

              <mbean code="org.jboss.jms.jndi.JMSProviderLoader" name="jboss.mq:service=JMSProviderLoader,name=RemoteMQProvider,server=OASISJBOSS">
                <attribute name="ProviderName">OasisJmsProvider</attrib
                <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=remoteHost:1099
                </attribute>
              </mbean>

             

             

              <!-- jms test connect to remote provider -->
              <tx-connection-factory>
                <jndi-name>oasisConnectionFactory</jndi-name> <!-- My new connection factory JNDI -->
                <xa-transaction/>
                <rar-name>jms-ra.rar</rar-name>
                <connection-definition>org.jboss.resource.adapter.jms.JmsConnectionFactory</connection-definition>
                <adapter-display-name>JMS Adapter</adapter-display-name>
                <config-property name="SessionDefaultType" type="java.lang.String">javax.jms.Topic</config-property>
                <config-property name="JmsProviderAdapterJNDI" type="java.lang.String">java:/OasisJmsProvider</config-property>
                <security-domain-and-application>OasisJmsXARealm</security-domain-and-application>
              </tx-connection-factory>

             

            Thanks,

             

            Niefeng.

            • 3. Re: connect from JBoss MQ client to Jboss Messaging queue
              Adrian Brock Master

              Ask your question in the jboss messaging forum, it is their client code.

              You are using the correct client code now though.

              Most likely you have some classes missing?