You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Mufaddal Khumri <mu...@wmotion.com> on 2003/06/12 12:16:38 UTC

Class cast exception ...

I get the following error in tomcat:

java.lang.ClassCastException
	at 
org.apache.jsp.EditOffering_jsp._jspService(EditOffering_jsp.java:129)

I looked at EditOffering_jsp.java and it has this at line 129:

locationHelper = 
(com.wavesinmotion.cw.classes.jsphelpers.LocationHelper) 
pageContext.getAttribute("locationHelper", PageContext.SESSION_SCOPE);

which in the corresponding .jsp page is:

<jsp:useBean id="locationHelper" 
class="com.wavesinmotion.cw.classes.jsphelpers.LocationHelper" 
scope="session">
	<jsp:setProperty name="locationHelper"
					 property="dbReader"
					 value="<%= session.getAttribute("DBREADER")%>" />
	<jsp:setProperty name="userHelper"
					 property="dbWriter"
					 value="<%= session.getAttribute("DBWRITER")%>" />
</jsp:useBean>

Does anybody have any idea as to why i am getting this class cast 
exception ?

Thanks.


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


RE: Class cast exception ...

Posted by Filip Hanik <ma...@filip.net>.
what happens if you translate the tags yourself to actual java code within
<% %> brackets,
do you still get classcast exceptions?

Filip

