The JSPs are running in sling.  In order to share the session we installed
crx-launchpad and the other webapp in the same EAR with session sharing
enabled in the weblogic-applicaiton.xml


Sarwar


On Thu, Mar 3, 2011 at 10:01 AM, Felix Meschberger <[email protected]>wrote:

> Hi,
>
> Am Donnerstag, den 03.03.2011, 08:29 +0000 schrieb Sarwar Bhuiyan:
> > Hi felix, how does it work in the sling jsps then? Grabbing the object
> > from the session and casting it works in the JSP but not in a sling
> > servlet. (This is with us using the embedded dependencies bundle with
> > the same jar in the ear classpath.)  What makes it work in the JSP?
>
> What JSPs does it work in ? JSPs runing inside Sling or JSPs running in
> the other web application ?
>
> If it for JSPs in other Web Applications, it is such that the other web
> application just sees the ear classpath provided classes while in the
> OSGi framework this is not automatically the case ...
>
> Regards
> Felix
>
> > Sarwar
> >
> > On Thursday, March 3, 2011, Felix Meschberger <[email protected]>
> wrote:
> > > 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 <
> [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
> > >> >
> > >> >
> > >> >
> > >
> > >
> > >
>
>
>

Reply via email to