Hi! Have u tried to test the AuthBean independently? Does the bean try to
cast one object to another object? I think, there are some problems in your
beam when casting. Try to modify the classes relationship, eg: one class is
the superclass of another. It may be helpful.
Leo
----- Original Message -----
From: "Pater Pandoson" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, March 14, 2001 8:40 PM
Subject: java.lang.ClassCastException: AuthBean
> I have been writing an app that uses a bean with scope "session"
> a user goes to a login page and gives there user name and password
> this is send to the authbean and if all is correct will set a few values
>
> in the bean, things like there name and type of user.
>
> This all works fine.
>
> However when I than try use a page like this
>
> <jsp:useBean id="auth" scope="session" class="AuthBean" />
> <%
> auth.setLogin(request.getParameter("login"));
> auth.setPassword(request.getParameter("password"));
>
> auth.auth();
> HttpSession s = request.getSession();
> s.setMaxInactiveInterval(3600);
>
> if(auth.isUser()){
> %>
> <jsp:include page="WelcomeUser.jsp" flush="true" />
> <%
> }else if(auth.isCompany()){
> %>
> <jsp:include page="WelcomeVeryGoodUser.jsp" flush="true" />
> <%
> }else{
> %>
> Go Away!
> <%
> }
> %>
>
> I get this kind of error.
>
>
> 2001-03-14 08:34:15 - Ctx( /TEST ): Exception in: R( /TEST +
> /CheckLogin.jsp + null) - javax.servlet.ServletException: AuthBean
> at
>
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImp
l.java:459)
>
> at
>
_0002fmenu_0002ejspmenu_jsp_0._jspService(_0002fmenu_0002ejspmenu_jsp_0.java
:223)
>
> at
> org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:119)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
> at
>
org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.ja
va:177)
>
> at
> org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:318)
>
> at
> org.apache.jasper.servlet.JspServlet.service(JspServlet.java:391)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
> at
> org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:404)
>
> at org.apache.tomcat.core.Handler.service(Handler.java:286)
> at
> org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
> at
>
org.apache.tomcat.facade.RequestDispatcherImpl.include(RequestDispatcherImpl
.java:345)
>
> at
>
org.apache.jasper.runtime.PageContextImpl.include(PageContextImpl.java:414)
>
> at
>
_0002fPageStart_0002ejspPageStart_jsp_0._jspService(_0002fPageStart_0002ejsp
PageStart_jsp_0.java:165)
>
> at
> org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:119)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
> at
>
org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.ja
va:177)
>
> at
> org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:318)
>
> at
> org.apache.jasper.servlet.JspServlet.service(JspServlet.java:391)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
> at
> org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:404)
>
> at org.apache.tomcat.core.Handler.service(Handler.java:286)
> at
> org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
> at
>
org.apache.tomcat.facade.RequestDispatcherImpl.include(RequestDispatcherImpl
.java:345)
>
> at
>
org.apache.jasper.runtime.PageContextImpl.include(PageContextImpl.java:414)
>
> at
>
_0002fWelcomeUser_0002ejspWelcomeUser_jsp_0._jspService(_0002fWelcomeUser_00
02ejspWelcomeUser_jsp_0.java:138)
>
> at
> org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:119)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
> at
>
org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.ja
va:177)
>
> at
> org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:318)
>
> at
> org.apache.jasper.servlet.JspServlet.service(JspServlet.java:391)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
> at
> org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:404)
>
> at org.apache.tomcat.core.Handler.service(Handler.java:286)
> at
> org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
> at
>
org.apache.tomcat.facade.RequestDispatcherImpl.include(RequestDispatcherImpl
.java:345)
>
> at
>
org.apache.jasper.runtime.PageContextImpl.include(PageContextImpl.java:414)
>
> at
>
_0002fCheckLogin_0002ejspCheckLogin_jsp_3._jspService(_0002fCheckLogin_0002e
jspCheckLogin_jsp_3.java:99)
>
> at
> org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:119)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
> at
>
org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.ja
va:177)
>
> at
> org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:318)
>
> at
> org.apache.jasper.servlet.JspServlet.service(JspServlet.java:391)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
> at
> org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:404)
>
> at org.apache.tomcat.core.Handler.service(Handler.java:286)
> at
> org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
> at
>
org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:79
7)
>
> at
> org.apache.tomcat.core.ContextManager.service(ContextManager.java:743)
> at
>
org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpC
onnectionHandler.java:210)
>
> at
> org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416)
>
> at
> org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:498)
>
> at java.lang.Thread.run(Thread.java:479)
> Root cause:
> java.lang.ClassCastException: AuthBean
> at
>
_0002fmenu_0002ejspmenu_jsp_0._jspService(_0002fmenu_0002ejspmenu_jsp_0.java
:149)
>
> at
> org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:119)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
> at
>
org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.ja
va:177)
>
> at
> org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:318)
>
> at
> org.apache.jasper.servlet.JspServlet.service(JspServlet.java:391)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
> at
> org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:404)
>
> at org.apache.tomcat.core.Handler.service(Handler.java:286)
> at
> org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
> at
>
org.apache.tomcat.facade.RequestDispatcherImpl.include(RequestDispatcherImpl
.java:345)
>
> at
>
org.apache.jasper.runtime.PageContextImpl.include(PageContextImpl.java:414)
>
> at
>
_0002fPageStart_0002ejspPageStart_jsp_0._jspService(_0002fPageStart_0002ejsp
PageStart_jsp_0.java:165)
>
> at
> org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:119)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
> at
>
org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.ja
va:177)
>
> at
> org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:318)
>
> at
> org.apache.jasper.servlet.JspServlet.service(JspServlet.java:391)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
> at
> org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:404)
>
> at org.apache.tomcat.core.Handler.service(Handler.java:286)
> at
> org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
> at
>
org.apache.tomcat.facade.RequestDispatcherImpl.include(RequestDispatcherImpl
.java:345)
>
> at
>
org.apache.jasper.runtime.PageContextImpl.include(PageContextImpl.java:414)
>
> at
>
_0002fWelcomeUser_0002ejspWelcomeUser_jsp_0._jspService(_0002fWelcomeUser_00
02ejspWelcomeUser_jsp_0.java:138)
>
> at
> org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:119)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
> at
>
org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.ja
va:177)
>
> at
> org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:318)
>
> at
> org.apache.jasper.servlet.JspServlet.service(JspServlet.java:391)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
> at
> org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:404)
>
> at org.apache.tomcat.core.Handler.service(Handler.java:286)
> at
> org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
> at
>
org.apache.tomcat.facade.RequestDispatcherImpl.include(RequestDispatcherImpl
.java:345)
>
> at
>
org.apache.jasper.runtime.PageContextImpl.include(PageContextImpl.java:414)
>
> at
>
_0002fCheckLogin_0002ejspCheckLogin_jsp_3._jspService(_0002fCheckLogin_0002e
jspCheckLogin_jsp_3.java:99)
>
> at
> org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:119)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
> at
>
org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.ja
va:177)
>
> at
> org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:318)
>
> at
> org.apache.jasper.servlet.JspServlet.service(JspServlet.java:391)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
> at
> org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:404)
>
> at org.apache.tomcat.core.Handler.service(Handler.java:286)
> at
> org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
> at
>
org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:79
7)
>
> at
> org.apache.tomcat.core.ContextManager.service(ContextManager.java:743)
> at
>
org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpC
onnectionHandler.java:210)
>
> at
> org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416)
>
> at
> org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:498)
>
> at java.lang.Thread.run(Thread.java:479)
>
>
> If I just go to the
> <jsp:include page="WelcomeVeryGoodUser.jsp" flush="true" /> or
> <jsp:include page="WelcomeUser.jsp" flush="true" />
> pages thay work fine. (I have not set them to ask for auth.isUser() or
> whatever yet)
>
> Can anyone tell me what might be happening here, I am very puzzled by
> this behavior.
>
> Thanks for any help.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, email: [EMAIL PROTECTED]
_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com