Hi John:
Since you have a "java.lang.ClassCastException" as the reported exception, I would
guess that it is the statement:
layer = (LayerBean)i.next();
that is causing the trouble. Some place in your servlet, you maybe are storing an
object which is not a LayerBean in your vector (named "list" in the session
variable)?? You may want to look at every place where you store something in this
vector, and maybe you will find some one or more places where you are saving
something which is not a LayerBean. (This may also explain why restarting the
server seems to make the problem "go away".)
If you want to be certain about where exactly the sever is running into trouble
with your jsp, you may want to look at the generated servlet and go to the line
number where the reported execption occurs. This will take the guess work out of
your debugging..
Cheers!
Geeta
John Cartwright wrote:
> Hello All,
>
> I am hoping someone can solve this mystery for me since I'm stumped.
>
> I have a servlet which populates a vector with beans. It then puts
> the
> vector into the request object and forwards to a JSP page.
>
> The JSP page pulls the vector out of the request and proceeds to
> call
> methods on each bean in the list.
>
> Sometimes the whole thing quits working and complains with a
>
> Internal Servlet Error:
> javax.servlet.ServletException: sde.LayerBean
> ...
> Root cause:
> java.lang.ClassCastException: sde.LayerBean
> ...
>
> Restarting tomcat solves the problem, but I'd like to understand
> what's
> going on. I'm assuming that it's the JSP page throwing the exception
> (the errorPage directive engages).
>
> Can someone enlighten me? I'm using Tomcat 3.2.1 (standalone) on
> Linux
> JDK1.3. The JSP page is listed below.
>
> Thanks!
>
> -- john
>
> <%@ page import="sde.LayerBean,java.util.*" %>
> <html>
> <body>
> <%
> Vector v = (Vector)request.getAttribute("list");
> LayerBean layer;
> Iterator i = v.iterator();
> while (i.hasNext()) {
> layer = (LayerBean)i.next();
> %>
> <%=layer.getTableName()%><BR>
> <% } %>
> </body>
> </html>
>
> --
> ===============================================================================
> John Cartwright
> Professional Research Assistant / Associate Scientist
> CIRES, SEG/NGDC/NOAA
> (303) 497-6284
> [EMAIL PROTECTED]
> ===============================================================================
>
> ___________________________________________________________________________
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
> of the message "signoff SERVLET-INTEREST".
>
> Archives: http://archives.java.sun.com/archives/servlet-interest.html
> Resources: http://java.sun.com/products/servlet/external-resources.html
> LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html