1 2 Previous Next 26 Replies Latest reply on Mar 12, 2012 12:00 PM by Justin Bertram

    Cannot connect MDB to remote HornetQ server

    Dimitris Andreadis Master

      Posting this on behalf of one of our Early Access users - dimitris

       

      I am trying to connect an MDB to a queue on a remote HornetQ server. In AS 6, this could be done by configuring a Netty connector factory in jms-ra.rar/META-INF/ra.xml, but how can we do this on EAP 6 / AS 7?

       

      The best solution would be to configure this in standalone.xml, but I was not able to make this work. An alternative is to deploy our own resource adapter. We tried to package jms-ra.rar from AS 6 into a rar file and deploy it in AS 7. This deployed without errors, but we could not use this resource adapter from our MDB. Then we tried to place the rar file in the EAR, but this gave the following error:

       

      12:57:48,506 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-1) MSC00001: Failed to start service jboss.deployment.subunit."casino_integrationEAR.ear"."casino_integration2.jar".component.CasinoIntegrationExample3.CREATE: org.jboss.msc.service.StartException in service jboss.deployment.subunit."casino_integrationEAR.ear"."casino_integration2.jar".component.CasinoIntegrationExample3.CREATE: Failed to start service
      at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1786)
      at org.jboss.msc.service.ServiceControllerImpl$ClearTCCLTask.run(ServiceControllerImpl.java:2291)
      at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [:1.6.0_26]
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [:1.6.0_26]
      at java.lang.Thread.run(Thread.java:662) [:1.6.0_26]
      Caused by: java.lang.IllegalStateException: No resource adapter registered with resource adapter name jms-ra
      at org.jboss.as.ejb3.component.EJBUtilities.createActivationSpecs(EJBUtilities.java:115)
      at org.jboss.as.ejb3.component.messagedriven.MessageDrivenComponentCreateService.createComponent(MessageDrivenComponentCreateService.java:76)
      at org.jboss.as.ee.component.BasicComponentCreateService.start(BasicComponentCreateService.java:78)
      at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1765)
      ... 4 more

       

      I have also tried this in the AS 7 nightly build #1732. First I got another error (see below), then I tried to remove jboss-beans.xml from jms-ra.rar/netty.jar, but then I got the same error as above.

       

       

      15:29:44,885 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-1) Starting deployment of "jms-ra.rar"

      15:29:45,422 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-4) MSC00001: Failed to start service jboss.deployment.unit."jms-ra.rar".PARSE: org.jboss.msc.service.StartException in service jboss.deployment.unit."jms-ra.rar".PARSE: Failed to process phase PARSE of deployment "jms-ra.rar"

                                   at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:121) [jboss-as-server-7.1.0.Alpha2-SNAPSHOT.jar:7.1.0.Alpha2-SNAPSHOT]

                                   at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1824) [jboss-msc-1.0.1.GA.jar:1.0.1.GA]

                                   at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1759) [jboss-msc-1.0.1.GA.jar:1.0.1.GA]

                                   at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [:1.6.0_26]

                                   at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [:1.6.0_26]

                                   at java.lang.Thread.run(Thread.java:662) [:1.6.0_26] Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: Failed to parse POJO xml ["/C:/Users/lars.hoidahl/Desktop/jboss-as-7.1.0.Alpha2-SNAPSHOT/bin/content/jms-ra.rar/netty.jar/META-INF/jboss-beans.xml"]

                                   at org.jboss.as.pojo.KernelDeploymentParsingProcessor.parseDescriptor(KernelDeploymentParsingProcessor.java:146)

                                   at org.jboss.as.pojo.KernelDeploymentParsingProcessor.parseDescriptors(KernelDeploymentParsingProcessor.java:120)

                                   at org.jboss.as.pojo.KernelDeploymentParsingProcessor.deploy(KernelDeploymentParsingProcessor.java:78)

                                   at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:115) [jboss-as-server-7.1.0.Alpha2-SNAPSHOT.jar:7.1.0.Alpha2-SNAPSHOT]

                                   ... 5 more

      Caused by: javax.xml.stream.XMLStreamException: ParseError at [row,col]:[17,1]

      Message: Unexpected element '{urn:jboss:bean-deployer:2.0}deployment'

                                   at org.jboss.staxmapper.XMLMapperImpl.processNested(XMLMapperImpl.java:98)

                                   at org.jboss.staxmapper.XMLMapperImpl.parseDocument(XMLMapperImpl.java:59)

                                   at org.jboss.as.pojo.KernelDeploymentParsingProcessor.parseDescriptor(KernelDeploymentParsingProcessor.java:139)

                                   ... 8 more

        • 1. Re: Cannot connect MDB to remote HornetQ server
          Ales Justin Master

          He's trying to deploy a AS6 deployment, which also includes MC -jboss-beans.xml descriptor files.

           

          While we did port most of the MC/POJO functionality,

          we couldn't directly re-use old xml mapping, hence new namespace,

          but similar POJO functionality.

          • 2. Re: Cannot connect MDB to remote HornetQ server
            Ales Justin Master

            I have also tried this in the AS 7 nightly build #1732. First I got another error (see below), then I tried to remove jboss-beans.xml from jms-ra.rar/netty.jar, but then I got the same error as above.

            He can try to migrate the xml to new namespace.

            * https://github.com/danbev/migrate/tree/master/mcbeans

             

            We don't have 100% coverage of the old mapping yet.

            (it's probably gonna be ~99% at the end)

            Hence he might not be able to do it.

            But if he gives us feedback, we/I will make that missing POJO feature(s) a priority.

            • 3. Re: Cannot connect MDB to remote HornetQ server
              Carlo de Wolf Master

              This is all fairly silly.

               

              For one: any descriptor that has "urn:jboss:bean-deployer:2.0" is actually meant for 'another' application server (AS6). So we should just ignore it.

               

              Secondly, netty 'needs' this to configure up its logging system. The usage of jboss-logging needs no bridge over MC.

               

              https://github.com/netty/netty/blob/master/src/main/resources/META-INF/jboss-beans.xml

              https://github.com/netty/netty/blob/master/src/main/java/org/jboss/netty/container/microcontainer/NettyLoggerConfigurator.java

              • 5. Re: Cannot connect MDB to remote HornetQ server
                Carlo de Wolf Master

                java.lang.IllegalStateException: No resource adapter registered with resource adapter name jms-ra

                is cause by a race condition between RaXmlDeploymentProcessor.deploy and RaAdd.execute.

                 

                The resourceadapters service should just be installed lazily in the ResourceAdaptersExtension.

                • 6. Re: Cannot connect MDB to remote HornetQ server
                  Carlo de Wolf Master

                  Using an AS build from https://github.com/wolfc/jboss-as/commits/AS7-2130.

                   

                  To get around the netty issue, start with a clean rar containing:

                  • hornetq-core-client.jar
                  • hornetq-jms.jar
                  • hornetq-ra.jar

                   

                  And add a dependency on org.jboss.netty module in MANIFEST.MF:

                  Dependencies: org.jboss.netty

                   

                  Next JCA will (silently!) ignore any rar that does not have a proper deployment descriptor for IronJacamar:

                  $ cat /tmp/external-hornetq-ra.rar/META-INF/ironjacamar.xml 
                  <?xml version="1.0" encoding="UTF-8"?>
                  <!-- TODO: bug in Iron Jacamar: it doesn't deploy without metadata -->
                  <ironjacamar>
                     <connection-definitions>
                        <connection-definition jndi-name="java:/JmsXA"
                           class-name="org.hornetq.ra.HornetQRAManagedConnectionFactory"/>
                     </connection-definitions>
                  </ironjacamar>
                  

                   

                  Do not forget to config the netty connector in ra.xml and you should end up with a message:

                  17:33:50,635 INFO  [org.jboss.as.connector.deployers.RADeployer] (MSC service thread 1-11) IJ020002: Deployed: file:/home/carlo/work/jboss-as/build/target/jboss-as-7.1.0.Alpha2-SNAPSHOT/standalone/deployments/external-hornetq-ra.rar/
                  17:33:50,637 INFO  [org.jboss.as.deployment.connector] (MSC service thread 1-14) JBAS010401: Bound JCA ConnectionFactory [java:/ExternalHQ]
                  17:33:50,666 INFO  [org.jboss.as.server.controller] (DeploymentScanner-threads - 2) Deployed "external-hornetq-ra.rar"
                  
                  • 7. Re: Cannot connect MDB to remote HornetQ server
                    Jason Greene Master

                    All you should have to do is change the pooled connection factory to use a netty configuration like so:

                     

                     

                    <pooled-connection-factory name="hornetq-ra"> 
                             <transaction mode="xa"/> 
                             <connectors> 
                                     <connector-ref connector-name="netty"/> 
                             </connectors> 
                             <entries> 
                                    <entry name="java:/JmsXA"/> 
                             </entries> 
                     </pooled-connection-factory> 
                    
                    

                     

                    Then make sure the netty configuration points to the correct hornetq server.

                    • 8. Re: Cannot connect MDB to remote HornetQ server
                      Jason Greene Master

                      Jason Greene wrote:

                       

                      All you should have to do is change the pooled connection factory to use a netty configuration like so:

                       

                       

                      <pooled-connection-factory name="hornetq-ra"> 
                               <transaction mode="xa"/> 
                               <connectors> 
                                       <connector-ref connector-name="netty"/> 
                               </connectors> 
                               <entries> 
                                      <entry name="java:/JmsXA"/> 
                               </entries> 
                       </pooled-connection-factory> 
                      
                      

                       

                      Then make sure the netty configuration points to the correct hornetq server.

                       

                      Althought this solution, due to a major limitation with socket bindings that we intend to fix shortly, only works if the interface of hte hq process is on the same system as the AS7 instance. We will fix this but in the meantime you can use the separate rar workaround.

                      • 9. Re: Cannot connect MDB to remote HornetQ server
                        lars-ho Newbie

                        Thanks, this rar worked. Looking forward to the fix with socket bindings.

                        • 10. Re: Cannot connect MDB to remote HornetQ server
                          Jesper Pedersen Master

                          All configuration of messaging components using the resource adapter should be done in the messaging subsystem and be using the internal JCA services. Aka Jason's post.

                          • 11. Re: Cannot connect MDB to remote HornetQ server
                            lars-ho Newbie

                            I have tried that, but couldn't get it to work, even between 2 JBoss AS'es on the same physical machine.

                             

                            I tried the following configuration in standalone.xml:

                             

                            <pooled-connection-factory name="hornetq-ra">
                                     <transaction mode="xa"/>
                                     <connectors>
                                             <connector-ref connector-name="netty"/>
                                     </connectors>
                                     <entries>
                                            <entry name="java:/JmsXA"/>
                                     </entries>
                            </pooled-connection-factory>

                            (as Jason described)

                             

                             

                            <netty-acceptor name="netty" socket-binding="messaging"/>

                            <netty-connector name="netty" socket-binding="messaging"/>

                            (same as the default configuration)

                             

                            and

                                <interfaces>

                                    <interface name="remotehornetq">

                                        <inet-address value="myserver.com"/>

                                    </interface>

                             

                            ...

                            <socket-binding name="messaging" interface="remotehornetq" port="5445"/>

                             

                            Am I missing something?

                             

                            Edit: "host" -> "interface"

                            • 12. Re: Cannot connect MDB to remote HornetQ server
                              Ravi Singhal Newbie

                              I am also trying to connect MDBs to remote JMS Server (both running on JBoss AS7 instance on different machines). Can you point me how to configure it?

                               

                              Thanks in advance!!

                              • 13. Re: Cannot connect MDB to remote HornetQ server
                                Justin Bertram Master

                                In general, connecting an MDB to a remote HornetQ server requires modifying the MDB's activation configuration properties, e.g.:

                                 

                                  @MessageDriven(name = "MyMDB", activationConfig = {

                                        @ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue"),

                                        @ActivationConfigProperty(propertyName = "destination", propertyValue = "testQueue"),

                                        @ActivationConfigProperty(propertyName = "connectorClassName", propertyValue = "org.hornetq.core.remoting.impl.netty.NettyConnectorFactory"),

                                        @ActivationConfigProperty(propertyName = "connectionParameters", propertyValue = "host=192.168.1.137;port=5445")})

                                 

                                Documentation on this can be found here.

                                • 14. Re: Cannot connect MDB to remote HornetQ server
                                  Ravi Singhal Newbie

                                  Thanks Justin,

                                   

                                  I am  also trying to do JNDI lookup from one JBoss Instance to remote JMS Server (JBoss 7 AS). In some other forum you mentioned that use pooled-connection-factory and change in-vm connector to netty and then configure netty connector to point to remote JMS Server. I am bit confused how to configure netty connector. In standalone_full.xml, we have socket-binding which uses public interface so it means it points to the same JBoss instance. I tried definining "param" element with host and port properties like following but that also did not work:

                                   

                                  <netty-connector name="netty" socket-binding="messaging">

                                              <param key="host" value="remote-jms-server"/>

                                              <param key="port" value="5445"/>

                                  </netty-connector>

                                   

                                  I tried outbound socket binding like this but that is also not working:

                                   

                                    <outbound-socket-binding name="remote-jms">

                                              <remote-destination host="remote-jms-server" port="4447"/>

                                     </outbound-socket-binding>

                                   

                                  Can you please tell me how to configure it in standalone.xml. Also do we need to change anything(acceptor) on remote JMS Server standalone-full.xml?

                                  1 2 Previous Next