6 Replies Latest reply on May 11, 2017 12:20 PM by jbertram

    Could not find factory class for resource: META-INF/services/org/apache/activemq/transport/ws

    aragoubi

      I Integrated activeMQ in jboss in such a way that when I start a project deployed in jboss, activeMQ broker start.

      I followed a tutorial to integrate activeMQ in jboss.

      I copied the activemq-rar-5.9.0.rar into the standalone/deployments folder, then I generated the ironjacamar.xml file which I put into the meta-inf folder.  

      The broker serverUrl defined in the ra.xml file is "vm://localhost" and this is my broker-config file:

       

      <?xml version="1.0" encoding="UTF-8"?>

      <beans

        xmlns="http://www.springframework.org/schema/beans"

        xmlns:amq="http://activemq.apache.org/schema/core"

        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

        xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd

        http://activemq.apache.org/schema/core http://activemq.apache.org/schema/core/activemq-core.xsd">

       

        <broker xmlns="http://activemq.apache.org/schema/core" useJmx="true" useShutdownHook="false"  brokerName="mimo.broker1">

           <managementContext>

             

             <managementContext createConnector="false"/>

           </managementContext>

       

          <persistenceAdapter>

             <kahaDB directory="activemq-data/kahadb"/>

           </persistenceAdapter>

       

          <transportConnectors>

            <transportConnector name="mimo.broker1" uri="tcp://localhost:61616" />

               

          </transportConnectors> 

        </broker>

      </beans>

       

       

      With this file my broker start without errors, but when I uncomment the websocket transportConnector

      I am getting the error indicated in the title.

       

      Here is the stacktrace:

       

      15:55:40,964 ERROR [org.apache.activemq.xbean.XBeanBrokerFactory] (Starting ActiveMQ Broker) Failed to load: class path resource [broker-config.xml], reason: Error creating bean with name 'org.apache.activemq.xbean.XBeanBrokerService#0' defined in class path resource [broker-config.xml]: Invocation of init method failed; nested exception is java.io.IOException: Transport Connector could not be registered in JMX: Transport scheme NOT recognized: [ws]: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.apache.activemq.xbean.XBeanBrokerService#0' defined in class path resource [broker-config.xml]: Invocation of init method failed; nested exception is java.io.IOException: Transport Connector could not be registered in JMX: Transport scheme NOT recognized: [ws]

              at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1482) [spring-beans-3.2.4.RELEASE.jar:3.2.4.RELEASE]

              at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:521) [spring-beans-3.2.4.RELEASE.jar:3.2.4.RELEASE]

              at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:458) [spring-beans-3.2.4.RELEASE.jar:3.2.4.RELEASE]

              at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:295) [spring-beans-3.2.4.RELEASE.jar:3.2.4.RELEASE]

              at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223) [spring-beans-3.2.4.RELEASE.jar:3.2.4.RELEASE]

              at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:292) [spring-beans-3.2.4.RELEASE.jar:3.2.4.RELEASE]

              at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194) [spring-beans-3.2.4.RELEASE.jar:3.2.4.RELEASE]

              at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:628) [spring-beans-3.2.4.RELEASE.jar:3.2.4.RELEASE]

              at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:932) [spring-context-3.2.4.RELEASE.jar:3.2.4.RELEASE]

              at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:479) [spring-context-3.2.4.RELEASE.jar:3.2.4.RELEASE]

              at org.apache.xbean.spring.context.ResourceXmlApplicationContext.<init>(ResourceXmlApplicationContext.java:64) [xbean-spring-3.14.jar:3.14]

              at org.apache.xbean.spring.context.ResourceXmlApplicationContext.<init>(ResourceXmlApplicationContext.java:52) [xbean-spring-3.14.jar:3.14]

              at org.apache.activemq.xbean.XBeanBrokerFactory$1.<init>(XBeanBrokerFactory.java:104) [activemq-spring-5.9.0.jar:5.9.0]

              at org.apache.activemq.xbean.XBeanBrokerFactory.createApplicationContext(XBeanBrokerFactory.java:104) [activemq-spring-5.9.0.jar:5.9.0]

              at org.apache.activemq.xbean.XBeanBrokerFactory.createBroker(XBeanBrokerFactory.java:67) [activemq-spring-5.9.0.jar:5.9.0]

              at org.apache.activemq.broker.BrokerFactory.createBroker(BrokerFactory.java:71) [activemq-broker-5.9.0.jar:5.9.0]

              at org.apache.activemq.broker.BrokerFactory.createBroker(BrokerFactory.java:54) [activemq-broker-5.9.0.jar:5.9.0]

              at org.apache.activemq.ra.ActiveMQResourceAdapter$1.run(ActiveMQResourceAdapter.java:84) [activemq-ra-5.9.0.jar:5.9.0]

      Caused by: java.io.IOException: Transport Connector could not be registered in JMX: Transport scheme NOT recognized: [ws]

              at org.apache.activemq.util.IOExceptionSupport.create(IOExceptionSupport.java:27) [activemq-client-5.9.0.jar:5.9.0]

              at org.apache.activemq.broker.BrokerService.registerConnectorMBean(BrokerService.java:2036) [activemq-broker-5.9.0.jar:5.9.0]

              at org.apache.activemq.broker.BrokerService.startTransportConnector(BrokerService.java:2498) [activemq-broker-5.9.0.jar:5.9.0]

              at org.apache.activemq.broker.BrokerService.startAllConnectors(BrokerService.java:2415) [activemq-broker-5.9.0.jar:5.9.0]

              at org.apache.activemq.broker.BrokerService.doStartBroker(BrokerService.java:666) [activemq-broker-5.9.0.jar:5.9.0]

              at org.apache.activemq.broker.BrokerService.startBroker(BrokerService.java:632) [activemq-broker-5.9.0.jar:5.9.0]

              at org.apache.activemq.broker.BrokerService.start(BrokerService.java:568) [activemq-broker-5.9.0.jar:5.9.0]

              at org.apache.activemq.xbean.XBeanBrokerService.afterPropertiesSet(XBeanBrokerService.java:73) [activemq-spring-5.9.0.jar:5.9.0]

              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.7.0_79]

              at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [rt.jar:1.7.0_79]

              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_79]

              at java.lang.reflect.Method.invoke(Method.java:606) [rt.jar:1.7.0_79]

              at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeCustomInitMethod(AbstractAutowireCapableBeanFactory.java:1608) [spring-beans-3.2.4.RELEASE.jar:3.2.4.RELEASE]

              at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1549) [spring-beans-3.2.4.RELEASE.jar:3.2.4.RELEASE]

              at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1479) [spring-beans-3.2.4.RELEASE.jar:3.2.4.RELEASE]

              ... 17 more

      Caused by: java.io.IOException: Transport scheme NOT recognized: [ws]

              at org.apache.activemq.util.IOExceptionSupport.create(IOExceptionSupport.java:27) [activemq-client-5.9.0.jar:5.9.0]

              at org.apache.activemq.transport.TransportFactory.findTransportFactory(TransportFactory.java:178) [activemq-client-5.9.0.jar:5.9.0]

              at org.apache.activemq.transport.TransportFactorySupport.bind(TransportFactorySupport.java:32) [activemq-broker-5.9.0.jar:5.9.0]

              at org.apache.activemq.broker.TransportConnector.createTransportServer(TransportConnector.java:310) [activemq-broker-5.9.0.jar:5.9.0]

              at org.apache.activemq.broker.TransportConnector.getServer(TransportConnector.java:140) [activemq-broker-5.9.0.jar:5.9.0]

              at org.apache.activemq.broker.TransportConnector.asManagedConnector(TransportConnector.java:107) [activemq-broker-5.9.0.jar:5.9.0]

              at org.apache.activemq.broker.BrokerService.registerConnectorMBean(BrokerService.java:2031) [activemq-broker-5.9.0.jar:5.9.0]

              ... 30 more

      Caused by: java.io.IOException: Could not find factory class for resource: META-INF/services/org/apache/activemq/transport/ws

              at org.apache.activemq.util.FactoryFinder$StandaloneObjectFactory.loadProperties(FactoryFinder.java:96) [activemq-client-5.9.0.jar:5.9.0]

              at org.apache.activemq.util.FactoryFinder$StandaloneObjectFactory.create(FactoryFinder.java:58) [activemq-client-5.9.0.jar:5.9.0]

              at org.apache.activemq.util.FactoryFinder.newInstance(FactoryFinder.java:146) [activemq-client-5.9.0.jar:5.9.0]

              at org.apache.activemq.transport.TransportFactory.findTransportFactory(TransportFactory.java:175) [activemq-client-5.9.0.jar:5.9.0]

              ... 35 more

       

      Could someone help me with this ?

        • 1. Re: Could not find factory class for resource: META-INF/services/org/apache/activemq/transport/ws
          jbertram

          As far as I can tell this is an ActiveMQ issue (my guess is a missing class).  I'm not sure the JBoss community can do anything about this.

          • 2. Re: Could not find factory class for resource: META-INF/services/org/apache/activemq/transport/ws
            aragoubi

            I posted a question in activemq forum, I got only one response saying if I have right jars in my classpath but every things seems ok for me.

            As I explained in my post I integrated activemq in the deployments folder and I am creating a maven project, so I don't think that I have to add jars to classpath.
            Do you have any idea how to resolve this problem?

            • 3. Re: Could not find factory class for resource: META-INF/services/org/apache/activemq/transport/ws
              jbertram

              I posted a question in activemq forum, I got only one response saying if I have right jars in my classpath but every things seems ok for me.

              How can you say that everything seems OK when you're getting this error?

               

              Do you have any idea how to resolve this problem?

              As I indicated before, my hunch is that you're missing something on your classpath.

               

              I took a quick look at the ActiveMQ 5.x source code and I see that the "ws" transport is part of the "activemq-http" module which is turned into the activemq-http-<version>.jar during the build process.  This jar file is not included in the ActiveMQ JCA RA archive.  It's shipped in the broker distribution in the lib/optional folder.

              1 of 1 people found this helpful
              • 4. Re: Could not find factory class for resource: META-INF/services/org/apache/activemq/transport/ws
                jbertram

                Did you get this sorted?

                • 5. Re: Could not find factory class for resource: META-INF/services/org/apache/activemq/transport/ws
                  aragoubi

                  Yes, thank you for your help, yes it was missing jars in classpath problem.
                  I tried to work with mqtt over websocket using apache paho client and my activeMQ broker but it doesn't work.

                  I don't know if activeMQ allows mqtt+ws.

                  I tried to connect to the port "ws://0.0.0.0:1884" defined in my broker-config like this :

                   

                          String broker = "ws://127.0.0.1:1884";

                          String clientId = "JavaSample";

                          MemoryPersistence persistence = new MemoryPersistence();

                          try {

                                   MqttAsyncClient sampleClient = new MqttAsyncClient(broker, clientId, persistence);

                                   MqttConnectOptions connOpts = new MqttConnectOptions();

                                   connOpts.setCleanSession(true);

                                   connOpts.setAutomaticReconnect(true);

                                   IMqttToken token = sampleClient.connect(connOpts);

                         }catch(MqttException e){

                                    e.printStackTrace();

                        }

                   

                  But it doesn't work and I am getting this warn "[WARN  [org.apache.activemq.broker.TransportConnection.Transport] (qtp906254668-147) Transport Connection to: MQTTSocket_248153872 failed: java.io.IOException: Invalid CONNECT encoding".

                   

                  I tried to connect to mosquitto remote broker "tcp://test.mosquitto.org:1883" and it works.

                   

                  I didn't get any response from activemq user forum.

                   

                  Do you have an idea how to enable mqtt over websocket with activeMQ ?

                   

                  • 6. Re: Could not find factory class for resource: META-INF/services/org/apache/activemq/transport/ws
                    jbertram

                    Do you have an idea how to enable mqtt over websocket with activeMQ ?

                    I do not. You'll need to get help from the ActiveMQ community or just pull down the broker source code and debug it yourself.