Hi Damian, I cannot tell who's right. But to me using the context class loader from the registration moment does not look as the right approach as it can be any class loader not the one that registered the servlet. Back to your case, can you be more detailed about your use case? How is the servlet supposed to work if it does not import the necessary packages? Does it do work on behalf or another bundles, doing a kind of dynamic loading? Works like an extender?
Alin On Feb 19, 2008 1:25 AM, Damian Gołda <[EMAIL PROTECTED]> wrote: > In my application I used Equinox HttpService implementation but now > I'm trying to move to Pax Web. > I have a problem with different class loader strategy used in these > two implementations: > 1. While registering of servlet, Equinox creates ServletRegistration > instance and stores current context classloader. Then, while > Servlet.service (in class > HttpServletManager.InternalHttpServiceServlet), this previously stored > classloader is temporary set as a context class loader. > 2. HttpService from Pax web is created by ServiceFactory for each > bundle using it. And each instance of HttpServiceStarted has reference > to such bundle and creates also new BundleClassLoader (from Swiss > Box), which is used while Servlet.service. > > First case works in my application, because context class loader used > while servlet registration has access to all needed classes. > Second case don't works, because my bundle registering servlet don't > import some packages, so I have ClassNotFoundException while > Servlet.service(). > > What implementation of HttpService works correct? > I suppose Pax Web :-) but I'm not sure. > So I don't know whether I should add some (sometimes strange) imports > to my bundle or there is an error in Pax Web... > > P.S. > In OSGI 4.1 spec I can't find anything about classloaders in > HttpService description. > > -- > Damian > > _______________________________________________ > general mailing list > [email protected] > http://lists.ops4j.org/mailman/listinfo/general > _______________________________________________ general mailing list [email protected] http://lists.ops4j.org/mailman/listinfo/general