> -----Original Message-----
> From: Mufaddal Khumri [mailto:mufaddal@wmotion.com]
> Sent: Thursday, June 12, 2003 10:09 PM
> To: Tomcat Users List
> Subject: Re: Class cast exception ...
>
>
> These were the values i got.
> session DBWRITER = com.wavesinmotion.cw.classes.db.DBWriter@515185
> session DBREADER = com.wavesinmotion.cw.classes.db.DBReader@bf1f08
>
> This means that my DBREADER and DBWRITER are using the right classes.
>
> Its still giving me a class cast exception. I thought maybe there is a
> session object stored under the name locationHelper which is not of
> type LocationHelper. But before this jsp is reached there is no
> locationHelper attribute present in the session. I still cant figure
> out where I am going wrong. Does anyone have any ideas ? The jsp code
> is below and so is the stack Trace
>
> >> <jsp:useBean id="locationHelper"
> >> class="com.wavesinmotion.cw.classes.jsphelpers.LocationHelper"
> >> scope="session">
> >> 	<jsp:setProperty name="locationHelper"
> >> 					 property="dbReader"
> >> 					 value="<%=
> session.getAttribute("DBREADER")%>" />
> >> 	<jsp:setProperty name="locationHelper"
> >> 					 property="dbWriter"
> >> 					 value="<%=
> session.getAttribute("DBWRITER")%>" />
> >> </jsp:useBean>
>
> 2003-06-13 10:34:35 StandardWrapperValve[jsp]: Servlet.service() for
> servlet jsp threw exception
> org.apache.jasper.JasperException
> 	at
> org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.ja
> va:248)
> 	at
> org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
> 	at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
> 	at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
> 	at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Applica
> tionFilterChain.java:247)
> 	at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilt
> erChain.java:193)
> 	at
> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValv
> e.java:260)
> 	at
> org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i
> nvokeNext(StandardPipeline.java:643)
> 	at
> org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:4
> 80)
> 	at
> org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
> 	at
> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValv
> e.java:191)
> 	at
> org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i
> nvokeNext(StandardPipeline.java:643)
> 	at
> org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.ja
> va:246)
> 	at
> org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i
> nvokeNext(StandardPipeline.java:641)
> 	at
> org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:4
> 80)
> 	at
> org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
> 	at
> org.apache.catalina.core.StandardContext.invoke(StandardContext.java:241
> 5)
> 	at
> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java
> :180)
> 	at
> org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i
> nvokeNext(StandardPipeline.java:643)
> 	at
> org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherVa
> lve.java:170)
> 	at
> org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i
> nvokeNext(StandardPipeline.java:641)
> 	at
> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java
> :172)
> 	at
> org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i
> nvokeNext(StandardPipeline.java:641)
> 	at
> org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:4
> 80)
> 	at
> org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
> 	at
> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.
> java:174)
> 	at
> org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i
> nvokeNext(StandardPipeline.java:643)
> 	at
> org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:4
> 80)
> 	at
> org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
> 	at
> org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223)
> 	at
> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:43
> 2)
> 	at
> org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processC
> onnection(Http11Protocol.java:386)
> 	at
> org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:53
> 4)
> 	at
> org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool
> .java:530)
> 	at java.lang.Thread.run(Thread.java:554)
> ----- Root Cause -----
> java.lang.ClassCastException
> 	at
> org.apache.jsp.EditOffering_jsp._jspService(EditOffering_jsp.java:142)
> 	at
> org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:137)
> 	at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
> 	at
> org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.ja
> va:204)
> 	at
> org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
> 	at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
> 	at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
> 	at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Applica
> tionFilterChain.java:247)
> 	at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilt
> erChain.java:193)
> 	at
> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValv
> e.java:260)
> 	at
> org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i
> nvokeNext(StandardPipeline.java:643)
> 	at
> org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:4
> 80)
> 	at
> org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
> 	at
> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValv
> e.java:191)
> 	at
> org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i
> nvokeNext(StandardPipeline.java:643)
> 	at
> org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.ja
> va:246)
> 	at
> org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i
> nvokeNext(StandardPipeline.java:641)
> 	at
> org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:4
> 80)
> 	at
> org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
> 	at
> org.apache.catalina.core.StandardContext.invoke(StandardContext.java:241
> 5)
> 	at
> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java
> :180)
> 	at
> org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i
> nvokeNext(StandardPipeline.java:643)
> 	at
> org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherVa
> lve.java:170)
> 	at
> org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i
> nvokeNext(StandardPipeline.java:641)
> 	at
> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java
> :172)
> 	at
> org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i
> nvokeNext(StandardPipeline.java:641)
> 	at
> org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:4
> 80)
> 	at
> org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
> 	at
> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.
> java:174)
> 	at
> org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i
> nvokeNext(StandardPipeline.java:643)
> 	at
> org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:4
> 80)
> 	at
> org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
> 	at
> org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223)
> 	at
> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:43
> 2)
> 	at
> org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processC
> onnection(Http11Protocol.java:386)
> 	at
> org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:53
> 4)
> 	at
> org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool
> .java:530)
> 	at java.lang.Thread.run(Thread.java:554)
>
> On Friday, June 13, 2003, at 07:16  AM, Yoav Shapira wrote:
>
> > Howdy,
> > Print out the value of session.getAttribute("DBREADER") before you set
> > it: that
> > way you can see what its real runtime class is.  It probably won't be
> > that
> > locationHelper class you're trying to cast into...
> >
> > Yoav Shapira
> >
> > --- Mufaddal Khumri <mu...@wmotion.com> wrote:
> >> Made a typo in my previous email .. heres the corrected email:
> >>
> >> I get the following error in tomcat:
> >>
> >> java.lang.ClassCastException
> >> 	at
> >> org.apache.jsp.EditOffering_jsp._jspService(EditOffering_jsp.java:129)
> >>
> >> I looked at EditOffering_jsp.java and it has this at line 129:
> >>
> >> locationHelper =
> >> (com.wavesinmotion.cw.classes.jsphelpers.LocationHelper)
> >> pageContext.getAttribute("locationHelper", PageContext.SESSION_SCOPE);
> >>
> >> which in the corresponding .jsp page is:
> >>
> >> <jsp:useBean id="locationHelper"
> >> class="com.wavesinmotion.cw.classes.jsphelpers.LocationHelper"
> >> scope="session">
> >> 	<jsp:setProperty name="locationHelper"
> >> 					 property="dbReader"
> >> 					 value="<%=
> session.getAttribute("DBREADER")%>" />
> >> 	<jsp:setProperty name="locationHelper"
> >> 					 property="dbWriter"
> >> 					 value="<%=
> session.getAttribute("DBWRITER")%>" />
> >> </jsp:useBean>
> >>
> >> Does anybody have any idea as to why i am getting this class cast
> >> exception ?
> >>
> >> Thanks.
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> >> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> >>
> >
> >
> > =====
> > Yoav Shapira
> > yoavs@computer.org
> >
> > __________________________________
> > Do you Yahoo!?
> > Yahoo! Calendar - Free online calendar with sync to Outlook(TM).
> > http://calendar.yahoo.com
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> >
>


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: Class cast exception ...

Posted by Mufaddal Khumri <mu...@wmotion.com>.
These were the values i got.
session DBWRITER = com.wavesinmotion.cw.classes.db.DBWriter@515185
session DBREADER = com.wavesinmotion.cw.classes.db.DBReader@bf1f08

