4 Replies Latest reply on Feb 12, 2014 6:46 AM by Miroslav Novak

    Sending messages from Jboss 5 to AS7

    Sankalp Madaan Newbie

      Hi JBOSS Community, Here is my problem Scenario   

       

      Requirement: To send messages from application in JBoss 5 to Hornetq in AS7.

       

      I followed this documentation https://community.jboss.org/wiki/BridgeJMSMessagesFromAS5ToAS7 , created a local queue, used bridge.sar and was able to successfully push the message. But now we are trying to do that without using bridge.


      I searched in google and tried implementing remote jca example. I created hornetq-ra.rar and jms-remote-ds.xml in deploy folder of JBoss 5. When I tried pushing messages i got the following exception:


      javax.naming.NamingException: Failed to create remoting connection [Root exception is java.util.ServiceConfigurationError: org.xnio.XnioProvider: Provider org.xnio.nio.NioXnioProvider could not be instantiated: java.lang.NoSuchMethodError: org.jboss.logging.Logger.tracef(Ljava/lang/String;Ljava/lang/Object;)V]

          at org.jboss.naming.remote.client.ClientUtil.namingException(ClientUtil.java:36)

          at org.jboss.naming.remote.client.InitialContextFactory.getInitialContext(InitialContextFactory.java:121)

          at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:667)

          at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)

          at javax.naming.InitialContext.init(InitialContext.java:223)

          at javax.naming.InitialContext.<init>(InitialContext.java:197)

          at com.automatedOP.reportingservice.OwnerReportingService.runRepQueue(OwnerReportingService.java:117)

          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

          at java.lang.reflect.Method.invoke(Method.java:597)

          at org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:167)

          at org.jboss.resteasy.core.ResourceMethod.invokeOnTarget(ResourceMethod.java:257)

          at org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:222)

          at org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:211)

          at org.jboss.resteasy.core.SynchronousDispatcher.getResponse(SynchronousDispatcher.java:536)

          at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:513)

          at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:125)

          at org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:208)

          at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:55)

          at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:50)

          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:183)

          at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:95)

          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.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:599)

          at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:451)

          at java.lang.Thread.run(Thread.java:662)

      Caused by: java.util.ServiceConfigurationError: org.xnio.XnioProvider: Provider org.xnio.nio.NioXnioProvider could not be instantiated: java.lang.NoSuchMethodError: org.jboss.logging.Logger.tracef(Ljava/lang/String;Ljava/lang/Object;)V

          at java.util.ServiceLoader.fail(ServiceLoader.java:207)

          at java.util.ServiceLoader.access$100(ServiceLoader.java:164)

          at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:353)

          at java.util.ServiceLoader$1.next(ServiceLoader.java:421)

          at org.xnio.Xnio.doGetInstance(Xnio.java:187)

          at org.xnio.Xnio.getInstance(Xnio.java:146)

          at org.jboss.remoting3.Remoting.createEndpoint(Remoting.java:73)

          at org.jboss.naming.remote.client.EndpointCache.get(EndpointCache.java:44)

          at org.jboss.naming.remote.client.InitialContextFactory.createEndpoint(InitialContextFactory.java:193)

          at org.jboss.naming.remote.client.InitialContextFactory.getOrCreateEndpoint(InitialContextFactory.java:174)

          at org.jboss.naming.remote.client.InitialContextFactory.getOrCreateNamingStore(InitialContextFactory.java:138)

          at org.jboss.naming.remote.client.InitialContextFactory.getInitialContext(InitialContextFactory.java:104)

          ... 40 more

      Caused by: java.lang.NoSuchMethodError: org.jboss.logging.Logger.tracef(Ljava/lang/String;Ljava/lang/Object;)V

          at org.xnio.nio.NioXnio.<init>(NioXnio.java:76)

          at org.xnio.nio.NioXnioProvider.<clinit>(NioXnioProvider.java:34)

          at java.lang.Class.forName0(Native Method)

          at java.lang.Class.forName(Class.java:247)

       

       

      I copied jboss-client.jar from AS7 to Jboss 5 but still getting the same error. Please help me out how to proceed.

        • 1. Re: Sending messages from Jboss 5 to AS7
          Justin Bertram Master

          The problem here is that there are naming conflicts between JBoss Logging in AS 5.x and JBoss Logging in AS 7.x.  That's why the bridge described on https://community.jboss.org/docs/DOC-18594 must use an isolated classloader.

           

          To my knowledge, there is no way to make a JCA RA use an isolated classloader so you won't be able to use the HornetQ JCA RA to send messages from AS 5.x to AS 7.x.

          • 2. Re: Sending messages from Jboss 5 to AS7
            Sankalp Madaan Newbie

            Thanks Justin, for the quick reply. Can you suggest any way to send messages from Jboss 5.x to Jboss 6.x or AS7.x without using bridge?

            • 3. Re: Sending messages from Jboss 5 to AS7
              Justin Bertram Master

              You'd have to do it from your application and ensure your application was deployed using an isolated classloader.

              • 4. Re: Sending messages from Jboss 5 to AS7
                Miroslav Novak Master

                You can also deploy JMS bridge to AS7/Wildfly server which consumes messages from remote AS5 server. This feature was added in later AS 7 versions. Here is a piece of configuration for it:

                <subsystem xmlns="urn:jboss:domain:messaging:1.3">
                  <hornetq-server>
                  ...
                  </hornetq-server>
                  <jms-bridge name="myBridge" module="org.hornetq">
                  <source>
                  <connection-factory name="java:/ConnectionFactory"/>
                  <destination name="jms/queue/InQueue"/>
                  </source>
                  <target>
                  <connection-factory name="jms/RemoteConnectionFactory"/>
                  <destination name="jms/queue/OutQueue"/>
                  <context>
                  <property key="java.naming.factory.initial" value="org.jboss.naming.remote.client.InitialContextFactory"/>
                  <property key="java.naming.provider.url" value="remote://<IP_of_target_server>:4447"/>
                  </context>
                  </target>
                  <quality-of-service>ONCE_AND_ONLY_ONCE</quality-of-service>
                  <failure-retry-interval>1000</failure-retry-interval>
                  <max-retries>-1</max-retries>
                  <max-batch-size>10</max-batch-size>
                  <max-batch-time>100</max-batch-time>
                  <add-messageID-in-header>true</add-messageID-in-header>
                  </jms-bridge>
                  </subsystem>
                

                 

                When you change "target" jndi properties and provide module with EAP 5 "jndi" libraries then it'll work. Remember that used connection factories must be XA