0
votes

I'm trying to do some "hello world" example with Apache Camel. Just a simple route, deployed as OSGi bundle to Apache Karaf. And it's crazy, too many things to learn at once, Camel itself, integration with spring, integration with OSGi and Karaf...ugh.

I'm trying to follow the idea from here: http://www.andrejkoelewijn.com/wp/2008/10/19/simple-camel-dsl-osgi-bundle-example/.

I've created the bundle, the package with FileRoute.java file, etc, but I can't produce valid manifest.mf file, it's generated by "bundle plugin for maven" - so the POM file is used to generate the manifest file.

What's the problem is this in the manifest file, line with import packages:

Import-Package: com.company.foo.bar.demo;version="0.1",org.apache.ca
 mel.builder;version="2.10",org.apache.camel.model;version="2.10",org.
 apache.commons.logging

With error: "No available bundle exports package 'org.apache.camel.builder'" (and .model package).

Well, I understand what is the problem, but…How to expose these packages for the bundle?

Next I have there another bundle with Apache Camel context, so I thought that good idea is to expose the packages from there, through "export package", but it doesn't work, the camel bundle can't be build then.

I'm quite lost :( I'd really appreciate help or hint.

Thanks!

1
Yes OSGi deployments is a PITA, hence why it should/can be much easier with FAB (davsclaus.com/2012/08/osgi-deployment-made-easy-with-fab.html) - Claus Ibsen

1 Answers

1
votes

If you use Apache Camel 2.10 or better then the Maven archetypes is a good place to start a new Camel project. We have archetypes that can create OSGi based project for either spring-dm or OSGi blueprint. You chose which one you want to use. The project is then ready for OSGi as it setup a maven plugin that generated the needed osgi stuff for you. Only in more advanced cases you would need to tweak this plugin.

See details at: http://camel.apache.org/camel-maven-archetypes.html

If you use Maven 3.0.x then its much easier as you can just type

mvn archetype:generate

Then it runs in interactive mode, then type camel to filter only camel archetypes.

And then select the number for the archetype. eg for example the spring-dm to use OSGi with Spring.