10 Replies Latest reply on Sep 23, 2015 10:06 PM by Eric Fulton

    HornetQ won't start in Wildfly (netty)

    Eric Fulton Newbie

         I've been trying to figure this out for eight hours now.  This is a wildfly 8.2.1 cluster and I'm trying to enable netty messaging.  I want to be able to connect with a remote client, but right now, the server isn't even listening to the port.  Can anyone see something wrong with this config?

       

       

       

                  <subsystem xmlns="urn:jboss:domain:messaging:2.0">

                      <hornetq-server>

                          <cluster-password>xxxxx</cluster-password>

                          <journal-file-size>102400</journal-file-size>

       

       

                          <connectors>

                              <http-connector name="http-connector" socket-binding="http">

                                  <param key="http-upgrade-endpoint" value="http-acceptor"/>

                              </http-connector>

                              <http-connector name="http-connector-throughput" socket-binding="http">

                                  <param key="http-upgrade-endpoint" value="http-acceptor-throughput"/>

                                  <param key="batch-delay" value="50"/>

                              </http-connector>

                              <in-vm-connector name="in-vm" server-id="0"/>

                              <connector name="netty-throughput">

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

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

                                  <param key="batch-delay" value="50"/>

                              </connector>

                              <connector name="netty">

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

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

                              </connector>

                          </connectors>

       

       

                          <acceptors>

                              <http-acceptor http-listener="default" name="http-acceptor"/>

                              <http-acceptor http-listener="default" name="http-acceptor-throughput">

                                  <param key="batch-delay" value="50"/>

                                  <param key="direct-deliver" value="false"/>

                              </http-acceptor>

                              <in-vm-acceptor name="in-vm" server-id="0"/>

                              <acceptor name="netty">

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

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

                              </acceptor>

                              <acceptor name="netty-throughput">

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

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

                                  <param key="batch-delay" value="50"/>

                                  <param key="direct-deliver" value="false"/>

                              </acceptor>

                          </acceptors>

       

       

                          <broadcast-groups>

                              <broadcast-group name="bg-group1">

                                  <socket-binding>messaging-group</socket-binding>

                                  <connector-ref>

                                      http-connector

                                  </connector-ref>

                              </broadcast-group>

                          </broadcast-groups>

       

       

                          <discovery-groups>

                              <discovery-group name="dg-group1">

                                  <socket-binding>messaging-group</socket-binding>

                              </discovery-group>

                          </discovery-groups>

       

       

                          <cluster-connections>

                              <cluster-connection name="my-cluster">

                                  <address>jms</address>

                                  <connector-ref>netty</connector-ref>

                                  <retry-interval>500</retry-interval>

                                  <forward-when-no-consumers>false</forward-when-no-consumers>

                                  <max-hops>1</max-hops>

                                  <discovery-group-ref discovery-group-name="dg-group1"/>

                              </cluster-connection>

                          </cluster-connections>

       

       

                          <security-settings>

                              <security-setting match="#">

                                  <permission type="send" roles="guest"/>

                                  <permission type="consume" roles="guest"/>

                                  <permission type="createNonDurableQueue" roles="guest"/>

                                  <permission type="deleteNonDurableQueue" roles="guest"/>

                              </security-setting>

                          </security-settings>

       

       

                          <address-settings>

                              <address-setting match="#">

                                  <dead-letter-address>jms.queue.DLQ</dead-letter-address>

                                  <expiry-address>jms.queue.ExpiryQueue</expiry-address>

                                  <max-size-bytes>10485760</max-size-bytes>

                                  <page-size-bytes>2097152</page-size-bytes>

                                  <message-counter-history-day-limit>10</message-counter-history-day-limit>

                                  <redistribution-delay>1000</redistribution-delay>

                              </address-setting>

                          </address-settings>

       

       

                          <jms-connection-factories>

                              <connection-factory name="InVmConnectionFactory">

                                  <connectors>

                                      <connector-ref connector-name="in-vm"/>

                                  </connectors>

                                  <entries>

                                      <entry name="java:/ConnectionFactory"/>

                                  </entries>

                              </connection-factory>

                              <connection-factory name="RemoteConnectionFactory">

                                  <connectors>

                                      <connector-ref connector-name="http-connector"/>

                                  </connectors>

                                  <entries>

                                      <entry name="java:jboss/exported/jms/RemoteConnectionFactory"/>

                                  </entries>

                                  <ha>true</ha>

                                  <block-on-acknowledge>true</block-on-acknowledge>

                                  <reconnect-attempts>-1</reconnect-attempts>

                              </connection-factory>

                              <pooled-connection-factory name="hornetq-ra">

                                  <transaction mode="xa"/>

                                  <connectors>

                                      <connector-ref connector-name="in-vm"/>

                                  </connectors>

                                  <entries>

                                      <entry name="java:/JmsXA"/>

                                      <entry name="java:jboss/DefaultJMSConnectionFactory"/>

                                  </entries>

                              </pooled-connection-factory>

                          </jms-connection-factories>

       

       

                          <jms-destinations>

                              <jms-queue name="ExpiryQueue">

                                  <entry name="java:/jms/queue/ExpiryQueue"/>

                              </jms-queue>

                              <jms-queue name="DLQ">

                                  <entry name="java:/jms/queue/DLQ"/>

                              </jms-queue>

                              <jms-queue name="portal.domain.entity.refresh">

                                  <entry name="queue/portal.domain.entity.refresh"/>

                                  <entry name="java:jboss/exported/jms/queue/sillyq"/>

                              </jms-queue>

                          </jms-destinations>

                      </hornetq-server>

                  </subsystem>

        • 1. Re: HornetQ won't start in Wildfly (netty)
          Andrew Schmidt Newbie

          Can you confirm that you are listening on a public ip?    Not 127.0.0.1

          • 2. Re: HornetQ won't start in Wildfly (netty)
            Justin Bertram Master

            Netty messaging is already enabled.  It is enabled by default.  When a client connects to the "http-acceptor" the connection goes through a special http upgrade where it becomes a "normal" Netty connection.  You don't need to manually configure any additional connector/acceptor.

            • 3. Re: HornetQ won't start in Wildfly (netty)
              Eric Fulton Newbie

              <interface name="public">

                 <any-address/>

              </interface>

               

               

              This is the interface i'm using.  Is this ok?

              • 4. Re: HornetQ won't start in Wildfly (netty)
                Eric Fulton Newbie

                If that is the case then why, in the hornetq documentation, is the acceptor section demonstrating how to setup netty acceptors/connectors:

                HornetQ User Manual

                 

                This is how i'm configuring my client:

                 

                @Bean
                JmsListenerContainerFactory<?> jmsListenerContainerFactory() {

                  DefaultJmsListenerContainerFactory factory = new DefaultJmsListenerContainerFactory();

                  factory.setConnectionFactory(hornetQConnectionFactory());

                  return factory;

                }

                 

                @Bean
                HornetQConnectionFactory hornetQConnectionFactory() {

                  Map<String, Object> hornetAddress = new HashMap<String, Object>(){{

                  put(TransportConstants.HOST_PROP_NAME, "<address>");

                  put(TransportConstants.PORT_PROP_NAME, <port>);

                  }};

                  TransportConfiguration configuration = new TransportConfiguration(

                  NettyConnectorFactory.class.getName(), hornetAddress);

                  return HornetQJMSClient.createConnectionFactoryWithoutHA(JMSFactoryType.CF, configuration);

                }

                 

                @Bean
                JmsTemplate jmsTemplate() {

                  JmsTemplate jmsTemplate = new JmsTemplate();

                  jmsTemplate.setDefaultDestination(new HornetQQueue("<queue>"));

                  jmsTemplate.setConnectionFactory(hornetQConnectionFactory());

                  return jmsTemplate;

                }

                 

                Are you suggesting I need to remove the netty acceptor configuration and change the port here to 80? 

                • 5. Re: HornetQ won't start in Wildfly (netty)
                  Eric Fulton Newbie

                  Looks like the configuration actually did work.  The port just didn't open on the domain controller and the nodes had to be restarted for the configuration to register.

                  • 6. Re: HornetQ won't start in Wildfly (netty)
                    Justin Bertram Master

                    If that is the case then why, in the hornetq documentation, is the acceptor section demonstrating how to setup netty acceptors/connectors:

                    HornetQ User Manual

                    The HornetQ User Manual details the configuration for standalone HornetQ.  I doesn't address HornetQ configuration within Wildfly.  As you may have noticed, there are some differences.

                     

                    Are you suggesting I need to remove the netty acceptor configuration and change the port here to 80? 

                    You'd need to change the port number your client uses to wherever the server is listening for HTTP connections.  If the server is listening for HTTP connections on port 80 then the client should use port 80.

                     

                    Also, you would need to set the TransportConstants.HTTP_UPGRADE_ENABLED_PROP_NAME to true on the client as well.

                    • 7. Re: HornetQ won't start in Wildfly (netty)
                      Justin Bertram Master

                      Looks like the configuration actually did work.

                      I didn't see anything wrong with the configuration technically speaking.  My point was that it was simply unnecessary assuming you are able to update your clients.  If you have legacy clients that still need to use the old ports then I would recommend you configure the connectors/acceptors this way:

                       

                          <profile>
                             ...
                              <subsystem xmlns="urn:jboss:domain:messaging:1.4">
                                  <hornetq-server>
                                      ...
                                      <connectors>
                                          <netty-connector name="netty" socket-binding="messaging"/>
                                          <netty-connector name="netty-throughput" socket-binding="messaging-throughput">
                                              <param key="batch-delay" value="50"/>
                                          </netty-connector>
                                          ...
                                      </connectors>
                                      <acceptors>
                                          <netty-acceptor name="netty" socket-binding="messaging"/>
                                          <netty-acceptor name="netty-throughput" socket-binding="messaging-throughput">
                                              <param key="batch-delay" value="50"/>
                                              <param key="direct-deliver" value="false"/>
                                          </netty-acceptor>
                                          ...
                                      </acceptors>
                                      ...
                                  </hornetq-server>
                              </subsystem>
                              ...
                          </profile>
                          <socket-binding-group name="standard-sockets" default-interface="public" port-offset="${jboss.socket.binding.port-offset:0}">
                              ...
                              <socket-binding name="messaging" port="5445"/>
                              <socket-binding name="messaging-throughput" port="5455"/>
                              ...
                          </socket-binding-group>
                      

                       

                      Specifying the factory-class and the host/port directly on the acceptor/connector is deprecated.

                      • 8. Re: HornetQ won't start in Wildfly (netty)
                        Eric Fulton Newbie

                        With that configuration:

                        sudo netstat -plunt | grep 5445

                         

                        returns nothing.  With my configuration it returns:

                        tcp        0      0 127.0.0.1:5445          0.0.0.0:*               LISTEN      147307/java

                         

                        So i'm not sure what I'm doing wrong.  Perhaps it's because i'm using:

                        messaging:2.0

                         

                        And you're using 1.4.

                        • 9. Re: HornetQ won't start in Wildfly (netty)
                          Justin Bertram Master

                          Not sure what you could be doing wrong.  I just downloaded/unzipped a fresh copy of Wildfly 8.2.1.Final and made the modifications I pasted above (corrected to use "2.0" for the subsystem) and when I run netstat it shows the port as expected:

                           

                          $ netstat -plunt | grep 5445
                          (Not all processes could be identified, non-owned process info
                          will not be shown, you would have to be root to see it all.)
                          tcp        0      0 127.0.0.1:5445          0.0.0.0:*              LISTEN      24277/java
                          
                          • 10. Re: HornetQ won't start in Wildfly (netty)
                            Eric Fulton Newbie

                            Could it be because i'm running domain mode and have a 6 node cluster?  I was making the changes on the domain controller domain.xml, restarting the domain controller, then restarting the rest of the nodes' wildfly.

                             

                            Thanks for all the responses btw.  I appreciate it.