This means that my DBREADER and DBWRITER are using the right classes.

Its still giving me a class cast exception. I thought maybe there is a  
session object stored under the name locationHelper which is not of  
type LocationHelper. But before this jsp is reached there is no  
locationHelper attribute present in the session. I still cant figure  
out where I am going wrong. Does anyone have any ideas ? The jsp code  
is below and so is the stack Trace

>> <jsp:useBean id="locationHelper"
>> class="com.wavesinmotion.cw.classes.jsphelpers.LocationHelper"
>> scope="session">
>> 	<jsp:setProperty name="locationHelper"
>> 					 property="dbReader"
>> 					 value="<%= session.getAttribute("DBREADER")%>" />
>> 	<jsp:setProperty name="locationHelper"
>> 					 property="dbWriter"
>> 					 value="<%= session.getAttribute("DBWRITER")%>" />
>> </jsp:useBean>

2003-06-13 10:34:35 StandardWrapperValve[jsp]: Servlet.service() for  
servlet jsp threw exception
org.apache.jasper.JasperException
	at  
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.ja 
va:248)
	at  
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
	at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
	at  
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Applica 
tionFilterChain.java:247)
	at  
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilt 
erChain.java:193)
	at  
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValv 
e.java:260)
	at  
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i 
nvokeNext(StandardPipeline.java:643)
	at  
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:4 
80)
	at  
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
	at  
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValv 
e.java:191)
	at  
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i 
nvokeNext(StandardPipeline.java:643)
	at  
org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.ja 
va:246)
	at  
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i 
nvokeNext(StandardPipeline.java:641)
	at  
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:4 
80)
	at  
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
	at  
org.apache.catalina.core.StandardContext.invoke(StandardContext.java:241 
5)
	at  
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java 
:180)
	at  
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i 
nvokeNext(StandardPipeline.java:643)
	at  
org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherVa 
lve.java:170)
	at  
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i 
nvokeNext(StandardPipeline.java:641)
	at  
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java 
:172)
	at  
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i 
nvokeNext(StandardPipeline.java:641)
	at  
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:4 
80)
	at  
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
	at  
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve. 
java:174)
	at  
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i 
nvokeNext(StandardPipeline.java:643)
	at  
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:4 
80)
	at  
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
	at  
org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223)
	at  
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:43 
2)
	at  
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processC 
onnection(Http11Protocol.java:386)
	at  
org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:53 
4)
	at  
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool 
.java:530)
	at java.lang.Thread.run(Thread.java:554)
----- Root Cause -----
java.lang.ClassCastException
	at  
org.apache.jsp.EditOffering_jsp._jspService(EditOffering_jsp.java:142)
	at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:137)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
	at  
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.ja 
va:204)
	at  
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
	at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
	at  
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Applica 
tionFilterChain.java:247)
	at  
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilt 
erChain.java:193)
	at  
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValv 
e.java:260)
	at  
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i 
nvokeNext(StandardPipeline.java:643)
	at  
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:4 
80)
	at  
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
	at  
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValv 
e.java:191)
	at  
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i 
nvokeNext(StandardPipeline.java:643)
	at  
org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.ja 
va:246)
	at  
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i 
nvokeNext(StandardPipeline.java:641)
	at  
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:4 
80)
	at  
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
	at  
org.apache.catalina.core.StandardContext.invoke(StandardContext.java:241 
5)
	at  
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java 
:180)
	at  
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i 
nvokeNext(StandardPipeline.java:643)
	at  
org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherVa 
lve.java:170)
	at  
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i 
nvokeNext(StandardPipeline.java:641)
	at  
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java 
:172)
	at  
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i 
nvokeNext(StandardPipeline.java:641)
	at  
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:4 
80)
	at  
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
	at  
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve. 
java:174)
	at  
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i 
nvokeNext(StandardPipeline.java:643)
	at  
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:4 
80)
	at  
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
	at  
org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223)
	at  
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:43 
2)
	at  
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processC 
onnection(Http11Protocol.java:386)
	at  
org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:53 
4)
	at  
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool 
.java:530)
	at java.lang.Thread.run(Thread.java:554)

On Friday, June 13, 2003, at 07:16  AM, Yoav Shapira wrote:

