Two questions..
1. Why would the classes be resolved in JSP components when exported
from a OSGI bundle which includes all the shared jars.
Here they are not getting loaded by shared ear class loader.
Some colleagues told me that session objects are actually getting
serialized and then deserialized in OSGI container, so the behaviour
is similar to how remote calls work with serialization.
2. How does OSGI framework know about Ear classloader as its parent
classloader (and not go to Java system classloader)?
In the OSGI bundles, if I try to get parent classloader by calling
getClassLoader().getParent(), I get null, which I suppose means
bootstrap classloader.
Thanks,
Unmesh
On Thu, Mar 3, 2011 at 4:21 AM, Felix Meschberger <[email protected]> wrote:
> Hi,
>
> In CQ/Sling we use HttpSession objects created by the servlet container
> used. In your case this would be the weblogic server.
>
> The problem with the objects in the session is that the same classes
> (class objects) must be used in the OSGi framework as well as in the
> other parts of the EAR.
>
> So the classes must be loaded from a shared class loader. To do this in
> the OSGi framework you will want to use a feature call system package
> exports.
>
> The easiest way to get this done is creating a framework extension
> fragment which attaches to the system bundle and enhances the exports of
> that system bundle.
>
> Refer to [1] for how this could be done.
>
> Regards
> Felix
>
> [1]http://blog.meschberger.ch/2008/10/osgi-framework-extension-as-maven.html
>
> Am Mittwoch, den 02.03.2011, 22:10 +0000 schrieb Unmesh Joshi:
>> Hi,
>>
>> In our current project, we have a mix of sling servlets (as part of
>> CQ) and an old spring mvc application. The migration is planned to
>> move completely to sling/CQ. But till the complete migration happens,
>> these two need to coexist in the same web container (weblogic in this
>> case).
>> We have a successful POC working where JSPs, which are CQ components,
>> can access session objects set by other web applications. (Made
>> possible by session sharing facility in weblogic). For refering to the
>> Java classes in JSP, they need to be packaged and exported as an OSGI
>> bundle.
>> I am trying to understand how http session handling happens in OSGI
>> container (felix) and other web applications in same web container.
>> Because, if I try to use the same class in sling servlet (which is
>> packaged as OSGI bundle), I get ClassCastException (as expected).
>>
>> Are there any pointers which explain how class loading works in HTTP
>> service in Felix?
>>
>> Thanks,
>> Unmesh
>
>
>