JSP Error during runtime (java.lang.ClassClassException)

Hey i run a web server, and when running a jsp which included a jsp tag expression (<% %>) i get a java.lang.ClassCastException, i use the JavvServer Web Development Kit (JSWDK) to host my web server.

This is my jsp page code:

<html>

<head>

<title>Auction Mania - Withdraw Auction</title>

</head>

<%@ pageimport ="Auction.*" %>

<%@ pageimport ="java.util.Vector" %>

<% Customer aCustomer = (Customer) request.getSession().getValue("customer"); %>

<% Bids aBids = (Bids) request.getSession().getValue("bidSell"); %>

<body>

<% Vector bids =new Vector(); %>

<div align="center">

<font color="#FF0000" size="+4" face="Verdana, Arial, Helvetica, sans-serif">Auction

Mania<font size="+3">?lt;/font></font>

<hr>

<p align="left"><strong>Hey <%= aCustomer.getCustomerName() %>!!</strong>

<p align="right"><a href="http://localhost:8080/servlet/Auction.LogoutServlet">Log Out</a>

<hr>

<font color="#0000FF" size="4" face="Verdana, Arial, Helvetica, sans-serif">Withdraw An Auction:</font>

<table align="center" width="84%" border="0" cellpadding="5">

<tr>

<td align="center" width="21%"><strong>Bid Section</strong></td>

<td align="center" width="18%"><strong>Current Amount</strong></td>

<td align="center" width="11%"><strong> End Date</strong></td>

<td align="center" width="23%"><strong>Bid Description</strong></td>

<td align="center" width="17%">?lt;/td>

</tr>

<%

try

{

bids = aBids.findCustomerSell(aCustomer.getCustomerID());

for (int i = 0; i < bids.size(); i++)

{

aBids = (Bids) bids.get(i);

%>

<tr bordercolor="#FFFFFF">

<td><%= aBids.getBidSection() %></td>

<td><%= aBids.getBidAmount() %></td>

<td><%= aBids.getBidEnd() %></td>

<td><%= aBids.getBidDescription() %></td>

<td align="center"> <form name="BidForm" method="post" action="http://localhost:8080/servlet/Auction.WithdrawServlet">

<input type="submit" name="Submit" value="Close Auction" onClick="submit();">

<input type="hidden" name="bid" value="<%= aBids.getBidID() %>">

</form></td>

</tr>

<%

}

}

catch (NotFoundException nfe)

{

System.out.println(nfe);

}

%>

</table>

Press the <strong><a href="CustMenu.jsp">BACK</a></strong> button to go back to the your customer menu.

<p align="center">?lt;/p>

?lt;/p>

</div>

</body>

</html>

And this is the error i get on my command prompt when running the jsp page:

java.lang.ClassCastException

at webpages.Auction.CloseAuction_jsp_1._jspService(CloseAuction_jsp_1.ja

va:77)

at com.sun.jsp.runtime.HttpJspBase.service(HttpJspBase.java:87)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:840)

at com.sun.jsp.runtime.JspServlet$JspServletWrapper.service(JspServlet.j

ava:88)

at com.sun.jsp.runtime.JspServlet.serviceJspFile(JspServlet.java:218)

at com.sun.jsp.runtime.JspServlet.service(JspServlet.java:294)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:840)

at com.sun.web.core.ServletWrapper.handleRequest(ServletWrapper.java:155

)

at com.sun.web.core.Context.handleRequest(Context.java:414)

at com.sun.web.server.ConnectionHandler.run(ConnectionHandler.java:139)

HANDLER THREAD PROBLEM: java.net.SocketException: Socket is closed

java.net.SocketException: Socket is closed

at java.net.Socket.getInputStream(Socket.java:698)

at com.sun.web.server.ConnectionHandler.run(ConnectionHandler.java:161)

Please any help will be grateful..... Thnx in advance

[5769 byte] By [evomasea] at [2007-10-1 1:00:37]
# 1

Well the error is coming from one of these lines:

<% Customer aCustomer = (Customer) request.getSession().getValue("customer"); %>

<% Bids aBids = (Bids) request.getSession().getValue("bidSell"); %>

aBids = (Bids) bids.get(i);

These are the lines you are doing a cast on.

Check:

session attribute "customer" is a Customer object.

session attribute(bidSell) is a Bid object.

findCustomerSell returns a Vector of "Bid" objects.

Why aren't you using the jsp:useBean tag?

<jsp:useBean id="customer" type="Auction.customer" scope="session"/>

For that matter WHY are you using JSWDK? Things have gotten so much better since then.

bleh

evnafets

evnafetsa at 2007-7-8 1:19:40 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...