L.S,

What version of ServiceMix are you using for this scenario?  In some
other post, I see you mention 4.3.0 but this features.xml file seems
to indicate that you're using 4.2.0.  In ServiceMix 4.3.0, camel-jms
and activemq-camel are both preinstalled.  As far as 4.3.0 is
concerned, our new quickstart guide has a similar example that just
seems to work out of the box for me (cfr.
http://servicemix.apache.org/docs/4.3.0-SNAPSHOT/quickstart/activemq.html).

Could you paste the output for the osgi:headers command for the bundle
you're deploying and I'll try to add a similar example using bundles
instead of plain XML files to our Camel guide?

Regards,

Gert Vanthienen
------------------------
FuseSource
Web: http://fusesource.com
Blog: http://gertvanthienen.blogspot.com/



On Tue, Mar 8, 2011 at 3:26 PM, janne postilista
<[email protected]> wrote:
> Camel's ActiveMQ component http://camel.apache.org/activemq.html lists
> that it needs dependencies:
>
>    * camel-jms
>    * activemq-camel
>
> If I would be running Camel in standalone environment, I guess I would
> be putting those as maven pom dependencies (examples in
> http://camel.apache.org/activemq.html)
>
> But since I am running my solution as OGSi bundle deployed in
> ServiceMix, I am not sure. Should I put those as maven pom.xml
> dependencies, or reference the OSGi bundles that already exist in
> ServiceMix?
>
> - what do I put in my maven pom.xml dependencies, what in
> maven-bundle-plugin Import-Packages?
> - are there any configuration examples / documentation on how to
> configure servicemix OSGi bundle that contains camel route which uses
> camel activemq component?
>
> camel-osgi example starts with pom.xml with:
>
>    <dependencies>
>        <dependency>
>            <groupId>commons-logging</groupId>
>            <artifactId>commons-logging</artifactId>
>            <scope>provided</scope>
>        </dependency>
>        <dependency>
>            <groupId>org.apache.camel</groupId>
>            <artifactId>camel-spring</artifactId>
>            <version>${camel.version}</version>
>        </dependency>
>    </dependencies>
>
>    <build>
>        <plugins>
>            <plugin>
>                <groupId>org.apache.felix</groupId>
>                <artifactId>maven-bundle-plugin</artifactId>
>                <configuration>
>                    <instructions>
>
> <Bundle-SymbolicName>${pom.artifactId}</Bundle-SymbolicName>
>                        
> <Import-Package>*,org.apache.camel.osgi</Import-Package>
>
> <Private-Package>org.apache.servicemix.examples.camel</Private-Package>
>                    </instructions>
>                </configuration>
>            </plugin>
>        </plugins>
>    </build>
>
> How should I change it? Seems that no matter whether I add
> org.apache.camel.component.jms to Import-Packages, or add
>
>                <dependency>
>                        <groupId>org.apache.camel</groupId>
>                        <artifactId>camel-jms</artifactId>
>                        <version>${camel.version}</version>
>                </dependency>
>
> I always get java.lang.ClassNotFoundException:
> org.apache.camel.component.jms.JmsComponent when I try to deploy my
> bundle.
>
>
>
>
> On Tue, Mar 8, 2011 at 2:35 PM, janne postilista
> <[email protected]> wrote:
>> 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