Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

To use ServiceMix my project has to be an OSGi bundle?

I' starting to use ServiceMix and Camel and I've run through many examples.

It seems that the examples that are OSGi can be deployed in ServiceMix via hot deploy or via console, but I don't know how to deploy a project that is not an OSGI. Can it be done?

For example, I'm looking at the example project from Camel 2.10.0 called camel-example-cxf-proxy. I did some alterations and now I wanted to load it in ServiceMix. If I copy/paste to the deploy directory it is loaded but when I try to run it via osgi:start id it fails.

However if I run it from the IDE as a standalone it runs just fine and I can send and receive requests via SoapUI.

When I'm done with the examples I'll want to create my own project in eclipse and do tests in the IDE and in ServiceMix. I don't really understand the advantage of OSGi yet. SO I'm not too compelled to use OSGi for my project.

My main question is: Can I deploy a non-OSGi non-JBI compliant project in servicemix? Something like the camel-example-cxf-proxy. If yes, how can I do it? If no, how can I OSGi-fy the camel-example-cxf-proxy?

Thank you :)

like image 900
Ric Jafe Avatar asked Sep 07 '12 14:09

Ric Jafe


2 Answers

Apache ServiceMix which uses Apache Karaf as its kernel, support pluggable deployment units. Though OSGi is the main unit.

You can deploy JBI artifacts (eg JBI was used as deployment units for Apache ServiceMix 3.x). So we offer that as a migration path to run JBI in SMX 4.x.

A plain WAR file can be deployed as well. You can for example just drop a .war file in the deploy directory. If you deploy from the shell, you need to prefix the deployer with war so it knows to use the war deployer.

There is some documentation about the various pluggable deployers here http://fusesource.com/docs/esbent/7.0/esb_deploy_osgi/UrlHandlers.html

For example to install an Apache Wicket WAR example using Maven you can do from the shell:

osgi:install war:mvn:org.apache.wicket/wicket-examples/1.4.7/war?Web-ContextPath=wicket

The Apache documentation about deployer is mainly documented at Apache Karaf http://karaf.apache.org/manual/2.2.9/users-guide/deployer.html

Now to deploy OSGi applications can be a bit of pain to assemble. And that is why FuseSource created FAB to make it much easier. I blogged about this a bit, which references to videos and more material: http://www.davsclaus.com/2012/08/osgi-deployment-made-easy-with-fab.html

With FAB you can just deploy regular Maven projects out of the box without any OSGi pain.

like image 146
Claus Ibsen Avatar answered Sep 28 '22 16:09

Claus Ibsen


If your project is a maven project, you can try :

mvn install

Then start your servicemix, and in servicemix command line :

install mvn:groupId/artifactId/version

This will prompt a bundle ID. Then, juste start the bundle :

start <bundle_id>

You can check the state of your bundle with command "list"

like image 33
yodamad Avatar answered Sep 28 '22 17:09

yodamad