I am using JRun 3.0 and using servlets and jsp's. The JSP's are however behaving in an unpredictable manner and throwing classcast exception every now and then. At times it works and at times it throws this error. Could somebody help out??
Frank Carver
Sheriff
Joined: Jan 07, 1999
Posts: 6913
posted
0
Do these exceptions always happen at the same place in the code? Could you copy a few exception prints/stack traces here so we can see a bit mre about the error. Thanks.
Hi Iam now writing the error it generates on the browser java.lang.ClassCastException at jrun____ScipDev____jsp____SeraNews____Quiz12ejsp23._jspService(jrun____ScipDev____jsp____SeraNews____Quiz12ejsp23.java, Compiled Code) at allaire.jrun.jsp.HttpJSPServlet.service(HttpJSPServlet.java, Compiled Code) at allaire.jrun.servlet.JRunSE.service(JRunSE.java, Compiled Code) at allaire.jrun.servlet.JRunSE.runServlet(JRunSE.java, Compiled Code) at allaire.jrun.servlet.JRunNamedDispatcher.forward(JRunNamedDispatcher.java, Compiled Code) at allaire.jrun.jsp.JSPServlet.service(JSPServlet.java, Compiled Code) at allaire.jrun.servlet.JRunSE.service(JRunSE.java, Compiled Code) at allaire.jrun.servlet.JRunSE.runServlet(JRunSE.java, Compiled Code) at allaire.jrun.servlet.JRunRequestDispatcher.forward(JRunRequestDispatcher.java, Compiled Code) at QuizServlet.service(QuizServlet.java, Compiled Code) at javax.servlet.http.HttpServlet.service(HttpServlet.java, Compiled Code) at allaire.jrun.servlet.JRunSE.service(JRunSE.java, Compiled Code) at allaire.jrun.servlet.JRunSE.runServlet(JRunSE.java, Compiled Code) at allaire.jrun.servlet.JRunNamedDispatcher.forward(JRunNamedDispatcher.java, Compiled Code) at allaire.jrun.servlet.Invoker.service(Invoker.java, Compiled Code) at allaire.jrun.servlet.JRunSE.service(JRunSE.java, Compiled Code) at allaire.jrun.servlet.JRunSE.runServlet(JRunSE.java, Compiled Code) at allaire.jrun.servlet.JRunRequestDispatcher.forward(JRunRequestDispatcher.java, Compiled Code) at allaire.jrun.servlet.JRunSE.service(JRunSE.java, Compiled Code) at allaire.jrun.servlet.JvmContext.dispatch(JvmContext.java, Compiled Code) at allaire.jrun.jrpp.ProxyEndpoint.run(ProxyEndpoint.java, Compiled Code) at allaire.jrun.ThreadPool.run(ThreadPool.java, Compiled Code) at allaire.jrun.WorkerThread.run(WorkerThread.java, Compiled Code)
Anonymous
Ranch Hand
Joined: Nov 22, 2008
Posts: 18944
posted
0
I haven't worked with JRun, only with Java Web Server. However, I ran into the same problem, and needed to do two things: 1. Originally, I had put my JSPs in a package, and I had to take them out of the package. 2. I had to move the Java classes (servlets) from the servlets folder to the classes folder. Hope this helps.
maha anna
Ranch Hand
Joined: Jan 31, 2000
Posts: 1467
posted
0
ClassCastException will occur due to runtime casting errors. It occurs when we try to cast an object to a class type which is incombatible. You may have to check your code once more I think. regds maha anna I just give you an example:
[This message has been edited by maha anna (edited December 04, 2000).]
Hi all, Thanks a lot. Yeah it definitely is a classloader issue. We have got the work around by putting the beans in the JRun's classpath. I just looked at the documentation at weblogic. They definitely have done a good job. Their explanation I believe will be valid for most of the Application servers available.
Taha Mohamed
Greenhorn
Joined: Oct 26, 2000
Posts: 6
posted
0
Dear All, There is a simple solution for this. Try using scope="page" (instead of scope="session") in your <jsp:UseBean> Tag. This will make sure that the class is loaded for every page instead of once every session. If the scope is session, the servlet class loader will load the class only once per session. So the object in the later page will be casted to the class of the previous session which is incompatable (unlike the object in the previous page). Please let me know if my statement is incorrect. ------------------