tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Williamson <Mark.William...@Appropria.com>
Subject A bit of an odd one
Date Thu, 01 Jun 2000 12:01:26 GMT
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

Mime
View raw message