You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@geronimo.apache.org by tb...@yahoo.com on 2006/01/23 08:56:11 UTC

class loading issue

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 

Re: class loading issue

Posted by tb...@yahoo.com.
Yeah :(. I tried that, and it isn't working.
Basically, Geronimo says that some appender was loaded
by the TomcatClassLoader and another ConsoleAppender
was loaded by the sun.misc.LancherAppClassLoader.
Here's the full dump:

log4j:ERROR A "org.apache.log4j.ConsoleAppender"
object is not assignable to a "
org.apache.log4j.Appender" variable.
log4j:ERROR The class "org.apache.log4j.Appender" was
loaded by
log4j:ERROR
[org.apache.geronimo.tomcat.TomcatClassLoader@1413e5a]
whereas objec
t of type
log4j:ERROR "org.apache.log4j.ConsoleAppender" was
loaded by [sun.misc.Launcher$
AppClassLoader@53ba3d].
log4j:ERROR Could not instantiate appender named "A1".
log4j:ERROR Could not create an Appender. Reported
error follows.
java.lang.ClassCastException
        at
org.apache.log4j.xml.DOMConfigurator.parseAppender(DOMConfigurator.ja
va:165)
        at
org.apache.log4j.xml.DOMConfigurator.findAppenderByName(DOMConfigurat
or.java:140)
        at
org.apache.log4j.xml.DOMConfigurator.findAppenderByReference(DOMConfi
gurator.java:153)
        at
org.apache.log4j.xml.DOMConfigurator.parseChildrenOfLoggerElement(DOM
Configurator.java:415)
        at
org.apache.log4j.xml.DOMConfigurator.parseCategory(DOMConfigurator.ja
va:335)
        at
org.apache.log4j.xml.DOMConfigurator.parse(DOMConfigurator.java:788)
        at
org.apache.log4j.xml.DOMConfigurator.doConfigure(DOMConfigurator.java
:685)
        at
org.apache.log4j.xml.DOMConfigurator.configure(DOMConfigurator.java:5
43)
        at
org.openlaszlo.servlets.responders.ResponderLOGCONFIG.configure(Respo
nderLOGCONFIG.java:265)
        at
org.openlaszlo.servlets.responders.ResponderLOGCONFIG.configureWithLP
SConfig(ResponderLOGCONFIG.java:164)
        at
org.openlaszlo.servlets.responders.ResponderLOGCONFIG.configure(Respo
nderLOGCONFIG.java:120)
        at
org.openlaszlo.servlets.LZServlet.initLPS(LZServlet.java:122)
        at
org.openlaszlo.servlets.LZServlet.doGet(LZServlet.java:345)
        at
org.openlaszlo.servlets.LZServlet.doPost(LZServlet.java:522)
        at
javax.servlet.http.HttpServlet.service(HttpServlet.java:615)
        at
javax.servlet.http.HttpServlet.service(HttpServlet.java:688)
        at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
icationFilterChain.java:252)
        at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
ilterChain.java:173)
        at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperV
alve.java:213)
        at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextV
alve.java:178)
        at
org.apache.geronimo.tomcat.valve.DefaultSubjectValve.invoke(DefaultSu
bjectValve.java:46)
        at
org.apache.geronimo.tomcat.GeronimoStandardContext$SystemMethodValve.
invoke(GeronimoStandardContext.java:262)
        at
org.apache.geronimo.tomcat.valve.TransactionContextValve.invoke(Trans
actionContextValve.java:53)
        at
org.apache.geronimo.tomcat.valve.ComponentContextValve.invoke(Compone
ntContextValve.java:47)
        at
org.apache.geronimo.tomcat.valve.InstanceContextValve.invoke(Instance
ContextValve.java:60)
        at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.j
ava:126)
        at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.j
ava:105)
        at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineVal
ve.java:107)
        at
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:
541)
        at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.jav
a:148)
        at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java
:868)
        at
org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.p
rocessConnection(Http11BaseProtocol.java:663)
        at
org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpo
int.java:527)
        at
org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFol
lowerWorkerThread.java:80)
        at
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadP
ool.java:684)
        at java.lang.Thread.run(Thread.java:534)
log4j:WARN No appenders could be found for logger
(org.openlaszlo.i18n.LaszloMes
sages).
log4j:WARN Please initialize the log4j system
properly.


Thanks,
Tyler



--- Gianny Damour <gi...@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 

Re: class loading issue

Posted by tb...@yahoo.com.
Even better!
Tyler

--- Gianny Damour <gi...@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 <gi...@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 

Re: class loading issue

Posted by Gianny Damour <gi...@optusnet.com.au>.
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 <gi...@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 
>



Re: class loading issue

Posted by tb...@yahoo.com.
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 <gi...@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 

Re: class loading issue

Posted by Gianny Damour <gi...@optusnet.com.au>.
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 
>



Re: class loading issue

Posted by tb...@yahoo.com.
Even better!
Tyler

--- Aaron Mulder <am...@alumni.princeton.edu>
wrote:

> Tyler,
> 
> You shouldn't need any code changes for this.  If
> you want to hide
> classes on the server class path from your
> application, just add
> <hidden-classes> elements to your web plan listing
> the packages you
> want to hide.  e.g.:
> 
>
<hidden-classes><filter>org.apache.log4j</filter></hidden-classes>
>
<hidden-classes><filter>org.apache.axis</filter></hidden-classes>
> ...
> 
> See also
>
http://chariotsolutions.com/geronimo/web-plan.html#web-plan-libs
> 
> You will still need the files in your WEB-INF/lib,
> but if you hide all
> the versions from the server, it shouldn't even
> matter how the
> context-priority-classloader is set.
> 
> Thanks,
>     Aaron
> 
> On 1/23/06, tbot55@yahoo.com <tb...@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 

Re: class loading issue

Posted by Aaron Mulder <am...@alumni.princeton.edu>.
Tyler,

You shouldn't need any code changes for this.  If you want to hide
classes on the server class path from your application, just add
<hidden-classes> elements to your web plan listing the packages you
want to hide.  e.g.:

<hidden-classes><filter>org.apache.log4j</filter></hidden-classes>
<hidden-classes><filter>org.apache.axis</filter></hidden-classes>
...

See also http://chariotsolutions.com/geronimo/web-plan.html#web-plan-libs

You will still need the files in your WEB-INF/lib, but if you hide all
the versions from the server, it shouldn't even matter how the
context-priority-classloader is set.

Thanks,
    Aaron

On 1/23/06, tbot55@yahoo.com <tb...@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
>
>