This is possible (at least with Oscar 1.0.5.), there are some concern
you have to take into account. First you need to make sure you use the
correct classloader to get to the classes embedded in the bundles. That
should be too hard a problem. What doesn't work well is synchronizing
the oscar loaded objects across a cluster and serializing the objects
into the session.
Though the serialization works pretty well, the receiving side can't
instantiate the objects, as the classes can't be found by the servlet
container's classloader.
The Wicket framework has run into this problem as well. Everything works
quite well when run in a whole OSGi environment, but when there's a
mix'n'match with classloaders your in for some hard thinking. We woul
also like to see some solution for this problem ;-) Bright ideas are
welcome!
Martijn
Sylvain Wallez wrote:
Hi all,
There's an ongoing discussion over on the Cocoon developers list about
embedding an OSGi framework in a servlet engine.
Basically, Cocoon wants to use the nifty features brought by OSGi to
allow easy managment and deployement of what we call "blocks"
(high-level application services), which will be packaged as bundles.
Running Cocoon as a set of bundles within an OSGi framework is no
problem: the CocoonServlet registers itself to an existing HttpService
and we're done. Now Cocoon is mostly used as a servlet deployed on a
servlet engine, and we cannot limit ourselves to using the engines for
which an implementation of the HttpService exists. Cocoon must be able
to run on Websphere, Weblogic, JBoss, SAP appserver, you name it.
Technically, this means that we must be able to start an OSGi
framework within a web application context, which is managed by the
app server.
Is this possible? Do we need a special version of Felix that may have
some restrictions compared to a standalone framework (thinking to the
URL service)?
Thanks,
Sylvain