> Howdy,
> Print out the value of session.getAttribute("DBREADER") before you set  
> it: that
> way you can see what its real runtime class is.  It probably won't be  
> that
> locationHelper class you're trying to cast into...
>
> Yoav Shapira
>
> --- Mufaddal Khumri <mu...@wmotion.com> wrote:
>> Made a typo in my previous email .. heres the corrected email:
>>
>> I get the following error in tomcat:
>>
>> java.lang.ClassCastException
>> 	at
>> org.apache.jsp.EditOffering_jsp._jspService(EditOffering_jsp.java:129)
>>
>> I looked at EditOffering_jsp.java and it has this at line 129:
>>
>> locationHelper =
>> (com.wavesinmotion.cw.classes.jsphelpers.LocationHelper)
>> pageContext.getAttribute("locationHelper", PageContext.SESSION_SCOPE);
>>
>> which in the corresponding .jsp page is:
>>
>> <jsp:useBean id="locationHelper"
>> class="com.wavesinmotion.cw.classes.jsphelpers.LocationHelper"
>> scope="session">
>> 	<jsp:setProperty name="locationHelper"
>> 					 property="dbReader"
>> 					 value="<%= session.getAttribute("DBREADER")%>" />
>> 	<jsp:setProperty name="locationHelper"
>> 					 property="dbWriter"
>> 					 value="<%= session.getAttribute("DBWRITER")%>" />
>> </jsp:useBean>
>>
>> Does anybody have any idea as to why i am getting this class cast
>> exception ?
>>
>> Thanks.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>>
>
>
> =====
> Yoav Shapira
> yoavs@computer.org
>
> __________________________________
> Do you Yahoo!?
> Yahoo! Calendar - Free online calendar with sync to Outlook(TM).
> http://calendar.yahoo.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>

Re: Class cast exception ...

Posted by Yoav Shapira <yo...@yahoo.com>.
Howdy,
Print out the value of session.getAttribute("DBREADER") before you set it: that
way you can see what its real runtime class is.  It probably won't be that
locationHelper class you're trying to cast into...

Yoav Shapira

--- Mufaddal Khumri <mu...@wmotion.com> wrote:
> Made a typo in my previous email .. heres the corrected email:
> 
> I get the following error in tomcat:
> 
> java.lang.ClassCastException
> 	at 
> org.apache.jsp.EditOffering_jsp._jspService(EditOffering_jsp.java:129)
> 
> I looked at EditOffering_jsp.java and it has this at line 129:
> 
> locationHelper = 
> (com.wavesinmotion.cw.classes.jsphelpers.LocationHelper) 
> pageContext.getAttribute("locationHelper", PageContext.SESSION_SCOPE);
> 
> which in the corresponding .jsp page is:
> 
> <jsp:useBean id="locationHelper" 
> class="com.wavesinmotion.cw.classes.jsphelpers.LocationHelper" 
> scope="session">
> 	<jsp:setProperty name="locationHelper"
> 					 property="dbReader"
> 					 value="<%= session.getAttribute("DBREADER")%>" />
> 	<jsp:setProperty name="locationHelper"
> 					 property="dbWriter"
> 					 value="<%= session.getAttribute("DBWRITER")%>" />
> </jsp:useBean>
> 
> Does anybody have any idea as to why i am getting this class cast 
> exception ?
> 
> Thanks.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> 


=====
Yoav Shapira
yoavs@computer.org

__________________________________
Do you Yahoo!?
Yahoo! Calendar - Free online calendar with sync to Outlook(TM).
http://calendar.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Class cast exception ...

Posted by Mufaddal Khumri <mu...@wmotion.com>.
Made a typo in my previous email .. heres the corrected email:

I get the following error in tomcat:

java.lang.ClassCastException
	at 
org.apache.jsp.EditOffering_jsp._jspService(EditOffering_jsp.java:129)

I looked at EditOffering_jsp.java and it has this at line 129:

locationHelper = 
(com.wavesinmotion.cw.classes.jsphelpers.LocationHelper) 
pageContext.getAttribute("locationHelper", PageContext.SESSION_SCOPE);

which in the corresponding .jsp page is:

<jsp:useBean id="locationHelper" 
class="com.wavesinmotion.cw.classes.jsphelpers.LocationHelper" 
scope="session">
	<jsp:setProperty name="locationHelper"
					 property="dbReader"
					 value="<%= session.getAttribute("DBREADER")%>" />
	<jsp:setProperty name="locationHelper"
					 property="dbWriter"
					 value="<%= session.getAttribute("DBWRITER")%>" />
