Mantis Bugtracker
  

Viewing Issue Advanced Details Jump to Notes ] View Simple ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0004248 [Resin] minor always 10-07-10 14:52 11-10-10 09:59
Reporter emil View Status public  
Assigned To ferg
Priority normal Resolution fixed Platform
Status closed   OS
Projection none   OS Version
ETA none Fixed in Version 4.0.14 Product Version 4.0.10
  Product Build
Summary 0004248: wrong classloader in forwarded webapp
Description (rep by jessicay on forums)

Hello,

I am upgrading from resin 3.2.1 to resin 4.0.10, and noticed some unexpected behaviour change about session attribute in request forwarding.

I was trying to do this:

1. There are webapp_a and webapp_b
2. Request is forwarded from webapp_a to webapp_b
3. In webapp_b,
the request is first processed by TestServlet, then the code does the following to add a sessionAttribute and forward to an hello.jsp page located under webapp_b
SomeObj obj = new SomeObj(); // SomeObj does not implement java.io.Serializable
HttpSession session = request.getSession();
session.setAttribute("test.attribute.name", obj);
this.getServletContext().getRequestDispatcher("/hello.jsp").forward(request, response);
in hello.jsp, we retrive the object from the session attribute and do some further processing.
SomeObj sObj = (SomeObj)session.getAttribute("test.attribute.name ");

resin 3.2.1 works fine, whereas resin 4.0.10 throws ClassCastException when the the request is forwarded although the class type is correct and the object is original.
I think this is related to ClassLoader.

To find out, I printed out the ClassLoader used in hello.jsp and found:
resin 3.2.1 used (DynamicClassLoader[SimpleLoader[C:/resin-3.2.1/webapps/webapp_b/WEB-INF/work]])
resin 4.0.10 used (DynamicClassLoader[SimpleLoader[C:/resin-4.0.10/webapps/webapp_a/WEB-INF/work]])

Please note the ClassLoader difference in resin 3.2.1 and resin 4.0.10, resin 4.0.10 ClassLoader has webapp_a although it is in webapp_b.
Once I made SomeObj implements java.io.Serializable, resin 4.0.10 would work, however, this should not be needed as the session attribute object is retrieved within the same webapp.

BTW, this is a single server environment on windows. What else can I do to make resin 4.0.10 behaves the same way as resin 3.2.1 regarding this issue?
Thanks,

---

in step 2, I did:

//forwarding request
RequestDispatcher rd = servletContext.getContext("/webapp_b").getRequestDispatcher("/servlet/TestServlet");
rd.forward(request, response);
Steps To Reproduce
Additional Information
Attached Files

- Relationships

- Notes
(0004822)
nicolai
11-08-10 11:15

We're seeing this issue as well.
 
(0004827)
ferg
11-10-10 09:59

server/1s30
 

- Issue History
Date Modified Username Field Change
10-07-10 14:52 emil New Issue
11-02-10 13:15 nicolai Issue Monitored: nicolai
11-08-10 11:15 nicolai Note Added: 0004822
11-10-10 09:59 ferg Note Added: 0004827
11-10-10 09:59 ferg Assigned To  => ferg
11-10-10 09:59 ferg Status new => closed
11-10-10 09:59 ferg Resolution open => fixed
11-10-10 09:59 ferg Fixed in Version  => 4.0.14


Mantis 1.0.0rc3[^]
Copyright © 2000 - 2005 Mantis Group
33 total queries executed.
28 unique queries executed.
Powered by Mantis Bugtracker