Mantis - Resin
|
|||||
Viewing Issue Advanced Details | |||||
|
|||||
ID: | Category: | Severity: | Reproducibility: | Date Submitted: | Last Update: |
4248 | minor | always | 10-07-10 14:52 | 11-10-10 09:59 | |
|
|||||
Reporter: | emil | Platform: | |||
Assigned To: | ferg | OS: | |||
Priority: | normal | OS Version: | |||
Status: | closed | Product Version: | 4.0.10 | ||
Product Build: | Resolution: | fixed | |||
Projection: | none | ||||
ETA: | none | Fixed in Version: | 4.0.14 | ||
|
|||||
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: | |||||
Relationships | |||||
Attached Files: |
Notes | |||||
|
|||||
|
|
||||
|
|||||
|
|