</jsp:useBean>

Does anybody have any idea as to why i am getting this class cast 
exception ?

Thanks.


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: Class cast exception ...

Posted by Mufaddal Khumri <mu...@wmotion.com>.
Thats the complete stack Trace:

2003-06-12 15:54:47 StandardWrapperValve[jsp]: Servlet.service() for  
servlet jsp threw exception
org.apache.jasper.JasperException
	at  
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.ja 
va:248)
	at  
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
	at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
	at  
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Applica 
tionFilterChain.java:247)
	at  
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilt 
erChain.java:193)
	at  
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValv 
e.java:260)
	at  
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i 
nvokeNext(StandardPipeline.java:643)
	at  
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:4 
80)
	at  
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
	at  
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValv 
e.java:191)
	at  
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i 
nvokeNext(StandardPipeline.java:643)
	at  
org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.ja 
va:246)
	at  
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i 
nvokeNext(StandardPipeline.java:641)
	at  
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:4 
80)
	at  
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
	at  
org.apache.catalina.core.StandardContext.invoke(StandardContext.java:241 
5)
	at  
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java 
:180)
	at  
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i 
nvokeNext(StandardPipeline.java:643)
	at  
org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherVa 
lve.java:170)
	at  
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i 
nvokeNext(StandardPipeline.java:641)
	at  
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java 
:172)
	at  
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i 
nvokeNext(StandardPipeline.java:641)
	at  
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:4 
80)
	at  
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
	at  
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve. 
java:174)
	at  
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i 
nvokeNext(StandardPipeline.java:643)
	at  
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:4 
80)
	at  
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
	at  
org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223)
	at  
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:43 
2)
	at  
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processC 
onnection(Http11Protocol.java:386)
	at  
org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:53 
4)
	at  
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool 
.java:530)
	at java.lang.Thread.run(Thread.java:554)
----- Root Cause -----
java.lang.ClassCastException
	at  
org.apache.jsp.EditOffering_jsp._jspService(EditOffering_jsp.java:129)
	at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:137)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
	at  
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.ja 
va:204)
	at  
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
	at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
	at  
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Applica 
tionFilterChain.java:247)
	at  
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilt 
erChain.java:193)
	at  
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValv 
e.java:260)
	at  
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i 
nvokeNext(StandardPipeline.java:643)
	at  
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:4 
80)
	at  
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
	at  
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValv 
e.java:191)
	at  
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i 
nvokeNext(StandardPipeline.java:643)
	at  
org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.ja 
va:246)
	at  
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i 
nvokeNext(StandardPipeline.java:641)
	at  
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:4 
80)
	at  
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
	at  
org.apache.catalina.core.StandardContext.invoke(StandardContext.java:241 
5)
	at  
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java 
:180)
	at  
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i 
nvokeNext(StandardPipeline.java:643)
	at  
org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherVa 
lve.java:170)
	at  
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i 
nvokeNext(StandardPipeline.java:641)
	at  
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java 
:172)
	at  
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i 
nvokeNext(StandardPipeline.java:641)
	at  
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:4 
80)
	at  
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
	at  
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve. 
java:174)
	at  
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i 
nvokeNext(StandardPipeline.java:643)
	at  
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:4 
80)
	at  
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
	at  
org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223)
	at  
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:43 
2)
	at  
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processC 
onnection(Http11Protocol.java:386)
	at  
org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:53 
4)
	at  
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool 
.java:530)
	at java.lang.Thread.run(Thread.java:554)

On Friday, June 13, 2003, at 04:34  AM, Filip Hanik wrote:

