9 Replies Latest reply on Feb 9, 2011 9:21 AM by totoranky

    Can't connect to remote hornetQ destinations from mdb

    totoranky

      Hi all,

       

      I have a standalone hornetq jms provider running.

      Then I have two mdb deployed on a JBoss 4 server. When I start my JBoss 4 server I always have this exception

       

      javax.naming.CommunicationException: Could not obtain connection to any of these urls: 10.3.100.102:1499 and discovery failed with error: javax.naming.CommunicationException

       

       

      My HornetQ server is listenning on 1499 for JNDI.

      In my mdb I put a JBoss.xml file where I indicate the resource adpater like that :

      <message-driven>
               <ejb-name>MyBeanTest</ejb-name>                      
               <destination-jndi-name>/queue/queueTest</destination-jndi-name>
               <configuration-name>Standard Message Driven Bean</configuration-name

               <resource-adapter-name>hornetq-ra.rar</resource-adapter-name>

      </message-driven>

       

       

      My hornetQ and JBoss as are running on the same computer. I deploy on JBoss a single client which just post and read a single message on the remote hornetQ server and it works. So I think my mdb require something but I can't see what is it. I tried all I have found on the web but always have the same starting JBoss error.

       

       

      Thanks for your help.

        • 1. Can't connect to remote hornetQ destinations from mdb
          clebert.suconic

          There's an example showing how to do that

          • 2. Can't connect to remote hornetQ destinations from mdb
            totoranky

            In my standalone hornetQ, in the hornetq-configuration.xml I forgot to put in connector and acceptor my IP machine instead of localhost

            <connector name="netty">

                     <factory-class>org.hornetq.integration.transports.netty.NettyConnectorFactory</factory-class>

                     <param key="host"  value="ip_here"/>

                     <param key="port"  value="${hornetq.remoting.netty.port:5445}"/>

                  </connector>

            Now my JBoss starts, hornetQ also but my mdb don't consume messages, I posted with  a standalone java class and my mdb don't move. I am wondering if they are listening to my destinations

            • 3. Can't connect to remote hornetQ destinations from mdb
              clebert.suconic

              Did you look at the example I told you? you have to change the connector's properties.

              • 4. Can't connect to remote hornetQ destinations from mdb
                257980

                Resource adapter by default is configured to make use of INVM connection. INVm is used only when both client & server are running in same JVM.

                In order to connect to a remote HornetQ server use netty connection.

                 

                Follow the below steps.

                 

                unzip the hornetq-ra.rar

                 

                under META-INF folder you will find ra.xml with the below configuration

                 

                Just replace INVM configuration with netty

                 

                <config-property>

                 

                         <description>The transport type</description>

                 

                         <config-property-name>ConnectorClassName</config-property-name>

                 

                         <config-property-type>java.lang.String</config-property-type>

                 

                         <config-property-value>org.hornetq.core.remoting.impl.invm.InVMConnectorFactory</config-property-value>

                 

                      </config-property>

                 

                      <config-property>

                         <description>The transport configuration. These values must be in the form of key=val;key=val;</description>

                 

                         <config-property-name>ConnectionParameters</config-property-name>

                 

                         <config-property-type>java.lang.String</config-property-type>

                 

                         <config-property-value>server-id=0</config-property-value>

                 

                      </config-property>

                 

                replace the above configuration with this

                 

                <config-property>

                 

                         <description>The transport type</description>

                 

                         <config-property-name>ConnectorClassName</config-property-name>

                 

                         <config-property-type>java.lang.String</config-property-type>

                 

                         <config-property-value>org.hornetq.integration.transports.netty.NettyConnectorFactory</config-property-value>

                 

                      </config-property>

                 

                      <config-property>

                         <description>The transport configuration. These values must be in the form of key=val;key=val;</description>

                 

                         <config-property-name>ConnectionParameters</config-property-name>

                 

                         <config-property-type>java.lang.String</config-property-type>

                 

                         <config-property-value>host=172.18.10.7;port=5445</config-property-value>

                 

                      </config-property>

                 

                Where host is the hostname or ipaddress of the remote machine where your hornetQ is running.

                port is the Netty Acceptor port number.

                 

                Once after making the change recreate the hornetq-ra.rar archive file.

                 

                Netty port number can be identified by looking in to hornetq-configuration.xml

                It looks something like this.

                 

                <acceptor name="netty">

                         <factory-class>org.hornetq.core.remoting.impl.netty.NettyAcceptorFactory</factory-class>

                         <param key="host"  value="${jboss.bind.address:localhost}"/>

                         <param key="port"  value="${hornetq.remoting.netty.port:5445}"/>

                      </acceptor>

                 

                Please let me know if you still face any issues after trying this configuration change.

                • 5. Can't connect to remote hornetQ destinations from mdb
                  clebert.suconic

                  That's the thirs time I ask... and you answer me with random configuration.

                   

                  Did you actually look at the example?

                   

                   

                  I don't want to go over something you can easily find on the documentation. Let me know if you have any specific questions beyond the documentation.

                  • 6. Can't connect to remote hornetQ destinations from mdb
                    clebert.suconic

                    examples/javaee/jca-remote

                    • 7. Can't connect to remote hornetQ destinations from mdb
                      totoranky

                      First of all, thanks for your help everybody.

                       

                       

                      Clebert Suconic a écrit:

                       

                      That's the thirs time I ask... and you answer me with random configuration.


                      The third time it was not me but another forum member who replies. And yes I have seen examples BUT never this one because

                      I didn't know netty was a JCA connector. Actually, when I look jca-config example (and not jca-remote for my 2.0.0 hornetq server),

                      they explain how to configure resource adapter global properties.

                      It's exactly Ravisankar Challa proposition. I did it and my configuration works now !!!!!

                      So thank you Ravisankar Challa to lead me on right way, it's exactly the information  I needed

                      • 8. Can't connect to remote hornetQ destinations from mdb
                        clebert.suconic

                        "The third time it was not me but another forum member who replies"

                         

                        oops... sorry about that guys. I looked quickly at the forums in a sunday night and answered quicly.  Thanks Ravisankar for helping on the answer.... My apologies guys.

                         

                         

                        "I didn't know netty was a JCA connector."

                         

                         

                        the JCA is using the same remoting mechanism used by the client.

                        • 9. Can't connect to remote hornetQ destinations from mdb
                          totoranky

                          Is it possible to have the file ra.xml outside from hornetq-ra.xml in deploy directory as -ds file ?

                           

                          I ask this information because if you move your hornetq server, you must unzip your rar file to edit ra.xml file

                          to put your new ip, it's not useful.

                          Maybe hornetq-ra.xml is totally "independent" and all its configuration must be inside the rar file.

                           

                          Why do we need to put these same information (host and netty port) in our hornetq-ds.xml file where we defined

                          our ProviderName :

                          <mbean code="org.jboss.jms.jndi.JMSProviderLoader" name="hornetq:service=JMSProviderLoader,name=JMSProvider">

                              <attribute name="ProviderName">DefaultJMSProvider</attribute>

                              <attribute name="ProviderAdapterClass">org.jboss.jms.jndi.JNDIProviderAdapter</attribute>

                              <!-- The combined connection factory -->

                              <attribute name="FactoryRef">java:/XAConnectionFactory</attribute>

                              <!-- The queue connection factory -->

                              <attribute name="QueueFactoryRef">java:/XAConnectionFactory</attribute>

                              <!-- The topic factory -->

                              <attribute name="TopicFactoryRef">java:/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=jnp://10.1.100.1:1499       

                              </attribute>

                          </mbean>

                           

                          <tx-connection-factory>

                              <jndi-name>JmsXA</jndi-name>

                              <rar-name>hornetq-ra.rar</rar-name>

                              <xa-transaction/>

                              <connection-definition>org.hornetq.ra.HornetQRAConnectionFactory</connection-definition>

                              <config-property name="SessionDefaultType" type="java.lang.String">javax.jms.Queue</config-property>

                              <config-property name="JmsProviderAdapterJNDI" type="java.lang.String">java:/DefaultJMSProvider</config-property>

                              <config-property name="ConnectorClassName" type="java.lang.String">org.hornetq.integration.transports.netty.NettyConnectorFactory</config-property>

                              <max-pool-size>20</max-pool-size>

                              <!-- Netty connector acces on remote hornetQ server (defined in hornetQ's hornetq-configuration.xml file) -->

                              <config-property name="ConnectionParameters" type="java.lang.String">host=10.1.100.1;port=5445</config-property>

                            </tx-connection-factory>

                           

                          Lines  java.naming.provider.url=jnp://10.1.100.1:1499 and

                          <config-property name="ConnectionParameters" type="java.lang.String">host=10.1.100.1;port=5445</config-property>

                          seem to be duplicate information with the ra.xml file configuration.

                           

                          Personally I tried to comment this data in my hornetq-ds.xml file and it sounds to work but I am not sure I am right.

                           

                          Thanks for your help