You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@geronimo.apache.org by Kevan Miller <ke...@gmail.com> on 2005/09/20 18:27:36 UTC

context-priority-classloader

I just had a look at a problem regarding context-priority-classloader 
reported on the user mailing list (original post is copied below). Hossam is 
attempting to override the SAAJ 1.2 implementation with a SAAJ
1.3implementation (claims that this works under JBoss). Is this
something which
should be supported? Geronimo has explicit checks which will prevent this. 
It's possible that a one line change could fix, but I'm not sure of all of 
the implications.

Both the JettyClassLoader and the TomcatClassLoader prevent javax 
classes/interfaces from being overridden by the context. Should the class 
loaders allow "javax" packages/subpackages to be overridden?

Here's the current list of restrictions for each ClassLoader:

TomcatClassLoader:
java, javax, org/apache/geronimo, org/apache/jasper, org/apache/tomcat, 
org/apache/naming, org/apache/catalina, org/xml, org/w3c

JettyClassLoader:
java, javax, org/apache/geronimo, org/mortbay, org/xml, org/w3c

Are these lists correct? Anything missing? Anything which should be removed?

--kevan

On 9/19/05, Hossam Karim <hr...@gmail.com> wrote to 
user@geronimo.apache.org:
> 
> 
> Hello,
> I am using the following configuration:
> geronimo-1.0-M4, Java 1.5.0_04, Windows 2003 Server Enterprise
> My problem:
> I am trying to deploy a WAR with the following deployment plan
> (geronimo-web.xml):
> =======================================
> <?xml version="1.0" encoding="UTF-8"?>
> <web-app xmlns="http://geronimo.apache.org/xml/ns/web"
> configId="emee/emee-message">
> <context-root>/emee-message</context-root>
> <context-priority-classloader>true</context-priority-classloader>
> </web-app>
> =======================================
> WEB-INF/lib contains saaj-api.jar and saaj-impl.jar, these are version
> 1.3 NOT 1.2 of SAAJ API,
> and I need to load these implementation not the one that comes with
> Geronimo, beacuse I need to call
> public static javax.xml.soap.MessageFactory
> newInstance(java.lang.String string) method.
> NoSuchMethodException is thrown when it is called, which means Geronimo
> is using SAAJ not the one I
> provided.
> 
> Is there a way I can instruct Geronimo to load the my library? it works
> with JBOSS!!
>

Re: context-priority-classloader

Posted by Davanum Srinivas <da...@gmail.com>.
Hossam,

Did you pick up the SAAJ 1.3 jar(s) from JWSDP?

thanks,
dims

On 9/20/05, Kevan Miller <ke...@gmail.com> wrote:
> I just had a look at a problem regarding context-priority-classloader
> reported on the user mailing list (original post is copied below). Hossam is
> attempting to override the SAAJ 1.2 implementation with a SAAJ 1.3
> implementation (claims that this works under JBoss). Is this something which
> should be supported? Geronimo has explicit checks which will prevent this.
> It's possible that a one line change could fix, but I'm not sure of all of
> the implications.
>  
>  Both the JettyClassLoader and the TomcatClassLoader prevent javax
> classes/interfaces from being overridden by the context. Should the class
> loaders allow "javax" packages/subpackages to be overridden?
>  
>  Here's the current list of restrictions for each ClassLoader:
>  
>  TomcatClassLoader:
>       java, javax, org/apache/geronimo, org/apache/jasper,
> org/apache/tomcat,  org/apache/naming,  org/apache/catalina, org/xml,
> org/w3c
>  
>  JettyClassLoader:
>       java, javax, org/apache/geronimo, org/mortbay, org/xml, org/w3c
>  
>  Are these lists correct? Anything missing? Anything which should be
> removed?
>  
>  --kevan
>  
>  
> On 9/19/05, Hossam Karim <hr...@gmail.com> wrote to
> user@geronimo.apache.org :
> > 
> > Hello,
> >   I am using the following configuration:
> >   geronimo-1.0-M4, Java 1.5.0_04, Windows 2003 Server Enterprise
> >   My problem:
> >     I am trying to deploy a WAR with the following deployment plan
> > (geronimo-web.xml):
> >     =======================================
> >     <?xml version=" 1.0" encoding="UTF-8"?>
> >     <web-app
> xmlns="http://geronimo.apache.org/xml/ns/web"
> > configId="emee/emee-message">
> >       <context-root>/emee-message</context-root> 
> >      
> <context-priority-classloader>true</context-priority-classloader>
> >     </web-app>
> >     =======================================
> >     WEB-INF/lib contains saaj-api.jar and saaj-impl.jar, these are version
> > 1.3 NOT 1.2 of SAAJ API,
> >     and I need to load these implementation not the one that comes with
> > Geronimo, beacuse I need to call
> >     public static javax.xml.soap.MessageFactory
> > newInstance(java.lang.String string) method.
> >     NoSuchMethodException is thrown when it is called, which means
> Geronimo
> > is using SAAJ not the one I
> >     provided.
> > 
> >     Is there a way I can instruct Geronimo to load the my library? it
> works 
> > with JBOSS!!
> > 
>  
>  


-- 
Davanum Srinivas : http://wso2.com/ - Oxygenating The Web Service Platform

Re: context-priority-classloader

Posted by Kevan Miller <ke...@gmail.com>.
Oops. Sent a note with more information, but just now noticed it wasn't to 
dev...

Jeremy pointed me to section 9.7.2 of the servlet spec. It says that a 
servlet container should not allow an application to override java.*, 
javax.* classes that J2SE or J2EE do not allow to be modified. So, by my 
reading, the current class loader implementations are entirely consistent 
with the servlet specification. We can get into spec-smithing as to the 
meaning of "allow to be modified".

Unless there are objections or alternative suggestions, I'll respond that 
overriding the SAAJ implementation via <context-priority-classloader> is not 
supported. Note that it seems that JBoss has different behavior...