> can you provide the complete stack trace, usually when a Class cast
> exception happens it will also print out the class that fails,
>
>> java.lang.ClassCastException
>                                 ^^^^^^^^(nothing here?)
>> 	at
>> org.apache.jsp.EditOffering_jsp._jspService(EditOffering_jsp.java:129)
>
> have you imported the class in the JSP <% @ page import...?
>
> Filip
>
>
>> -----Original Message-----
>> From: Mufaddal Khumri [mailto:mufaddal@wmotion.com]
>> Sent: Thursday, June 12, 2003 3:31 AM
>> To: Tomcat Users List
>> Subject: Re: Class cast exception ...
>>
>>
>> no ... its just in one place neither have i reloaded the context. Even
>> if i did reload the context .. it should have found the correct .class
>> file since i have specified the complete path to it in the jsp useBean
>> tag right ?
>>
>> On Friday, June 13, 2003, at 04:24  AM, Filip Hanik wrote:
>>
>>> any chance the class
>>> com.wavesinmotion.cw.classes.jsphelpers.LocationHelper
>>>
>>> resides in more than one place?
>>>
>>> or did you reload the context?
>>>
>>> Filip
>>>
>>>> -----Original Message-----
>>>> From: Mufaddal Khumri [mailto:mufaddal@wmotion.com]
>>>> Sent: Thursday, June 12, 2003 3:17 AM
>>>> To: Tomcat Users List
>>>> Subject: Class cast exception ...
>>>>
>>>>
>>>> I get the following error in tomcat:
>>>>
>>>> java.lang.ClassCastException
>>>> 	at
>>>> org.apache.jsp.EditOffering_jsp._jspService(EditOffering_jsp.java:12 
>>>> 9)
>>>>
>>>> I looked at EditOffering_jsp.java and it has this at line 129:
>>>>
>>>> locationHelper =
>>>> (com.wavesinmotion.cw.classes.jsphelpers.LocationHelper)
>>>> pageContext.getAttribute("locationHelper",  
>>>> PageContext.SESSION_SCOPE);
>>>>
>>>> which in the corresponding .jsp page is:
>>>>
>>>> <jsp:useBean id="locationHelper"
>>>> class="com.wavesinmotion.cw.classes.jsphelpers.LocationHelper"
>>>> scope="session">
>>>> 	<jsp:setProperty name="locationHelper"
>>>> 					 property="dbReader"
>>>> 					 value="<%=
>>>> session.getAttribute("DBREADER")%>" />
>>>> 	<jsp:setProperty name="userHelper"
>>>> 					 property="dbWriter"
>>>> 					 value="<%=
>>>> session.getAttribute("DBWRITER")%>" />
>>>> </jsp:useBean>
>>>>
>>>> Does anybody have any idea as to why i am getting this class cast
>>>> exception ?
>>>>
>>>> Thanks.
>>>>
>>>>
>>>> -------------------------------------------------------------------- 
>>>> -
>>>> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>>>> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>>>>
>>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>>> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>

RE: Class cast exception ...

Posted by Filip Hanik <ma...@filip.net>.
can you provide the complete stack trace, usually when a Class cast
exception happens it will also print out the class that fails,

> java.lang.ClassCastException
                                ^^^^^^^^(nothing here?)
> 	at
> org.apache.jsp.EditOffering_jsp._jspService(EditOffering_jsp.java:129)

have you imported the class in the JSP <% @ page import...?

Filip


> -----Original Message-----
> From: Mufaddal Khumri [mailto:mufaddal@wmotion.com]
> Sent: Thursday, June 12, 2003 3:31 AM
> To: Tomcat Users List
> Subject: Re: Class cast exception ...
>
>
> no ... its just in one place neither have i reloaded the context. Even
> if i did reload the context .. it should have found the correct .class
> file since i have specified the complete path to it in the jsp useBean
> tag right ?
>
> On Friday, June 13, 2003, at 04:24  AM, Filip Hanik wrote:
>
> > any chance the class
> > com.wavesinmotion.cw.classes.jsphelpers.LocationHelper
> >
> > resides in more than one place?
> >
> > or did you reload the context?
> >
> > Filip
> >
> >> -----Original Message-----
> >> From: Mufaddal Khumri [mailto:mufaddal@wmotion.com]
> >> Sent: Thursday, June 12, 2003 3:17 AM
> >> To: Tomcat Users List
> >> Subject: Class cast exception ...
> >>
> >>
> >> I get the following error in tomcat:
> >>
> >> java.lang.ClassCastException
> >> 	at
> >> org.apache.jsp.EditOffering_jsp._jspService(EditOffering_jsp.java:129)
> >>
> >> I looked at EditOffering_jsp.java and it has this at line 129:
> >>
> >> locationHelper =
> >> (com.wavesinmotion.cw.classes.jsphelpers.LocationHelper)
> >> pageContext.getAttribute("locationHelper", PageContext.SESSION_SCOPE);
> >>
> >> which in the corresponding .jsp page is:
> >>
> >> <jsp:useBean id="locationHelper"
> >> class="com.wavesinmotion.cw.classes.jsphelpers.LocationHelper"
> >> scope="session">
> >> 	<jsp:setProperty name="locationHelper"
> >> 					 property="dbReader"
> >> 					 value="<%=
> >> session.getAttribute("DBREADER")%>" />
> >> 	<jsp:setProperty name="userHelper"
> >> 					 property="dbWriter"
> >> 					 value="<%=
> >> session.getAttribute("DBWRITER")%>" />
> >> </jsp:useBean>
> >>
> >> Does anybody have any idea as to why i am getting this class cast
> >> exception ?
> >>
> >> Thanks.
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> >> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> >>
> >>
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: Class cast exception ...

