2 Replies Latest reply on Apr 21, 2010 1:05 PM by Chris Baron

    HornetQ StompConnect Configuration Problem

    Benedikt Birkhäuser Newbie

      Hi there,

       

      we are trying to setup hornetq 2.0 using StompConnect by following the examples given at http://jmesnil.net/weblog/2010/01/14/using-stomp-with-hornetq/

      Thus meaning to configure HornetQ by using the following configuration

       

      hornetq-configuration.xml

       

       <acceptors>
           <acceptor name="netty">
               <factory-class>org.hornetq.integration.transports.netty.NettyAcceptorFactory</factory-class>
               <param key="host"  value="${hornetq.remoting.netty.host:localhost}"/>
               <param key="port"  value="${hornetq.remoting.netty.port:5445}"/>
            </acceptor>
            <acceptor name="invm">
               <factory-class>org.hornetq.core.remoting.impl.invm.InVMAcceptorFactory</factory-class>
            </acceptor>
         </acceptors>

       

      hornetq-beans.xml

       

         <!-- The JMS in-VM connection factory for StompConnect use -->
         <bean name="StompConnectionFactory" class="javax.jms.ConnectionFactory">
            <constructor factoryClass="org.hornetq.api.jms.HornetQJMSClient"
                         factoryMethod="createConnectionFactory">
               <parameter>
                 <bean class="org.hornetq.api.core.TransportConfiguration">
                    <constructor><br />
                       <parameter>org.hornetq.core.remoting.impl.invm.InVMConnectorFactory</parameter>
                    </constructor>
                 </bean>
               </parameter>
            </constructor>
         </bean>

         <!-- The StompConnect instance -->
         <bean name="StompConnect" class="org.codehaus.stomp.jms.StompConnect">
            <constructor>
               <parameter>
                  <inject bean="StompConnectionFactory"/>
               </parameter>
            </constructor>
            <install method="start"/>
         </bean>

       

       

      This works perfectly in a Windows environment, but will give us an error in Linux (tested on Ubuntu9.10 as well as Suse):

       

      java  -XX:+UseParallelGC -XX:+AggressiveOpts -XX:+UseFastAccessorMethods -Xms512M -Xmx1024M -Dhornetq.config.dir=../config/stand-alone/non-clustered -Djava.util.logging.config.file=../config/stand-alone/non-clustered/logging.properties -Dorg.jboss.logging.Logger.pluginClass=org.hornetq.integration.logging.HornetQLoggerPlugin -Djava.library.path=. -classpath ../lib/stompconnect-1.0.jar:../lib/netty.jar:../lib/jnpserver.jar:../lib/jboss-mc.jar:../lib/jboss-jms-api.jar:../lib/hornetq-transports.jar:../lib/hornetq-logging.jar:../lib/hornetq-jms.jar:../lib/hornetq-jboss-as-security.jar:../lib/hornetq-core.jar:../lib/hornetq-bootstrap.jar:../lib/commons-logging-1.1.jar:../config/stand-alone/non-clustered:../schemas/ org.hornetq.integration.bootstrap.HornetQBootstrapServer hornetq-beans.xml
      libHornetQAIO32.so libHornetQAIO64.so libHornetQAIO_ia64.so run.bat run.sh stop.bat stop.sh
      [main] 10:17:06,900 INFO [org.hornetq.integration.bootstrap.HornetQBootstrapServer]  Starting HornetQ Server
      [main] 10:17:07,857 SEVERE [org.jboss.kernel.plugins.dependency.AbstractKernelController]  Error installing to Instantiated: name=StompConnectionFactory state=Described
      java.lang.IllegalArgumentException: Wrong arguments. createConnectionFactory for target null expected=[org.hornetq.api.core.client.ClientSessionFactory] actual=[org.hornetq.api.core.TransportConfiguration]
          at org.jboss.reflect.plugins.introspection.ReflectionUtils.handleErrors(ReflectionUtils.java:395)
          at org.jboss.reflect.plugins.introspection.ReflectionUtils.invoke(ReflectionUtils.java:69)
          at org.jboss.reflect.plugins.introspection.ReflectMethodInfoImpl.invoke(ReflectMethodInfoImpl.java:150)
          at org.jboss.joinpoint.plugins.BasicMethodJoinPoint.dispatch(BasicMethodJoinPoint.java:66)
          at org.jboss.kernel.plugins.dependency.KernelControllerContextAction$JoinpointDispatchWrapper.execute(KernelControllerContextAction.java:241)
          at org.jboss.kernel.plugins.dependency.ExecutionWrapper.execute(ExecutionWrapper.java:47)
          at org.jboss.kernel.plugins.dependency.KernelControllerContextAction.dispatchExecutionWrapper(KernelControllerContextAction.java:109)
          at org.jboss.kernel.plugins.dependency.KernelControllerContextAction.dispatchJoinPoint(KernelControllerContextAction.java:70)
          at org.jboss.kernel.plugins.dependency.InstantiateAction.installActionInternal(InstantiateAction.java:66)
          at org.jboss.kernel.plugins.dependency.InstallsAwareAction.installAction(InstallsAwareAction.java:54)
          at org.jboss.kernel.plugins.dependency.InstallsAwareAction.installAction(InstallsAwareAction.java:42)
          at org.jboss.dependency.plugins.action.SimpleControllerContextAction.simpleInstallAction(SimpleControllerContextAction.java:62)
          at org.jboss.dependency.plugins.action.AccessControllerContextAction.install(AccessControllerContextAction.java:71)
          at org.jboss.dependency.plugins.AbstractControllerContextActions.install(AbstractControllerContextActions.java:51)
          at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:348)
          at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1631)
          at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:934)
          at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1082)
          at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:984)
          at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:774)
          at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:540)
          at org.jboss.kernel.plugins.deployment.AbstractKernelDeployer.deployBean(AbstractKernelDeployer.java:319)
          at org.jboss.kernel.plugins.deployment.AbstractKernelDeployer.deployBeans(AbstractKernelDeployer.java:297)
          at org.jboss.kernel.plugins.deployment.AbstractKernelDeployer.deploy(AbstractKernelDeployer.java:130)
          at org.jboss.kernel.plugins.deployment.xml.BeanXMLDeployer.deploy(BeanXMLDeployer.java:96)
          at org.hornetq.integration.bootstrap.HornetQBootstrapServer.deploy(HornetQBootstrapServer.java:237)
          at org.hornetq.integration.bootstrap.HornetQBootstrapServer.deploy(HornetQBootstrapServer.java:206)
          at org.hornetq.integration.bootstrap.HornetQBootstrapServer.bootstrap(HornetQBootstrapServer.java:155)
          at org.jboss.kernel.plugins.bootstrap.AbstractBootstrap.run(AbstractBootstrap.java:83)
          at org.hornetq.integration.bootstrap.HornetQBootstrapServer.run(HornetQBootstrapServer.java:117)
          at org.hornetq.integration.bootstrap.HornetQBootstrapServer.main(HornetQBootstrapServer.java:73)
      [main] 10:17:07,877 INFO [org.hornetq.core.server.impl.HornetQServerImpl]  live server is starting..
      [main] 10:17:07,912 WARNING [org.hornetq.core.persistence.impl.journal.JournalStorageManager]  AIO wasn't located on this platform, it will fall back to using pure Java NIO. If your platform is Linux, install LibAIO to enable the AIO journal
      [main] 10:17:07,912 INFO [org.hornetq.core.persistence.impl.journal.JournalStorageManager]  Using NIO Journal
      [main] 10:17:07,926 WARNING [org.hornetq.core.server.impl.HornetQServerImpl]  Security risk! It has been detected that the cluster admin user and password have not been changed from the installation default. Please see the HornetQ user guide, cluster chapter, for instructions on how to do this.
      [main] 10:17:08,649 WARNING [org.hornetq.jms.server.impl.JMSServerManagerImpl]  Binding for java:/ConnectionFactory already exists
      [main] 10:17:08,650 WARNING [org.hornetq.jms.server.impl.JMSServerManagerImpl]  Binding for java:/XAConnectionFactory already exists
      [main] 10:17:08,758 INFO [org.hornetq.integration.transports.netty.NettyAcceptor]  Started Netty Acceptor version 3.1.5.GA-r1772
      [main] 10:17:08,759 INFO [org.hornetq.core.server.impl.HornetQServerImpl]  HornetQ Server version 2.0.0.GA (Hornet Queen, 113) started
      [main] 10:17:08,760 SEVERE [org.hornetq.integration.bootstrap.HornetQBootstrapServer]  Failed to start server
      java.lang.IllegalStateException: Incompletely deployed:

       

      DEPLOYMENTS IN ERROR:
        Deployment "StompConnectionFactory" is in error due to: java.lang.IllegalArgumentException: Wrong arguments. createConnectionFactory for target null expected=[org.hornetq.api.core.client.ClientSessionFactory] actual=[org.hornetq.api.core.TransportConfiguration]

       

      DEPLOYMENTS MISSING DEPENDENCIES:
        Deployment "StompConnect" is missing the following dependencies:
          Dependency "StompConnectionFactory" (should be in state "Installed", but is actually in state "**ERROR**")

       

          at org.jboss.kernel.plugins.deployment.AbstractKernelDeployer.internalValidate(AbstractKernelDeployer.java:278)
          at org.jboss.kernel.plugins.deployment.AbstractKernelDeployer.validate(AbstractKernelDeployer.java:174)
          at org.hornetq.integration.bootstrap.HornetQBootstrapServer.bootstrap(HornetQBootstrapServer.java:158)
          at org.jboss.kernel.plugins.bootstrap.AbstractBootstrap.run(AbstractBootstrap.java:83)
          at org.hornetq.integration.bootstrap.HornetQBootstrapServer.run(HornetQBootstrapServer.java:117)
          at org.hornetq.integration.bootstrap.HornetQBootstrapServer.main(HornetQBootstrapServer.java:73)
      Exception in thread "main" java.lang.IllegalStateException: Incompletely deployed:

       

      DEPLOYMENTS IN ERROR:
        Deployment "StompConnectionFactory" is in error due to: java.lang.IllegalArgumentException: Wrong arguments. createConnectionFactory for target null expected=[org.hornetq.api.core.client.ClientSessionFactory] actual=[org.hornetq.api.core.TransportConfiguration]

       

      DEPLOYMENTS MISSING DEPENDENCIES:
        Deployment "StompConnect" is missing the following dependencies:
          Dependency "StompConnectionFactory" (should be in state "Installed", but is actually in state "**ERROR**")

       

          at org.jboss.kernel.plugins.deployment.AbstractKernelDeployer.internalValidate(AbstractKernelDeployer.java:278)
          at org.jboss.kernel.plugins.deployment.AbstractKernelDeployer.validate(AbstractKernelDeployer.java:174)
          at org.hornetq.integration.bootstrap.HornetQBootstrapServer.bootstrap(HornetQBootstrapServer.java:158)
          at org.jboss.kernel.plugins.bootstrap.AbstractBootstrap.run(AbstractBootstrap.java:83)
          at org.hornetq.integration.bootstrap.HornetQBootstrapServer.run(HornetQBootstrapServer.java:117)
          at org.hornetq.integration.bootstrap.HornetQBootstrapServer.main(HornetQBootstrapServer.java:73)

       

       

      Can anybody help?

        • 1. Re: HornetQ StompConnect Configuration Problem
          Jeff Mesnil Master

          That is strange, this means that on windows, JBoss Microcontainer picks the (correct) HornetQJMSClient.createConnectionFactory(TransportConfiguration) while on Linux, it uses HornetQJMSClient.createConnectionFactory(ClientSessionFactory).

           

          I don't know how you can configure JBoss Microcontainer to pick the correct method, please see their documentation.

           

          In the mean time, you can fix this by using the createConnectionFactory(TransportConfiguration, TransportConfiguration) method

          with a null backup config:

           

             <bean name="StompConnectionFactory" class="javax.jms.ConnectionFactory">
                <constructor factoryClass="org.hornetq.api.jms.HornetQJMSClient"
                             factoryMethod="createConnectionFactory">
                   <parameter>
                     <bean class="org.hornetq.api.core.TransportConfiguration">
                        <constructor>
                           <parameter>org.hornetq.core.remoting.impl.invm.InVMConnectorFactory</parameter>
                        </constructor>
                     </bean>
                   </parameter>
                   <parameter><null /></parameter
                </constructor>
             </bean>

           

          This should solve your issue but it is less clean than forcing JBoss Microcontainer to pick the correct method.

          • 2. Re: HornetQ StompConnect Configuration Problem
            Chris Baron Newbie

            I was unable to get this solution to work for me.

             

            The relevant documentation for hinting which constructor should be used can be found at the following URL. http://www.jboss.org/file-access/default/members/jbossmc/freezone/docs/2.0.x/userGuide/ch10s02.html

             

            Based on that documentation, the "correct" solution is to add a class attribute to the constructor parameter element. (<parameter class="org.hornetq.api.core.TransportConfiguration">) See full solution below:

             

               <bean name="StompConnectionFactory" class="javax.jms.ConnectionFactory">
                  <constructor factoryClass="org.hornetq.api.jms.HornetQJMSClient"
                               factoryMethod="createConnectionFactory">
                     <parameter class="org.hornetq.api.core.TransportConfiguration">
                       <bean class="org.hornetq.api.core.TransportConfiguration">
                          <constructor>
                             <parameter>org.hornetq.core.remoting.impl.invm.InVMConnectorFactory</parameter>
                          </constructor>
                       </bean>
                     </parameter>
                  </constructor>
               </bean>