Hi, Am Mittwoch, den 02.03.2011, 23:02 +0000 schrieb Sarwar Bhuiyan: > Ah, so it is not enough to have a bundle with embedded libs( the > dependencies) and in another jar weblogicwith the same dependencies or the > EAR's classpath?
No, this is the Java classloading 101. An object has a reference to is Class object (see Object.getClass()). For two parts of Java to access the same object the have to have visibility to the same Class object. Both parts need to have access to the same class objects thus the requirement of loading the classes from a shared class loader. It is not enough for them to see the same class bytes. Regards Felix > > Sarwar > > On Wed, Mar 2, 2011 at 10:51 PM, Felix Meschberger <fmesc...@adobe.com>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 > > > > > >