Search code examples
javaosgicxfapache-camelapache-karaf

Apache Karaf OSGi application structure


I need to create and deploy an application into Karaf. But I need to use camel component and java component (simple spring bean). The flow should be as follows:

WebService(not matter for me) -> camel-component -> spring-bean -> camel-component -> WebService(not matter for me).

This is just a simple routing. But what I need is the directory structure of OSGi bundle that karaf accepts and deploys.

For e.x. I have:

su-camel
  -src
    -main
      -resources
        -META-INF
          xbean.xml (spring-bean)
    -test
      -java
      -resources

su-bean
  -src
    -main
      -java
      -resources
        -META-INF
          xbean.xml (spring-bean)
    -test
      -java
      -resources

I am packaging all with maven, so what directory structure I should keep in the OSGi bundle .jar file that the application will be deployed correctly? As you can see there is two src directories in su-camel module, and su-bean module.

I know that servicemix accepts the .zip file with all components added with the structure explained above. Does karaf supports structure like that?


Solution

  • The proper OSGi solution would be to create two bundles, one for each project and deploy them both. If you don't want to do this, you can use the Embed-Dependency property in the manifest of your project to include the dependency (camel) packages. This will create just one bundle for you to deploy