Re: OSGi Support

From: Jason Lee <>
Date: Fri, 11 Apr 2008 11:54:54 -0500

On Thu, Apr 10, 2008 at 6:19 PM, Hendrik Kammeyer <>

> Hi,
> I'm no JSF dev but i tried to start JSF within an OSGi environment for
> a whole week and ran into a lot of problems, although i got it working
> at last with MyFaces (1.1 or 1.2) + Facelets 1.1.13. Here is what i
> noticed, maybe it helps in your discussion:

Wow. That sounds painful. I'll try to digest all of this and see where it

> - It seems not to be a good idea to split up JSF to one part running in an
> OSGi bundle and the other part running outside, for the bundle has its
> own classloader. All classes within the bundle are invisible to the
> outside.

Right, which may mean making ViewHandlers, etc as separate bundles
difficult. I'm not sure that degree of modularization is even desirable. I
think the original request was just to get JSF deployed in an OSGi
container, not necessarily being able to swap out the internals at will...

> - As was already said, you could either run an OSGi platform within the
> servlet/JSP container or vice versa. Although the latter may be the
> preferred way, many users don't want to change their servers. When
> running OSGi within the servlet container, you have to bridge servlets
> into the OSGi platform (as org.eclipse.equinox.servletbridge does).
> Launching and configuring the OSGi platform is implementation-specific,
> o.e.e.servletbridge contains a replacable launcher for Equinox.

Hmm. OK. This will be the interesting part, I think.

> the JSF-bundle. However after re-installing it without stopping the vm
> i got some nasty classloader exceptions. I suppose there are some
> assumptions in the JSF spec (or in the MyFaces impl.) of the underlying
> classloader being part of the servlet container?

That I don't know. I'll need to reread that part of the spec carefully.

> - After all i did not manage to add content from other bundles to the
> running webapp, for the JSF API lacks of some functionality (forgive me
> if a am wrong, as i'm really no JSF expert...):
> - it seems not to be possible to add or remove managed beans at runtime
> - there is no remove*() equivalent to Application.addComponent(),
> addConverter and addValidator()
> - there is no way to add or remove Facelets taglibs at runtime
> - i found no way to map view-ids to Facelets pages from external
> bundles.

It may be that this JSF/OSGi bundle effort may need to be
implementation-specific and leverage private APIs (and adding some, if need
be) to make things work. Thoughts, anyone?

> I hope that helps you getting a feeling of what would need to be changed
> to
> support OSGi. And i hope you don't bury your plans now, as i am in need
> of that feature and a couple of similar requests in the Equinox
> Technology newsgroup had similar requests.

It helps a lot. Thanks for the feedback.

Jason Lee, SCJP
Software Architect -- Objectstream, Inc.
Mojarra and Mojarra Scales Dev Team