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 12:57:33 GMT
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):
>
>------------------------------------------------------
>
>TomcatClassLoader.ResourceClassLoader.getResource:----
>
>------------------------------------------------------
> >           if ((contextPriorityClassLoader &&
> >                name.startsWith("org/apache/axis"))
> ||
> >               (contextPriorityClassLoader &&
> >               
> >name.startsWith("org/apache/commons/httpclient"))){
> >           }
> >           else if (true
> >||//!contextPriorityClassLoader ||
> >...
> >           return super.loadClass(name);
> >       }
>
>------------------------------------------------------
> >TomcatClassLoader.loadClass:
> -------------------------
>
>------------------------------------------------------
> >           if ((contextPriorityClassLoader &&
> >                name.startsWith("org.apache.axis"))
> ||
> >               (contextPriorityClassLoader &&
> >               
> >name.startsWith("org.apache.commons.httpclient"))){
> >           }
> >           else if (true
> >||//!contextPriorityClassLoader ||
> >...
> >               return super.loadClass(name);
> >           }
>
>-----------------------------------------------------------
>
>-----------------------------------------------------------
> >
> >This makes the application work. Now, I did try
> just
> >setting context-priority-classloader to true
> without
> >doing these modifications, and I got errors about
> not
> >initializing log4j properly. Is there a better way
> to
> >make the class loader do what I want to do?
> >
> >Tyler
> >
> >__________________________________________________
> >Do You Yahoo!?
> >Tired of spam?  Yahoo! Mail has the best spam
> protection around 
> >http://mail.yahoo.com 
> >
> 
> 
> 

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