Alin, Niclas - thank you for your comments!

2008/2/19, Niclas Hedhman <[EMAIL PROTECTED]>:
> On Tuesday 19 February 2008 01:25, Damian Gołda wrote:
> > What implementation of HttpService works correct?
>
> Neither.
>
> > P.S.
> > In OSGI 4.1 spec I can't find anything about classloaders in
> > HttpService description.
>
> Correct observation. Http Service spec doesn't involve classloading, and
> servlets are not supposed to do any classloading on their own, as all
> resources are expected to be resolved via a supplied HttpContext.

In my case I use default HttpContext created by HttpService.
So I think that specification should define, how such default
HttpContext should use class loader and what class loader should be
set as context class loader during Servlet.service().

>
> Both Equinox and Pax are trying to extend the spec. Not sure of the Equinox
> strategy, but Alin is trying to be as spec compliant as possible with
> the "Pax Web" project, and put the extensions in separate subsystems, such
> as "Pax Web Extender".
>
> Your case; You are depending on an unspecified behavior and therefor will be
> implementation dependent. So, trying to get away from such behavior is your
> best choice, and I can't comment on that since I don't know the details. If
> that is not an option, you should choose a strategy that you think is closest
> to a possible future spec in this area. Perhaps bring the topic to
> [EMAIL PROTECTED] mailing list for feedback.

My problem was: whether equinox behavior is not correct and my
application should be corrected to work correct in pax web OR my app
is correct and pax web has error.
Now, I'm sure that error was in my app.
I give you more details:

Bundle 1: wicket 1.3 (bundled by myself) with DynamicImport-Package: *
Bundle 2: Main application bundle (doesn' import addon packages) -
registers WicketServlet
Bundle 3: Application addon

As I found later, problem was that
org.apache.wicket.application.DefaultClassResolver.resolveClass(String)
could not find class from addon package after switching to pax web.
Using Equinox Http service classes from addon bundle were visible to
wicket-bundle.

Of course I can add DynamicImport-Package: * to my application bundle,
but why - when wicket bundle performs loading..

The origin of my problem, as I think, is code in wicket's DefaultClassResolver:

ClassLoader loader = Thread.currentThread().getContextClassLoader();
if (loader == null)
{
  loader = DefaultClassResolver.class.getClassLoader();
}
clazz = loader.loadClass(classname);

It cannot find needed class (from my addon bundle) when it is not
visible to context class loader but is visible to wicket's
(DefaultClassResolver.class) one.

When I use fixed ClassResolver, my app works correct on pax web,
without other changes.

Cheers
-- 
Damian
_______________________________________________
general mailing list
[email protected]
http://lists.ops4j.org/mailman/listinfo/general

Reply via email to