Posted by Mufaddal Khumri <mu...@wmotion.com>.
no ... its just in one place neither have i reloaded the context. Even 
if i did reload the context .. it should have found the correct .class 
file since i have specified the complete path to it in the jsp useBean 
tag right ?

On Friday, June 13, 2003, at 04:24  AM, Filip Hanik wrote:

> any chance the class
> com.wavesinmotion.cw.classes.jsphelpers.LocationHelper
>
> resides in more than one place?
>
> or did you reload the context?
>
> Filip
>
>> -----Original Message-----
>> From: Mufaddal Khumri [mailto:mufaddal@wmotion.com]
>> Sent: Thursday, June 12, 2003 3:17 AM
>> To: Tomcat Users List
>> Subject: Class cast exception ...
>>
>>
>> I get the following error in tomcat:
>>
>> java.lang.ClassCastException
>> 	at
>> org.apache.jsp.EditOffering_jsp._jspService(EditOffering_jsp.java:129)
>>
>> I looked at EditOffering_jsp.java and it has this at line 129:
>>
>> locationHelper =
>> (com.wavesinmotion.cw.classes.jsphelpers.LocationHelper)
>> pageContext.getAttribute("locationHelper", PageContext.SESSION_SCOPE);
>>
>> which in the corresponding .jsp page is:
>>
>> <jsp:useBean id="locationHelper"
>> class="com.wavesinmotion.cw.classes.jsphelpers.LocationHelper"
>> scope="session">
>> 	<jsp:setProperty name="locationHelper"
>> 					 property="dbReader"
>> 					 value="<%=
>> session.getAttribute("DBREADER")%>" />
>> 	<jsp:setProperty name="userHelper"
>> 					 property="dbWriter"
>> 					 value="<%=
>> session.getAttribute("DBWRITER")%>" />
>> </jsp:useBean>
>>
>> Does anybody have any idea as to why i am getting this class cast
>> exception ?
>>
>> Thanks.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


RE: Class cast exception ...

Posted by Filip Hanik <ma...@filip.net>.
any chance the class 
com.wavesinmotion.cw.classes.jsphelpers.LocationHelper

resides in more than one place?

or did you reload the context?

Filip

> -----Original Message-----
> From: Mufaddal Khumri [mailto:mufaddal@wmotion.com]
> Sent: Thursday, June 12, 2003 3:17 AM
> To: Tomcat Users List
> Subject: Class cast exception ... 
> 
> 
> I get the following error in tomcat:
> 
> java.lang.ClassCastException
> 	at 
> org.apache.jsp.EditOffering_jsp._jspService(EditOffering_jsp.java:129)
> 
> I looked at EditOffering_jsp.java and it has this at line 129:
> 
> locationHelper = 
> (com.wavesinmotion.cw.classes.jsphelpers.LocationHelper) 
> pageContext.getAttribute("locationHelper", PageContext.SESSION_SCOPE);
> 
> which in the corresponding .jsp page is:
> 
> <jsp:useBean id="locationHelper" 
> class="com.wavesinmotion.cw.classes.jsphelpers.LocationHelper" 
> scope="session">
> 	<jsp:setProperty name="locationHelper"
> 					 property="dbReader"
> 					 value="<%= 
> session.getAttribute("DBREADER")%>" />
> 	<jsp:setProperty name="userHelper"
> 					 property="dbWriter"
> 					 value="<%= 
> session.getAttribute("DBWRITER")%>" />
> </jsp:useBean>
> 
> Does anybody have any idea as to why i am getting this class cast 
> exception ?
> 
> Thanks.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org