You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Scott Cressler <sc...@propel.com> on 2001/04/05 17:50:08 UTC

Problem finding classes after forward (resend)

Many apologies for resending this, but I had not finished subscribing when I
sent it the first time, and I don't know if it was, therefore, filtered out
(since I didn't receive it ;-).

Sorry, but I'm still having the problem described below:

-----Original Message-----
From: Scott Cressler 
Sent: Thursday, April 05, 2001 8:22 AM
To: 'struts-user@jakarta.apache.org'
Subject: Problem finding classes after forward


I'm trying to refit an existing page to use struts.  The JSP page that I
forward to at the end of my Action class uses some classes, but when
forwarding to it through the struts ActionForward mechanism, the page seems
unable to find the classes.  Strangely enough, one that it can't find is my
form bean class, which it just used in the Action class.  I was trying to
get to that class both through a <jsp:useBean> and through
<jsp:getProperty>.  The exception I get is:

java.lang.ClassCastException: com.propel.webapp.actions.AddressForm
	at _jsp._abe2__jsp._jspService(/abe2.jsp:26)
	at com.caucho.jsp.JavaPage.service(JavaPage.java:89)
	at com.caucho.jsp.JavaPage.subservice(JavaPage.java:83)
	at com.caucho.jsp.Page.service(Page.java:280)
	at com.caucho.jsp.QServlet.service(QServlet.java:161)
	at
com.caucho.server.http.AbstractRequest.service(AbstractRequest.java:450)
	at
com.caucho.server.http.AbstractRequest.service(AbstractRequest.java:393)
	at
com.caucho.server.http.PageCache$Entry.service(PageCache.java:252)
	at com.caucho.server.http.PageCache.service(PageCache.java:103)
	at com.caucho.server.http.VirtualHost.service(VirtualHost.java:395)
	at
com.caucho.server.http.QRequestDispatcher.forward(QRequestDispatcher.java:14
7)
	at
com.caucho.server.http.QRequestDispatcher.forward(QRequestDispatcher.java:80
)
	at
org.apache.struts.action.ActionServlet.processActionForward(ActionServlet.ja
va:1697)
	at
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1540)
	at
org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:491)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:102)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:83)
	at
com.caucho.server.http.AbstractRequest.service(AbstractRequest.java:450)
	at
com.caucho.server.http.AbstractRequest.service(AbstractRequest.java:393)
	at
com.caucho.server.http.PageCache$Entry.service(PageCache.java:252)
	at com.caucho.server.http.PageCache.service(PageCache.java:103)
	at com.caucho.server.http.VirtualHost.service(VirtualHost.java:395)
	at com.caucho.server.http.Request.dispatch(Request.java:211)
	at
com.caucho.server.http.HttpRequest.handleRequest(HttpRequest.java:201)
	at
com.caucho.server.http.HttpRequest.handleConnection(HttpRequest.java:142)
	at com.caucho.server.TcpConnection.run(TcpConnection.java:145)
	at java.lang.Thread.run(Thread.java:484)

This is happening at the useBean line:

<jsp:useBean id="addressForm" class="com.propel.webapp.actions.AddressForm"
scope="request" />

I'm not sure why it's a ClassCastException, as that would seem to imply that
the useBean found something under the property "addressForm", but that it
was of the wrong class?

I've also tried just adding scriptlet code to use a different class, but one
that I know is in the classpath and is also in the WEB-INF/classes of the
docroot.  I also get a ClassCastException from the following code:

<% 
 PageHelper pageHelper = (PageHelper)request.getAttribute("pageHelper");
 if (pageHelper == null) pageHelper = new PageHelper(request, response);
%>

I have the correct import above to find this class.

The thing that leads me to think there's either a bug in struts or I'm
missing something about how to use it is that this JSP page works fine if I
just load it directly, that is, hitting it's URL directly.  The classes can
be found just fine.

Any ideas why this would be happening?  Is this a known bug with struts or
am I just missing some configuration?

We are using Resin standalone for our JSP/Servlet engine/web server.

Thanks for any help,
Scott

RE: Problem finding classes after forward (resend)

Posted by Abraham Kang <ab...@infogain.com>.
Hi Scott,

This might be a problem with WebLogic.  I think this problem is prevelant in
WebLogic 5.1.  You might want to do a search on ClassCastException in the
WebLogic 5.1 docs and newsgroups.

--Abraham

