Reputation: 1663
I kind of need an advice here.
I want to modularize my existing Java web applications.
Tried to do it with maven and it worked somekind.
I managed to separate service layer in one module ('core') and other two web apps are using that same core module.
Now I want to try it with OSGi, I want to involve OSGi in modularization so I could use it when needed.
I have few issues here:
1. how to modularize any part of my application with OSGi, how to start with it? There are plenty of examples to start with OSGi but none is about doing that in existing application.
2. how to use it on a tomcat server? I'm aware that I need a OSGi container(Equinox,Apache Felix,..) to use OSGi but how to set Tomcat and OSGi container work together?
If anyone has some advices or can link me to some useful tutorials,
I would appreciate it very much.
Thanks in advance,
Milos.
Upvotes: 4
Views: 2837
Reputation: 3016
Using OSGi needs a deep knowledge of all OSGi features, especially the different class loading behaviour. You need to consider is OSGi really benefits your application. If you use Class.forName in an extensive manner, you'll get problems. There are also many third party libraries which are not easy to use with OSGi.
So, be sure to understand OSGi before change anything in your code. I would recommend the book OSGi in Depth and/or OSGi in Action for learning and understanding OSGi.
Don't get me wrong, OSGi is a nice technologie, but it is a lot harder than it seems on first sight. You won't need Tomcat if your application uses OSGi fully, a OSGi container is the runtime for OSGi applications as a Tomcat Server is another runtime environement. If you need to communicate with a Tomcat Server, you may use JMS or anything similar. Take a look at OSGi Remote Service
Upvotes: 2
Reputation: 2369
here is OSGi tutorials that help you to create/activate your bundle/web application.
http://blog.knowhowlab.org/2010/06/osgi-tutorial-from-project-structure-to.html
http://blog.knowhowlab.org/2010/10/osgi-tutorial-4-ways-to-activate-code.html
Upvotes: 4
Reputation: 6875
I'd recommend Spring Dynamic Modules (http://www.springsource.org/osgi). Its advantages are that you don't have to get your hands dirty with all the nasty details of OSGi, and can use it through Spring IOC.
Even if you want to deal with OSGi, it doesn't mean you have to make your existing application OSGi-aware. The two following specifications can help you abstract your components from the OSGi API:
Good luck!
Upvotes: 1