7 Replies Latest reply on Jul 11, 2010 3:14 AM by davsclaus

    help with activemq  please

    darkcloudbird

      Hi, before I state the error, here are a few configuration i have.

       

      in my pom.xml

             <dependency>

               <groupId>org.apache.activemq</groupId>

               <artifactId>activemq-core</artifactId>

               <version>5.3.0-fuse-01-00</version>  <-- same as version installed on my esb

               <type>bundle</type>

             </dependency>

       

      ....

      <Import-Package>

              javax.ws.rs,

              org.apache.cxf.jaxrs.utils,

              org.springframework.beans.factory.config,

              org.apache.camel.osgi,

              org.apache.camel.component.jms,

               (if I add org.apache.activemq.ActiveMQConnectionFactory here I will get Missing constraint error when i start the bundle)

                ***

      </Import-Package>

       

      in my bundle-context.xml

      <bean id="activemq" class="org.apache.camel.component.jms.JmsComponent">

        <property name="connectionFactory">

          <bean class="org.apache.activemq.ActiveMQConnectionFactory">

      <property name="brokerURL" value="vm://localhost?broker.persistent=false"/>

          </bean>

        </property>

      </bean>

       

       

      when i start the bundle, I got the following exception

      Exception in thread "SpringOsgiExtenderThread-68" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'activem

      q' defined in URL bundleentry://219.fwk13059051/META-INF/spring/bundle-context.xml: Cannot create inner bean 'org.apache.activemq.ActiveMQConnectionFactory

      #1ed790e' of type while setting bean property 'connectionFactory'; nested exception is org.springframework.be

      ans.factory.CannotLoadBeanClassException: Cannot find class for bean with name 'org.apache.activemq.ActiveMQC

      onnectionFactory#1ed790e' defined in URL bundleentry://219.fwk13059051/META-INF/spring/bundle-context.xml; nested exception is java.lang.ClassNotFoundExcep

      tion: org.apache.activemq.ActiveMQConnectionFactory not found from bundle

       

       

      here are installed bundle related to activemq in my esb container.

      karaf@root> osgi:list | grep activemq

      activemq-core (5.3.0.fuse-01-00)

      activemq-ra (5.3.0.fuse-01-00)

      activemq-console (5.3.0.fuse-01-00)

      activemq-pool (5.3.0.fuse-01-00)

      activemq-broker.xml (0.0.0)

      activemq-camel (5.3.0.fuse-01-00)

       

      I tried to add org.apache.activemq in <import-package> but still does not work, I got the missing contraint error.

       

      Please help, Thanks in advanced

        • 1. Re: help with activemq  please
          darkcloudbird

          ok now, I somehow tweak versions in my pom.xml and I eliminated the error and the service started. but i got different exception

           

          14:46:10,406 | WARN  | xtenderThread-74 | AnnotationTypeConverterLoader    | er.AnnotationTypeConverterLoader  155 | Ignoring converter type: org.apache.acti

          vemq.camel.converter.ActiveMQMessageConverter as a dependent class could not be found: java.lang.NoClassDefFoundError: org/apache/camel/component/jms/JmsBind

          ing

          java.lang.NoClassDefFoundError: org/apache/camel/component/jms/JmsBinding

                  at java.lang.Class.getDeclaredMethods0(Native Method)

           

          here is my import-package from my pom.xml

          <Import-Package>

          javax.ws.rs,

          org.apache.cxf.jaxrs.utils,                                                            org.springframework.beans.factory.config,

          org.apache.camel.osgi,

          org.apache.camel.component.jms,

          org.apache.activemq,                               

          ***

          </Import-Package>

           

          here is my bundle-context.xml

          <bean id="activemq" class="org.apache.camel.component.jms.JmsComponent">

          <property name="connectionFactory">

          <bean class="org.apache.activemq.ActiveMQConnectionFactory">

          <property name="brokerURL" value="vm://localhost?broker.persistent=false"/>

          </bean>

          </property>

          </bean>

          • 2. Re: help with activemq  please
            davsclaus

            And you have installed the relevant camel features?

            • 3. Re: help with activemq  please
              darkcloudbird

              Hi thanks for reply, here is the list of camel bundles in my esb

               

              karaf@root> osgi:list | grep camel

              camel-core (2.2.0.fuse-01-00)

              camel-spring-osgi (2.2.0.fuse-01-00)

              camel-cxf (2.2.0.fuse-01-00)

              activemq-camel (5.3.0.fuse-01-00)

              camel-spring (2.2.0.fuse-01-00)

              camel-osgi (2.2.0.fuse-01-00)

              camel-xmpp (2.2.0.fuse-01-00)

              camel-jms (2.2.0.fuse-01-00)

              • 4. Re: help with activemq  please
                davsclaus

                Hi

                 

                You can take a look at the Camel Spring JMS example which can be deployed as a OSGi app

                 

                https://svn.apache.org/repos/asf/camel/trunk/examples/camel-example-spring-jms/

                 

                You can check out the OSGi imports it does to include some AMQ stuff, in the pom.xml file.

                 

                If you do a mvn compile you can see the generated MANIFEST.MF in the target/classes/META-INF directory. And compare it with your apps manifest file.

                • 5. Re: help with activemq  please
                  darkcloudbird

                  hi, thanks for reply, I checked the pom file and I don't see anything different in terms of dependencies. but i didn't have a chance to compile the examples to see the MANIFEST file, but here is my MANIFEST file.

                   

                  Manifest-Version: 1.0

                  Export-Package: com.mycompany.my_billing_service;uses:="org.apache.camel

                  .builder,org.apache.camel.model,org.apache.camel,org.slf4j,org.spring

                  framework.beans.factory"

                  Built-By: ***

                  Build-Jdk: 1.6.0

                  Bundle-Version: 0.0.1.SNAPSHOT

                  Tool: Bnd-0.0.238

                  Bundle-Name: MY Billing Manager

                  Bnd-LastModified: 1278738581812

                  Created-By: Apache Maven Bundle Plugin

                  Bundle-ManifestVersion: 2

                  Bundle-SymbolicName: com.mycompany.billing-service

                  Import-Package: com.mycompany.my_billing_service,javax.ws.rs,org.apache.

                  activemq;version="5.3.0.fuse-01-00",org.apache.camel;version="2.2.0.f

                  use-01-00",org.apache.camel.builder;version="2.2.0.fuse-01-00",org.ap

                  ache.camel.component.jms;version="2.2.0.fuse-01-00",org.apache.camel.

                  model;version="2.2.0.fuse-01-00",org.apache.camel.osgi;version="2.2.0

                  .fuse-01-00",org.apache.cxf.jaxrs.utils;version="2.1.3.fuse",org.slf4

                  j,org.springframework.beans.factory;version="2.5",org.springframework

                  .beans.factory.config;version="2.5"

                   

                   

                  the strange thing is that even if I remove the jmsComponent and activemq configuration in my bundle-context, and remove the imports in my source code, i still got the exception .NoClassDefFoundError: org/apache/camel/component/jms/JmsBinding

                   

                  Thanks in advance.

                  • 6. Re: help with activemq  please
                    darkcloudbird

                    ok now, it started working again. i changed my bundle-context.xml to

                     

                    <bean id="activemq" class="org.apache.activemq.camel.component.ActiveMQComponent">

                    <property name="brokerURL" value="tcp://localhost:61616"/>

                    </bean>

                     

                    and route to

                     

                    <route>

                    <from uri="timer://springTimer?fixedRate=true&amp;period=2000"/>

                    <bean ref="myTransformManager" method="transform"/>

                    <to uri="activemq:camel.timer"/>

                    </route>

                    <route>

                    <from uri="activemq:camel.timer"/>

                    <to uri="file:C:/mavenTest/fromAMQ"/>

                    </route>

                     

                     

                    followed the example from

                     

                    http://fusesource.com/docs/esb/4.2/deploy_osgi/DeployActiveMQ-Example.html

                     

                    according to this thread, i remove camel-osgi and camel-spring, but install camel-spring-osgi

                     

                    http://fusesource.com/forums/thread.jspa?messageID=6054&tstart=0#6054

                     

                     

                    but still get the exception,

                     

                    so I restart the my esb and (all of the sudden) it is working as expected now. ,

                     

                    I am still confused. I have a hunch that it will happen again sometime later :(.

                     

                    Any Idea???:?

                     

                    Thanks

                    • 7. Re: help with activemq  please
                      davsclaus

                      You could use the features to install Camel, to ensure that you don't have to mess with which bundles you need to install manually.