2 Replies Latest reply on Mar 18, 2010 1:26 PM by nie feng

    connect to Jboss Messaging queue remotely

    nie feng Newbie

      Hi all,

       

      I am trying to connect from Jboss4.2.2 (JBOSS MQ, act as jms client) to send the jms message to a queue deployed in JBOSS5.1 (Jboss Messaging, act as queue host). I have placed the "jboss-messaging-client.jar" in the JBOSS4.2.2 so that it can establish the connection to the queue in jboss5.

       

      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   = ConnectionFactory

       

      RemoteQueue JNDI Name

      queue/GtasNotificationReceiveQueue

       

      I encountered the following error

       

      Header 1
      [16:03:10-17:56:11,041][JMS SessionPool Worker-6][ERROR][APP.ALERT][003.001.006][JmsRetryListenerMDBean.invoke] Error occured while sending the jms msg: Wrong target. class org.jboss.jms.client.delegate.ClientConnectionFactoryDelegate for public org.jboss.jms.delegate.CreateConnectionResult org.jboss.jms.client.delegate.ClientConnectionFactoryDelegate.createConnectionDelegate(java.lang.String,java.lang.String,int) throws javax.jms.JMSException
      java.lang.IllegalArgumentException: Wrong target. class org.jboss.jms.client.delegate.ClientConnectionFactoryDelegate for public org.jboss.jms.delegate.CreateConnectionResult org.jboss.jms.client.delegate.ClientConnectionFactoryDelegate.createConnectionDelegate(java.lang.String,java.lang.String,int) throws javax.jms.JMSException
          at org.jboss.aop.joinpoint.MethodInvocation.handleErrors(MethodInvocation.java:141)
          at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:116)
          at org.jboss.jms.client.container.StateCreationAspect.handleCreateConnectionDelegate(StateCreationAspect.java:81)
          at org.jboss.aop.advice.org.jboss.jms.client.container.StateCreationAspect0.invoke(StateCreationAspect0.java)
          at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
          at org.jboss.jms.client.delegate.ClientConnectionFactoryDelegate.createConnectionDelegate(ClientConnectionFactoryDelegate.java)
          at org.jboss.jms.client.JBossConnectionFactory.createConnectionInternal(JBossConnectionFactory.java:205)
          at org.jboss.jms.client.JBossConnectionFactory.createConnection(JBossConnectionFactory.java:87)
          at org.jboss.jms.client.JBossConnectionFactory.createConnection(JBossConnectionFactory.java:82)

       

      Could i know why the above error will throw? It should not be due to the multiple ClientConnectionFactoryDelegate class with different version in the same classpath; (i have removed such class from the "jboss-messaging-client.jar", and when i create the connection, i encountered ClassNotFound Error)

       

      Thanks

      Niefeng

        • 1. Re: connect to Jboss Messaging queue remotely
          Yong Hao Gao Master

          In order to be able to talk to the JBM server, you not only need jboss-messaging-client.jar, but also some other jars like AOP, remoting, JGroups. Otherwise you are very likely to run into various issues.

          • 2. Re: connect to Jboss Messaging queue remotely
            nie feng Newbie

            Hi Yong Hao,

             

            Thanks for your reply. I follow the guide in section 4.4 Accessing JBoss Messaging from a remote client - JBoss 4.2 and EAP 4.3  from the Jboss Message User guide (http://labs.jboss.com/file-access/default/members/jbossmessaging/freezone/docs/userguide-1.4.3.GA/html/installation.html#inst.remoteclient,     Jboss5.1 is using Jboss Messaging 1.4.3 GA) to find out more detail on the list of jar you mentioned. .

             

            I listed down on the jar file i have copied to the directory of the jms client. It is under "jboss-4.2.2.GA\server\default\lib".

             

            trove.jar (version 1.0.2)

            javassist.jar (version 3.9.0 GA)

            jboss-aop.jar (version 2.0.1 GA)

             

            However i saw some deployment warning/error when i was starting up the Jboss4.2.2 GA.

             

            WARN
            [19:03:10-01:17:18,019] [ WARN:org.jboss.system.ServiceController] [main] Problem creating service jboss.aop:service=AspectManager
            java.lang.NoSuchFieldError: scopedCLHelper
                at org.jboss.aop.deployment.AspectManagerService.createService(AspectManagerService.java:143)
                at org.jboss.system.ServiceMBeanSupport.jbossInternalCreate(ServiceMBeanSupport.java:260)
                at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:243)
                at sun.reflect.GeneratedMethodAccessor3.invoke(Unknown Source)
                at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                at java.lang.reflect.Method.invoke(Method.java:592)
                at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
                at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
                at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
                at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
                at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
                at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:978)
                at $Proxy0.create(Unknown Source)

             

            Error
            [19:03:10-01:21:59,642] [ERROR:org.jboss.deployment.MainDeployer] [main] Could not create deployment: file:/D:/jboss-4.2.2.GA/server/default/deploy/ejb3-interceptors-aop.xml
            java.lang.NoClassDefFoundError: org/jboss/annotation/factory/ast/ParseException
                at org.jboss.aop.AspectXmlLoader.loadAnnotationIntroduction(AspectXmlLoader.java:816)
                at org.jboss.aop.AspectXmlLoader.deployAnnotationOverride(AspectXmlLoader.java:785)
                at org.jboss.aop.AspectXmlLoader.deployTopElements(AspectXmlLoader.java:1165)
                at org.jboss.aop.AspectXmlLoader.deployDomain(AspectXmlLoader.java:1055)
                at org.jboss.aop.AspectXmlLoader.deployTopElements(AspectXmlLoader.java:1173)
                at org.jboss.aop.AspectXmlLoader.deployXML(AspectXmlLoader.java:990)
                at org.jboss.aop.AspectXmlLoader.deploy(AspectXmlLoader.java:1333)
                at org.jboss.aop.AspectXmlLoader.deployXML(AspectXmlLoader.java:1378)
                at org.jboss.aop.AspectXmlLoader.deployXML(AspectXmlLoader.java:1363)
                at org.jboss.aop.deployment.AspectDeployer.create(AspectDeployer.java:177)
                at org.jboss.deployment.MainDeployer.create(MainDeployer.java:969)
                at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:818)
                at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:782)
                at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
                at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

             

            Could I know did i missing any configuration i need to do to avoid the above deploy error?

             

            You mentioned about the jboss remoting and also the jgroup, could i know which specify version should I use in my scenario (jboss4.2.2 GA)?

             

            Thanks for your help!


            Niefeng