4 Replies Latest reply on May 22, 2017 2:48 PM by Justin Bertram

    NettyAcceptorFactory.createAcceptor error

    niranjan kumar Newbie

      I am trying to connect to HornetQconsumer from HornetQProducer.Doing it on local machine later reproduce the same on remote machines.

      I am new to JMS i have some questions regarding HornetQ JMS implementation

       

      1: Is it correct if i use  two HornetQ servers ,one will work with Producer and remote server will work with Consumer.

      2: can i use embedded configuration to achieve this or i am doing it wrong ,

      3: Can i use the bridge configuration any side i want or it has to be on client side or server side.

       

      if i am using all these things correctly then why am getting this error:

       

      INFO: Connecting bridge my-bridge to its destination

      Well, you seems to doing something wrong. Please check if config files are in your classes folder.

      java.lang.AbstractMethodError: org.hornetq.core.remoting.impl.netty.NettyAcceptorFactory.createAcceptor(Ljava/util/Map;Lorg/hornetq/spi/core/remoting/BufferHandler;Lorg/hornetq/spi/core/remoting/ConnectionLifeCycleListener;Ljava/util/concurrent/Executor;Ljava/util/concurrent/ScheduledExecutorService;)Lorg/hornetq/spi/core/remoting/Acceptor;

          at org.hornetq.core.remoting.server.impl.RemotingServiceImpl.start(RemotingServiceImpl.java:162)

          at org.hornetq.core.server.impl.HornetQServerImpl.start(HornetQServerImpl.java:306)

          at org.hornetq.jms.server.impl.JMSServerManagerImpl.start(JMSServerManagerImpl.java:179)

          at com.touchtech.EmbeddedServerDemoP.startServer(EmbeddedServerDemoP.java:37)

          at com.touchtech.EmbeddedServerDemoP.main(EmbeddedServerDemoP.java:17)

      May 17, 2017 12:51:59 AM org.hornetq.core.logging.impl.JULLogDelegate warn

      WARNING: Bridge my-bridge is unable to connect to destination. It will be disabled.

      HornetQException[errorCode=0 message=Failed to create session]

          at org.hornetq.core.client.impl.FailoverManagerImpl.createSession(FailoverManagerImpl.java:455)

          at org.hornetq.core.client.impl.ClientSessionFactoryImpl.createSessionInternal(ClientSessionFactoryImpl.java:1063)

          at org.hornetq.core.client.impl.ClientSessionFactoryImpl.createSession(ClientSessionFactoryImpl.java:790)

          at org.hornetq.core.server.cluster.impl.BridgeImpl.createObjects(BridgeImpl.java:666)

          at org.hornetq.core.server.cluster.impl.BridgeImpl.access$800(BridgeImpl.java:64)

          at org.hornetq.core.server.cluster.impl.BridgeImpl$CreateObjectsRunnable.run(BridgeImpl.java:779)

          at org.hornetq.utils.OrderedExecutorFactory$OrderedExecutor$1.run(OrderedExecutorFactory.java:96)

          at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)

          at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)

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

      Caused by: java.lang.NoSuchMethodError: org.hornetq.utils.HornetQThreadFactory.<init>(Ljava/lang/String;ZLjava/lang/ClassLoader;)V

          at org.hornetq.core.remoting.impl.netty.NettyConnector.start(NettyConnector.java:413)

          at org.hornetq.core.client.impl.FailoverManagerImpl.getConnection(FailoverManagerImpl.java:919)

          at org.hornetq.core.client.impl.FailoverManagerImpl.getConnectionWithRetry(FailoverManagerImpl.java:802)

          at org.hornetq.core.client.impl.FailoverManagerImpl.createSession(FailoverManagerImpl.java:332)

          ... 9 more

       

      Lastly i was using above approach as this below dint work for me:

      Please help , as i have read Chapter 36. Core Bridges but the bridge example works with servers server0 and server1 defined using some directory path in maven

                     <execution>

                        <id>start0</id>

                        <goals>

                           <goal>start</goal>

                        </goals>

                        <configuration>

                           <hornetqConfigurationDir>${basedir}/target/classes/hornetq/server0</hornetqConfigurationDir>

                        </configuration>

                     </execution>

       

      how to change this configuration or simply how to detach the two configurations from one pom two two remote poms

        • 1. Re: NettyAcceptorFactory.createAcceptor error
          Justin Bertram Master

          1: Is it correct if i use two HornetQ servers ,one will work with Producer and remote server will work with Consumer.

          Whether or not this configuration is "correct" depends on your use-case.  Typically one would use a single broker and both producers and consumers would connect to it.  If you only have producers connecting to one and consumers connecting to another then one broker will eventually fill up with unconsumed messages and the consumers will starve unless you have a mechanism to move messages from one broker to the other.

           

          2: can i use embedded configuration to achieve this or i am doing it wrong ,

          You can embed any configuration you want.  Again, whether or not this is "wrong" depends on your use-case.

           

          3: Can i use the bridge configuration any side i want or it has to be on client side or server side.

          A bridge is a server-side component so it's always on the server-side.  To be clear, bridges can only "push" messages from a queue to an address (i.e. they cannot "pull" messages) so that restricts where they can feasibly run.

           

          if i am using all these things correctly then why am getting this error

          Typically AbstractMethodErrors like this indicate you're using libraries from different versions. 

           

          how to change this configuration or simply how to detach the two configurations from one pom two two remote poms

          The examples shipped in HornetQ use a custom Maven plugin called "hornetq-maven-plugin".  This plugin creates/starts/stops broker instances and runs the example class as well.  It's not really meant for production use.  If you want to start a broker just start it using the provided startup scripts.  You don't need to use Maven.

           

          In any event, there are around 100 examples shipped with HornetQ demonstrating all kinds of things from single broker to clustered, multi-broker use-cases.  You should be able to find what you need in one of them to take and adapt to your use-case.

          • 2. Re: NettyAcceptorFactory.createAcceptor error
            Justin Bertram Master

            One more thing...

             

            I would strongly recommend you migrate to Apache ActiveMQ Artemis.  We donated the HornetQ code-base to Apache ActiveMQ a few years ago and have carried on development there as the Artemis broker.  Development on HornetQ stopped then as you may have noticed there haven't been any HornetQ releases in a few years.

            • 3. Re: NettyAcceptorFactory.createAcceptor error
              niranjan kumar Newbie
              HI

               

                 Thanks for replying with info but it confused me more. As i had seen examples/pictures of bridge  https://dzone.com/articles/hornetq-getting-started  configuration where one HornetQ server is being connected to Remote HornetQ server , so How only one message broker will fullfill that condition , (i am considering one hornetq server as one broker ,i may be wrong ) as i will quote you "Typically one would use a single broker and both producers and consumers would connect to it " , I am using one HornetQ server running on say Machine A "host:5445" as Producer which will put the message onto sausage-factory queue

               

                     <queue name="jms.queue.sausage-factory">
                       <address>jms.queue.sausage-factory</address>
                    </queue>

               

              As bridge is configured to put the message from this Local Queue to remote Queue jms.queue.mincing-machine :
                   <bridges>
                         ....
                           <queue-name>jms.queue.sausage-factory</queue-name>
                            <forwarding-address>jms.queue.mincing-machine</forwarding-address>
                          ...
                  </bridges>

               

              Messages will be sent to that address using this remote Configuration at hots:5446:

               

                     <connector name="remote-connector">
                           <factory-class>org.hornetq.core.remoting.impl.netty.NettyConnectorFactory</factory-class>
                           <param key="host"  value="${hornetq.remoting.netty.host:hostName}"/>
                           <param key="port"  value="${hornetq.remoting.netty.port:5446}"/>
                      </connector>
              all the above configuration is on Machine A inside : hornetq-2.4.0.Final\config\stand-alone\non-clustered in hornetq-configuration.xml

               

              I am using other HornetQ server on Different machine Say MachineB running on host:5446 :

               

                   <connector name="netty">
                       <factory-class>org.hornetq.core.remoting.impl.netty.NettyConnectorFactory</factory-class>
                       <param key="host"  value="${hornetq.remoting.netty.host:localhost}"/>
                       <param key="port"  value="${hornetq.remoting.netty.port:5446}"/>
                    </connector>

               

               

              Defining the Queue in hornetq-jms.xml file :

               

                  <queue name="mincing-machine">
                    <entry name="/queue/mincing-machine"/>
                 </queue>

               

               

              So I am thinking my configuration is correct as per Bridge Diagrams https://dzone.com/articles/hornetq-getting-started

              Here Clearly Bridge configuration can be seen in producer Side of Message . So I have kept the producer and sausage-factory Queue configuration on Producer Side Which is machine A.

               

              IS my basic concept need to be corrected?

               

              attaching first 3 files which was changed for this configuration... on machine A host:5445 and next 3  for machine B remote-host:5446,Files may contain the host configurations i was trying

              but i want to ask if the idea was correct?

              • 4. Re: NettyAcceptorFactory.createAcceptor error
                Justin Bertram Master

                You didn't really explain your use-case in your original comment so I was just commenting on the normal producer-consumer pattern with a single broker. 

                 

                If you need two brokers with a bridge moving messages between them then by all means follow the configuration provided in the bridge example shipped with the broker.  Everything you need should be there, and if you follow the same pattern then your "concept" should be "correct".

                 

                Of course, that doesn't explain why you're getting NoSuchMethodError.  I still believe you're probably mixing libraries from different versions of the broker.