geronimo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <tbo...@yahoo.com>
Subject Re: class loading issue
Date Mon, 23 Jan 2006 14:53:33 GMT
Even better!
Tyler

--- Gianny Damour <gianny.damour@optusnet.com.au>
wrote:

> Now that I do know that Log4J in also in
> WEB-INF/lib, I think this works:
> 
> 1. set context-priority-classloader to false (or do
> not set it at all); and
> 2. add these filters to your geronimo-web.xml DD:
> 
>     <hidden-classes>
>         <filter>org.jdom</filter>
>     </hidden-classes>
>     <hidden-classes>
>         <filter>org.apache.axis</filter>
>     </hidden-classes>
>     <hidden-classes>
>         <filter>org.apache.commons.logging</filter>
>     </hidden-classes>
>     <hidden-classes>
>         <filter>org.apache.log4j</filter>
>     </hidden-classes>
> 
> TomcatClassLoader is a child of the CL of the
> configuration running the 
> WAR module. The above filters hide the jdom, axis,
> commons-logging and 
> Log4J classes defined by a parent configuration of
> this WAR module; 
> hence, it allows you to provide your own jdom, axis,
> commons-logging and 
> axis versions.
> 
> Thanks,
> Gianny
> 
> 
> tbot55@yahoo.com wrote:
> 
> >OK, this time my workaround is probably the fix you
> >guys need to commit into HEAD. Someone can get
> credit
> >for submitting a bug with the fix.
> >
> >Yeah, so the app I'm running also has its own
> >org.apache.commons.logging and org.apache.log4j, so
> I
> >added those entries in the TomcatClassLoader
> methods
> >(the full file is attached):
>
>----------------------------------------------------------
>
>TomcatClassLoader.loadClass:------------------------------
>
>----------------------------------------------------------
> >   public Class loadClass(String name) throws
> >ClassNotFoundException {
> >       if (!contextPriorityClassLoader ||
> >           name.startsWith("java.") ||
> >           name.startsWith("javax.") ||
> >           name.startsWith("org.apache.geronimo.")
> ||
> >           name.startsWith("org.apache.jasper.") ||
> >           name.startsWith("org.apache.tomcat.") ||
> >           name.startsWith("org.apache.naming.") ||
> >           name.startsWith("org.apache.catalina.")
> ||
> >           name.startsWith("org.apache.log4j.") ||
> >          
> >name.startsWith("org.apache.commons.logging.") ||
> >           name.startsWith("org.xml.") ||
> >           name.startsWith("org.w3c.")) {
> >           return super.loadClass(name);
> >       }
> >...
>
>----------------------------------------------------------
>
>TomcatClassLoader.ResourceClassLoader.getResource:--------
>
>----------------------------------------------------------
> >       public URL getResource(String name) {
> >           if (!contextPriorityClassLoader ||
> >               name.startsWith("java/") ||
> >               name.startsWith("javax/") ||
> >              
> name.startsWith("org/apache/geronimo/")
> >||
> >              
> name.startsWith("org/apache/jasper/")
> >||
> >              
> name.startsWith("org/apache/tomcat/")
> >||
> >              
> name.startsWith("org/apache/naming/")
> >||
> >              
> name.startsWith("org/apache/catalina/")
> >||
> >              
> >name.startsWith("org/apache/commons/logging/") ||
> >               name.startsWith("org/apache/log4j/")
> ||
> >               name.startsWith("org/xml/") ||
> >               name.startsWith("org/w3c/")) {
> >               return super.getResource(name);
> >           }
> >...
>
>----------------------------------------------------------
> >
> >Please let me know when someone has committed this
> fix
> >into HEAD. BTW, Gianny, I'm following both of your
> >steps, and modified the TomcatClassLoader.java
> file,
> >as shown above. The full modified
> >TomcatClassLoader.java file is attached.
> >
> >Thanks!
> >Tyler
> >
> >
> >
> >--- Gianny Damour <gianny.damour@optusnet.com.au>
> >wrote:
> >
> >  
> >
> >>Hello Tyler,
> >>
> >>Could you please try this configuration?
> >>1. set context-priority-classloader to true; and
> >>2. put your own jdom, axis and commons-httpclient
> >>jars in WEB-INF/lib.
> >>
> >>I think that it should work with this approach.
> >>
> >>If not (due to Log4J initialization problem?),
> then
> >>could you please 
> >>provide a stack-trace of the error?
> >>
> >>Thanks,
> >>Gianny
> >>
> >>
> >>tbot55@yahoo.com wrote:
> >>
> >>    
> >>
> >>>I must be misunderstanding something. Here's my
> >>>problem. I'm trying to use an application that
> >>>requires a different version of jdom.jar and
> >>>      
> >>>
> >>axis.jar,
> >>    
> >>
> >>>and it also uses commons-httpclient.jar, which
> >>>      
> >>>
> >>isn't
> >>    
> >>
> >>>found in the geronimo repository.
> >>>
> >>>It does some webservices stuff. So I replace the
> >>>jdom.jar in the repository directory and I bypass
> >>>      
> >>>
> >>one
> >>    
> >>
> >>>of my problems. Then I have to somewhat merge the
> >>>axis.jar it comes with and the one in the
> geronimo
> >>>repository, and I overcome another problem
> (though
> >>>      
> >>>
> >>now
> >>    
> >>
> >>>the daytrader example is breaking). After this,
> I'm
> >>>getting a commons-httpclient class-not-found
> error,
> >>>even though I've manually added it to the
> >>>      
> >>>
> >>repository.
> >>    
> >>
> >>>So, I figure out another workaround: I set the
> >>>context-priority-classloader variable to true in
> >>>      
> >>>
> >>the
> >>    
> >>
> >>>geronimo-web.xml, and I modify the
> >>>TomcatClassLoader.java file to this (full
> modified
> >>>TomcatClassLoader.java file attached):
> >>>      
> >>>
>
>>------------------------------------------------------
> >>
> 
=== message truncated ===


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

Mime
View raw message