On Wed, Jun 27, 2012 at 7:54 AM,  <[email protected]> wrote:
> I've been re-architecting an app that embedded a felix container into an 
> existing web app.  This came about because of a requirement for hot 
> deployment that arrived after the "host" app was already built and deployed 
> into the field.  The classloader bit itself is tricky ( actually, though, 
> it's also a great case study deep diving on classloaders).  The biggest 
> problem for me came out of the fact that a lot of classes were needed by both 
> the host app and the bundles that we're going to be installed into the 
> container.
>
> I found myself wishing I had time to re-implement the host app as an OSGi app.

Yeah, that is a common wish from devs in Atlassian.  Correctly
straddling that boundary is a pain.  How we do it is force all api
jars in WEB-INF/lib so both sides can access the classes, expose them
via our package scanner, then allow the web app to register services
(called host components) that will be exposed up to OSGi-land and
along the way, get wrapped in a proxy that will switch the context
classloader so the host components will hopefully work correctly.  All
this is Open Source, so if you ever want to poke around, go nuts:
https://bitbucket.org/atlassian/atlassian-plugins

>> Furthermore, many, if not most, web application libraries are built assuming
>> the context classloader has full access to the whole webapp, which isn't the
>> case in OSGi land where the CCL is actually undefined.
>
> For instance, Hibernate.

Yeah, we use Hibernate a lot, so what we do is just leave that in the
host app and expose services up to OSGi-land.  Not a lot of good ORMs
out there that are OSGi/multiple classloader friendly.

Don

>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to