I'm trying to run a simple camel test route which reads files from a
directory, puts them into an ActiveMQ queue, and another one reads the
files from the queue and writes them to another directory.

I took examples/camel-osgi and started building on top of it.

beans.xml:

    <route>
      <from uri="activemq:queue:someq"/>
      <to uri="file:d:/servicemix-files/out" />
    </route>
    <route>
      <from uri="file:d:/servicemix-files/in"/>
      <to uri="activemq:queue:someq"/>
    </route>

    <bean id="activemq"
class="org.apache.activemq.camel.component.ActiveMQComponent"
depends-on="my-broker">
                <property name="brokerURL" value="tcp://localhost:61616" />
    </bean>

    <broker:broker id="my-broker" useJmx="false" persistent="false"
brokerName="localhost">
        <broker:transportConnectors>
            <broker:transportConnector uri="tcp://localhost:61616"/>
        </broker:transportConnectors>
    </broker:broker>

At first I got a bunch of osgi "unresolved constraint in bundle
camel-osgi errors". After a while of trial and error I ended up with
following changes:

features.xml:

    <feature name="examples-camel-osgi" version="4.2.0">
        <feature version="2.2.0">camel</feature>
        <feature version="5.3.0">activemq</feature>
        <feature version="4.2.0">camel-activemq</feature>
        <bundle>mvn:org.apache.servicemix.examples/camel-osgi/4.2.0</bundle>
    </feature>

pom.xml:
                <artifactId>maven-bundle-plugin</artifactId>
 ...

<Import-Package>*,org.apache.camel.component.jms,org.apache.activemq.xbean,org.apache.camel.osgi,org.apache.activemq.camel.component,org.apache.activemq.broker,org.apache.activemq.pool</Import-Package>

But still I do get a ClassNotFoundException when I try to deploy  the feature:

Caused by: org.springframework.beans.factory.CannotLoadBeanClassException:
Error loading class
[org.apache.activemq.camel.component.ActiveMQComponent] for bean with
name 'activemq' defined in URL [bun
dle://222.0:0/META-INF/spring/beans.xml]: problem with class file or
dependent class; nested exception is java.lang.NoClassDefFoundError:
org.apache.activemq.camel.component.ActiveMQComponent not foun
d from bundle [Apache ServiceMix Example :: Camel OSGi (camel-osgi)]
        at 
org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1144)
....
Caused by: java.lang.ClassNotFoundException:
org.apache.camel.component.jms.JmsComponent

1) What do I need to do to fix this ClassNotFoundException
2) How can I know what I need to configure into features.xml, pom.xml
import-packages and dependencies when I want to use camel and it's
activemq component from servicemix? Is this information documented
somewhere? Doing it by trial-and-error gets frustrating pretty fast...

Reply via email to