DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUGĀ·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=42172>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED ANDĀ·
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=42172


[EMAIL PROTECTED] changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|WONTFIX                     |




------- Additional Comments From [EMAIL PROTECTED]  2007-04-19 10:47 -------
I've been looking at this further and I really think there's something wrong
here.  What I find wrong comes down to the fact that the variable causing the
cross reference (ApplicationDispatcher.log) is a static.  How does a static
variable allow for the app server to do per webapp logging.  

So I created 2 identical webapps.  They have a single servlet that simply
dispatches to a JSP.  I added code to the dispatch that looks at the classloader
for the servlet, request dispatcher and the log of the request dispatcher.  I
then hit webapp 1 and then webapp2.  I reloaded both apps and did the same 
again.

The code and output is included below.  Basically the ApplicationDispatcher has
a log loaded by the classloader for the first webapp I hit.  After a reload the
log is still the log loaded by that first webapp classloader and that
classloader is marked not started.  In addition, the parent instance variable
defined in WebappClassLoader is null.

I'm not particularly knowledgeable about Tomcat yet but it would seem that using
classes loaded from one webapp while servicing the request for another webapp is
bad. And continuing to use classes loaded by a classloader that's been stopped
would seem a very bad idea.

=========== Code inserted into the servlet ===================
ServletContext sc = null;
RequestDispatcher rd = null;

sc = getServletContext();
rd = sc.getRequestDispatcher(uri);
                
Object log = getField(rd, "log");
ClassLoader loaderC = rd.getClass().getClassLoader();
System.out.println(loaderC);
ClassLoader loaderA = this.getClass().getClassLoader();
System.out.println(loaderA);
ClassLoader loaderB = log.getClass().getClassLoader();
System.out.println(loaderB);
                
System.out.println("servlet loader " + (loaderA == loaderB ? "equals" : "does
not equal") + " RequestDispatcher's log loader");
System.out.println("servlet loader " + (loaderA == loaderC ? "equals" : "does
not equal") + " RequestDispatcher loader");
System.out.println("RequestDispatcher's log loader " + (loaderB == loaderC ?
"equals" : "does not equal") + " RequestDispatcher loader");



================= Output immediately after the server comes up =======
WebappClassLoader
  delegate: false
  repositories:
    /WEB-INF/classes/
----------> Parent Classloader:
[EMAIL PROTECTED]

WebappClassLoader
  delegate: false
  repositories:
    /WEB-INF/classes/
----------> Parent Classloader:
[EMAIL PROTECTED]

servlet loader equals RequestDispatcher's log loader
servlet loader does not equal RequestDispatcher loader
RequestDispatcher's log loader does not equal RequestDispatcher loader
[EMAIL PROTECTED]
WebappClassLoader
  delegate: false
  repositories:
    /WEB-INF/classes/
----------> Parent Classloader:
[EMAIL PROTECTED]

WebappClassLoader
  delegate: false
  repositories:
    /WEB-INF/classes/
----------> Parent Classloader:
[EMAIL PROTECTED]

servlet loader does not equal RequestDispatcher's log loader
servlet loader does not equal RequestDispatcher loader
RequestDispatcher's log loader does not equal RequestDispatcher loader



============== Output after reloading both of the applications =======
[EMAIL PROTECTED]
WebappClassLoader
  delegate: false
  repositories:
    /WEB-INF/classes/
----------> Parent Classloader:
[EMAIL PROTECTED]

WebappClassLoader
  delegate: false
  repositories:

servlet loader does not equal RequestDispatcher's log loader
servlet loader does not equal RequestDispatcher loader
RequestDispatcher's log loader does not equal RequestDispatcher loader
[EMAIL PROTECTED]
WebappClassLoader
  delegate: false
  repositories:
    /WEB-INF/classes/
----------> Parent Classloader:
[EMAIL PROTECTED]

WebappClassLoader
  delegate: false
  repositories:

servlet loader does not equal RequestDispatcher's log loader
servlet loader does not equal RequestDispatcher loader
RequestDispatcher's log loader does not equal RequestDispatcher loader



-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to