Dienstag, 15. Juli 2008

Spring Dynamic Modules

The Equinox servlet bridge is a nice thing. If you only need JSP / JSTL it's a super base to build your OSGi-Webapplication. The problem is there are not yet JSF Plugins to get running JSF.
So there are some ways to achieve this. One of them is to use Spring Dynamic Modules. But the begin is never easy. But I was lucky and found a great tutorial on springosgi.googlepages.com. Because I had many questions in the Google Group Spring Osgi Oleg was so friendly and extended his tutorial on JSF. Great!

Donnerstag, 17. April 2008

Equinox in a Servlet Container Step by Step

If you want to run OSGi with Servlets on an Apache Tomcat for example a very good start is Equinox in a Servlet Container
First do the things with the number 1,2 and 3 you can find in the section Quickstart.
And now it is time to install and get to run the sample.http and sample.http.registry examples.
Download these both examples and extract them anywhere on your harddisk.
Now start Eclipse and choose File>Import>General>Existing Projects into Workspace and import these both projects.Then these both projects can be seen in your eclipse project explorer. Now export them both as jar on your harddisk and please not in a directory of your tomcat. Make a rightklick on the sample.http project and choose export>jar.

In the next step choose a place where the jar should be exported. It is not in your tomcat directory but anywhere on your harddisk:

In the next window click on next and be careful with the next window:

Here you have to choose the manifest file of the sample.http project. Click then on finish and do these same steps with the sample.http.registry.
At the end you should have two jars.

Tomcat should run now, so please start it if it not does.
You should see the console now:

Now write in this window -console and hit the Enter-button to get the osgi console. The result should be that:

Now you have to install these two jars you exported before. Enter in the console
install file:/pathofthejar/jarname for the samplehttp.jar and the samplehttpregistry.jar.
In my case it is this:

The result are two ids for every jar.
Now start this jars with start id. In my case it is start 14 and start 15 as you see here:

Now with the command ss you can see the status and these both plugin should run and have the status ACTIVE.

Now your plugins are running and correctly installed.
You can see them in action if you type hostOfTomcat/directory where bridge is installed/helloworld for sample.http and hostOfTomcat/directory where bridge is installed/ext/helloworld for sample.http.registry.
In my case http://localhost:8080/bridge/helloworld and http://localhost:8080/bridge/ext/helloworld
Have fun!