> -----Original Message-----
> From: Scott Cressler [mailto:scott.cressler@propel.com]
> Sent: Thursday, April 05, 2001 8:50 AM
> To: 'struts-user@jakarta.apache.org'
> Subject: Problem finding classes after forward (resend)
>
>
> Many apologies for resending this, but I had not finished
> subscribing when I
> sent it the first time, and I don't know if it was, therefore,
> filtered out
> (since I didn't receive it ;-).
>
> Sorry, but I'm still having the problem described below:
>
> -----Original Message-----
> From: Scott Cressler
> Sent: Thursday, April 05, 2001 8:22 AM
> To: 'struts-user@jakarta.apache.org'
> Subject: Problem finding classes after forward
>
>
> I'm trying to refit an existing page to use struts.  The JSP page that I
> forward to at the end of my Action class uses some classes, but when
> forwarding to it through the struts ActionForward mechanism, the
> page seems
> unable to find the classes.  Strangely enough, one that it can't
> find is my
> form bean class, which it just used in the Action class.  I was trying to
> get to that class both through a <jsp:useBean> and through
> <jsp:getProperty>.  The exception I get is:
>
> java.lang.ClassCastException: com.propel.webapp.actions.AddressForm
> 	at _jsp._abe2__jsp._jspService(/abe2.jsp:26)
> 	at com.caucho.jsp.JavaPage.service(JavaPage.java:89)
> 	at com.caucho.jsp.JavaPage.subservice(JavaPage.java:83)
> 	at com.caucho.jsp.Page.service(Page.java:280)
> 	at com.caucho.jsp.QServlet.service(QServlet.java:161)
> 	at
> com.caucho.server.http.AbstractRequest.service(AbstractRequest.java:450)
> 	at
> com.caucho.server.http.AbstractRequest.service(AbstractRequest.java:393)
> 	at
> com.caucho.server.http.PageCache$Entry.service(PageCache.java:252)
> 	at com.caucho.server.http.PageCache.service(PageCache.java:103)
> 	at com.caucho.server.http.VirtualHost.service(VirtualHost.java:395)
> 	at
> com.caucho.server.http.QRequestDispatcher.forward(QRequestDispatch
er.java:14
> 7)
> 	at
> com.caucho.server.http.QRequestDispatcher.forward(QRequestDispatch
er.java:80
> )
> 	at
> org.apache.struts.action.ActionServlet.processActionForward(Action
Servlet.ja
> va:1697)
> 	at
> org.apache.struts.action.ActionServlet.process(ActionServlet.java:1540)
> 	at
> org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:491)
> 	at javax.servlet.http.HttpServlet.service(HttpServlet.java:102)
> 	at javax.servlet.http.HttpServlet.service(HttpServlet.java:83)
> 	at
> com.caucho.server.http.AbstractRequest.service(AbstractRequest.java:450)
> 	at
> com.caucho.server.http.AbstractRequest.service(AbstractRequest.java:393)
> 	at
> com.caucho.server.http.PageCache$Entry.service(PageCache.java:252)
> 	at com.caucho.server.http.PageCache.service(PageCache.java:103)
> 	at com.caucho.server.http.VirtualHost.service(VirtualHost.java:395)
> 	at com.caucho.server.http.Request.dispatch(Request.java:211)
> 	at
> com.caucho.server.http.HttpRequest.handleRequest(HttpRequest.java:201)
> 	at
> com.caucho.server.http.HttpRequest.handleConnection(HttpRequest.java:142)
> 	at com.caucho.server.TcpConnection.run(TcpConnection.java:145)
> 	at java.lang.Thread.run(Thread.java:484)
>
> This is happening at the useBean line:
>
> <jsp:useBean id="addressForm"
> class="com.propel.webapp.actions.AddressForm"
> scope="request" />
>
> I'm not sure why it's a ClassCastException, as that would seem to
> imply that
> the useBean found something under the property "addressForm", but that it
> was of the wrong class?
>
> I've also tried just adding scriptlet code to use a different
> class, but one
> that I know is in the classpath and is also in the WEB-INF/classes of the
> docroot.  I also get a ClassCastException from the following code:
>
> <%
>  PageHelper pageHelper = (PageHelper)request.getAttribute("pageHelper");
>  if (pageHelper == null) pageHelper = new PageHelper(request, response);
> %>
>
> I have the correct import above to find this class.
>
> The thing that leads me to think there's either a bug in struts or I'm
> missing something about how to use it is that this JSP page works
> fine if I
> just load it directly, that is, hitting it's URL directly.  The
> classes can
> be found just fine.
>
> Any ideas why this would be happening?  Is this a known bug with struts or
> am I just missing some configuration?
>
> We are using Resin standalone for our JSP/Servlet engine/web server.
>
> Thanks for any help,
> Scott
>