6 Replies Latest reply: Apr 25, 2012 4:13 AM by Martin Helwig RSS

    unable to connect to HornetQServlet in JBoss 7

    Martin Helwig Newbie

      I want to use HornetQServlet in jboss 7. I have configured the following in a clean jboss 7 installation:

       

      $JBOSS_HOME/standalone/configuration/standalone-preview.xml
      ...
      <connectors>
         <netty-connector name="netty-throughput" socket-binding="messaging-throughput">
            <param key="batch-delay" value="50"/>
         </netty-connector>
      
         <in-vm-connector name="in-vm" server-id="0"/>
      
         <netty-connector name="netty-servlet" socket-binding="messaging">
            <param key="host" value="org.hornetq"/>
            <param key="port" value="8080"/>
            <param key="use-servlet" value="true"/>
            <param key="servlet-path" value="/messaging/HornetQServlet"/>
          </netty-connector>
      </connectors>
      
      <acceptors>
         <netty-acceptor name="netty-throughput" socket-binding="messaging-throughput">
            <param key="batch-delay" value="50"/>
            <param key="direct-deliver" value="false"/>
         </netty-acceptor>
      
         <in-vm-acceptor name="in-vm" server-id="0"/>
      
         <netty-acceptor name="netty-invm" socket-binding="messaging">
            <param key="use-invm" value="true"/>
            <param key="host" value="org.hornetq"/>
         </netty-acceptor>
      </acceptors>
      ...
      

       

      I also deployed the servlet

       

      $JBOSS_HOME/standalone/deployments/messaging.war/WEB-INF/web.xml
      <?xml version="1.0" encoding="UTF-8"?>
      <web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee"
              xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
              xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
              http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
      
          <servlet>
              <servlet-name>HornetQServlet</servlet-name>
              <servlet-class>
                  org.jboss.netty.channel.socket.http.HttpTunnelingServlet</servlet-class>
              <init-param>
                  <param-name>endpoint</param-name>
                  <param-value>local:org.hornetq</param-value>
              </init-param>
              <load-on-startup>1</load-on-startup>
          </servlet>
          <servlet-mapping>
              <servlet-name>HornetQServlet</servlet-name>
              <url-pattern>/HornetQServlet</url-pattern>
          </servlet-mapping>
      
          <!-- Session timeout configuration -->
              <session-config>
                      <session-timeout>30</session-timeout>
              </session-config>
      
              <welcome-file-list>
                      <welcome-file>index.html</welcome-file>
              </welcome-file-list>
      </web-app>
      

       

       

      I try to connect from a remote machine with the following code:

       

      Map<String, Object> connectionParams = new HashMap<String, Object>();
      connectionParams.put("host", "myHostname");
      connectionParams.put("port", 8080);
      connectionParams.put("use-servlet", true);
      
      TransportConfiguration transportConfiguration = new TransportConfiguration(
              NettyConnectorFactory.class.getName(), connectionParams);
      
      ConnectionFactory connectionFactory = (ConnectionFactory)HornetQJMSClient.createConnectionFactoryWithoutHA(
              JMSFactoryType.CF, transportConfiguration);
      
      Connection connection = connectionFactory.createConnection();
      

       

      I can't connect and all I see is the following warning in jboss console

      14:11:13,918 WARNUNG [org.jboss.netty.channel.socket.http.HttpTunnelingServlet] Endpoint unavailable: connection refused: java.net.ConnectException: connection refused
              at org.jboss.netty.channel.local.LocalClientChannelSink.connect(LocalClientChannelSink.java:115) [netty-3.2.3.Final.jar:]
              at org.jboss.netty.channel.local.LocalClientChannelSink.eventSunk(LocalClientChannelSink.java:72) [netty-3.2.3.Final.jar:]
              at org.jboss.netty.channel.Channels.connect(Channels.java:541) [netty-3.2.3.Final.jar:]
              at org.jboss.netty.channel.AbstractChannel.connect(AbstractChannel.java:218) [netty-3.2.3.Final.jar:]
              at org.jboss.netty.channel.socket.http.HttpTunnelingServlet.service(HttpTunnelingServlet.java:150) [netty-3.2.3.Final.jar:]
              at javax.servlet.http.HttpServlet.service(HttpServlet.java:847) [jboss-servlet-api_3.0_spec-1.0.0.Final.jar:1.0.0.Final]
              at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329) [jbossweb-7.0.1.Final.jar:7.0.1.Final]
              at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.1.Final.jar:7.0.1.Final]
              at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275) [jbossweb-7.0.1.Final.jar:7.0.1.Final]
              at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161) [jbossweb-7.0.1.Final.jar:7.0.1.Final]
              at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:139) [jboss-as-web-7.0.1.Final.jar:7.0.1.Final]
              at org.jboss.as.web.NamingValve.invoke(NamingValve.java:57) [jboss-as-web-7.0.1.Final.jar:7.0.1.Final]
              at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:154) [jbossweb-7.0.1.Final.jar:7.0.1.Final]
              at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) [jbossweb-7.0.1.Final.jar:7.0.1.Final]
              at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) [jbossweb-7.0.1.Final.jar:7.0.1.Final]
              at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:362) [jbossweb-7.0.1.Final.jar:7.0.1.Final]
              at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877) [jbossweb-7.0.1.Final.jar:7.0.1.Final]
              at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:667) [jbossweb-7.0.1.Final.jar:7.0.1.Final]
              at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:952) [jbossweb-7.0.1.Final.jar:7.0.1.Final]
              at java.lang.Thread.run(Thread.java:662) [:1.6.0_24]
      

       

       

      What's wrong with my configuration?