Return-Path: Mailing-List: contact tomcat-user-help@jakarta.apache.org; run by ezmlm Delivered-To: mailing list tomcat-user@jakarta.apache.org Received: (qmail 36777 invoked from network); 1 Jun 2000 13:13:49 -0000 Received: from firewall.datacad.co.uk (193.130.144.188) by locus.apache.org with SMTP; 1 Jun 2000 13:13:49 -0000 Received: from firewall.datacad.co.uk [193.130.144.188] (HELO localhost) by firewall.datacad.co.uk (AltaVista Mail V2.0J/1.0 BL25J listener) id 0000_0199_3936_619b_0768; Thu, 01 Jun 2000 14:14:03 +0100 Message-ID: From: Mark Williamson To: "'tomcat-user@jakarta.apache.org'" Subject: RE: A bit of an odd one Date: Thu, 1 Jun 2000 14:32:13 +0100 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2650.21) Content-Type: text/plain; charset="iso-8859-1" X-Spam-Rating: locus.apache.org 1.6.2 0/1000/N OK, sorry to keep adding bits - my last comment was wrong about fixing it by putting it somewhere else. I have come to the conclusion that the reason I can't cast it is because I am using two different class loaders one for the Servlet and one for the JSP - when I do a toString() on the class loader for objects made in the Servlet and objects made in the jsp I get different classes (the @9f81... bit at the end is different). How can this be so? I thought that the servlet engine and the JSP engine in tomcat were all part of the same thing? How can I solve this problem and force them to use the same class loader? mark -----Original Message----- From: Mark Williamson [mailto:Mark.Williamson@Appropria.com] Sent: 01 June 2000 13:01 To: 'tomcat-user@jakarta.apache.org' Subject: A bit of an odd one Hi, A bit of an odd one this. Essentially we have a servlet that contains the following bit of code: Assembler assembler = new Assembler(); req.setAttribute("Assembler", assembler); // get request dispatcher from servlet context RequestDispatcher requestDispatcher = servletContext.getRequestDispatcher(template); // forward the request requestDispatcher.forward(req, res); And in the jsp code (pointed to by template) we have this : <% obj = request.getAttribute("Assembler"); if ( obj != null ) { System.out.println( obj.getClass() ); // debugging stuff Assembler pageAssembler = (Assembler) obj; } %> What happens is that obj is indeed not null. The class comes out exactly as expected and then this error ensues: java.lang.ClassCastException: com.appropria.xtriffid.assembler.Assembler at jsp._0002fjsp_0002fstandard_0002ejspstandard_jsp_42._jspService(_0002fjsp_00 02fstandard_0002ejspstandard_jsp_42.java:104) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:126) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) [snip] this is the root cause of a servlet exception. Does anyone have any idea why this is happening? cheers mark -------------------------------------------------------------------------- To unsubscribe, email: tomcat-user-unsubscribe@jakarta.apache.org For additional commmands, email: tomcat-user-help@jakarta.apache.org -------------------------------------------------------------------------- To unsubscribe, email: tomcat-user-unsubscribe@jakarta.apache.org For additional commmands, email: tomcat-user-help@jakarta.apache.org