ClassCastException in JSP
This is driving me NUTS!!
I set up a vector object in a servlet and use it to store some javabeans. I
then store the Vector in the application object), forward to a JSP and
iterate thru the Vector.
In doing so I cast the elements to the bean class. I get a
classcastException that does not make sense. When I do
vector.elementAt(i).getClass().getName() it has the correct class name! So
why can't I cast to it?
This is a show stopper for me, please help.
John.
Michael , we had the same problem.
It came out to be due to the fact that we were putting the Beans for the
Servlets (the Helper classes) in the servletclasses directory together with
the servlets.
In this way they will only be available to the servlets , but not to the
JSPs,
which use a different class loader..
We solved all of this by putting thebean class in the JAVA_CLASSPATH
and NOT in the servletclasses...
Now everything works beautifully!
Max
MIchael Raisis <[email protected]> wrote in message
news:[email protected]...
> I am having a similar problem but only when I try and
> pass an object from a servlet to a JSP using the request
> object.
>
> If I use the session object everything is fine.
>
> I am using Servlet 2.2 Web applications.
>
> Any suggestions?
>
>
> "Jas" <[email protected]> wrote in message
> news:[email protected]...
> > welcome to the club
> >
> > JOG wrote:
> >
> > > This is driving me NUTS!!
> > > I set up a vector object in a servlet and use it to store some
> javabeans. I
> > > then store the Vector in the application object), forward to a JSP and
> > > iterate thru the Vector.
> > >
> > > In doing so I cast the elements to the bean class. I get a
> > > classcastException that does not make sense. When I do
> > > vector.elementAt(i).getClass().getName() it has the correct class
name!
> So
> > > why can't I cast to it?
> > >
> > > This is a show stopper for me, please help.
> > > John.
> >
>
>
Similar Messages
-
Hi I am new Jdeveloper and java
I am getiing the following error when I try to run the project
500 Internal Server Error
java.lang.IllegalAccessError: javax/naming/InitialContext at org.apache.struts.action.ActionServlet.init(ActionServlet.java:473) at javax.servlet.GenericServlet.init(GenericServlet.java:259) at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.2.0)].server.http.HttpApplication.loadServlet(HttpApplication.java:2365) at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.2.0)].server.http.HttpApplication.findServlet(HttpApplication.java:4807) at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.2.0)].server.http.HttpApplication.getRequestDispatcher(HttpApplication.java:2833) at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.2.0)].server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:680) at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.2.0)].server.http.HttpRequestHandler.run(HttpRequestHandler.java:285) at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.2.0)].server.http.HttpRequestHandler.run(HttpRequestHandler.java:126) at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.2.0)].util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:186) at java.lang.Thread.run(Thread.java:534)
and the OC4j server log show as java.lang.ClassCastException: oracle.jsp.runtimev2.JspServlet
Can any one help me resolving the issue
Thanks,
KrishHi I am new Jdeveloper and java
I am getiing the following error when I try to run the project
500 Internal Server Error
java.lang.IllegalAccessError: javax/naming/InitialContext at org.apache.struts.action.ActionServlet.init(ActionServlet.java:473) at javax.servlet.GenericServlet.init(GenericServlet.java:259) at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.2.0)].server.http.HttpApplication.loadServlet(HttpApplication.java:2365) at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.2.0)].server.http.HttpApplication.findServlet(HttpApplication.java:4807) at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.2.0)].server.http.HttpApplication.getRequestDispatcher(HttpApplication.java:2833) at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.2.0)].server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:680) at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.2.0)].server.http.HttpRequestHandler.run(HttpRequestHandler.java:285) at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.2.0)].server.http.HttpRequestHandler.run(HttpRequestHandler.java:126) at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.2.0)].util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:186) at java.lang.Thread.run(Thread.java:534)
and the OC4j server log show as java.lang.ClassCastException: oracle.jsp.runtimev2.JspServlet
Can any one help me resolving the issue
Thanks,
Krish -
Java.lang.ClassCastException in JSP
Hi All,
We are facing "java.lang.ClassCastException" in JSP page. Below are JSP code, printStackTrace and compiled JSP (from Application Server) file.
We are using Struts 1.2.7, JDK 1.4.2 and Oracle 10g OC4J.
JSP Code:
<nested:iterate property="coverage">
<tr>
<td class="text" align="left" valign="top" width="198" height="2">
<html:hidden name="coverage" property="coverageType" indexed="true"/>
<bean:write name="coverage" property="coverageDescription"/>
</nested:iterate>
printStackTrace:
08/03/26 15:48:07 java.lang.ClassCastException
08/03/26 15:48:07 at jsp.quickquote._Coverages._jspService(_Coverages.java:244)
08/03/26 15:48:07 at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:56)
08/03/26 15:48:07 at oracle.jsp.runtimev2.JspPageTable.compileAndServe(JspPageTable.java:569)
08/03/26 15:48:07 at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:305)
08/03/26 15:48:07 at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:509)
08/03/26 15:48:07 at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:413)
08/03/26 15:48:07 at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
08/03/26 15:48:07 at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:824)
08/03/26 15:48:07 at com.evermind.server.http.ServletRequestDispatcher.include(ServletRequestDispatcher.java:121)
08/03/26 15:48:07 at com.evermind.server.http.EvermindPageContext.include(EvermindPageContext.java:267)
08/03/26 15:48:07 at org.apache.struts.tiles.TilesUtilImpl.doInclude(TilesUtilImpl.java:99)
08/03/26 15:48:07 at org.apache.struts.tiles.TilesUtil.doInclude(TilesUtil.java:135)
08/03/26 15:48:07 at org.apache.struts.taglib.tiles.InsertTag.doInclude(InsertTag.java:760)
08/03/26 15:48:07 at org.apache.struts.taglib.tiles.InsertTag$InsertHandler.doEndTag(InsertTag.java:892)
08/03/26 15:48:07 at org.apache.struts.taglib.tiles.InsertTag.doEndTag(InsertTag.java:462)
08/03/26 15:48:07 at jsp.template._mainLayout._jspService(_mainLayout.java:93)
08/03/26 15:48:07 at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:56)
08/03/26 15:48:07 at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:350)
08/03/26 15:48:07 at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:509)
08/03/26 15:48:07 at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:413)
08/03/26 15:48:07 at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
08/03/26 15:48:07 at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:824)
08/03/26 15:48:07 at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:330)
08/03/26 15:48:07 at com.evermind.server.http.ServletRequestDispatcher.forward(ServletRequestDispatcher.java:222)
08/03/26 15:48:07 at org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1063)
08/03/26 15:48:07 at org.apache.struts.tiles.TilesRequestProcessor.doForward(TilesRequestProcessor.java:263)
08/03/26 15:48:07 at org.apache.struts.tiles.TilesRequestProcessor.processTilesDefinition(TilesRequestProcessor.java:239)
08/03/26 15:48:07 at org.apache.struts.tiles.TilesRequestProcessor.processForwardConfig(TilesRequestProcessor.java:302)
08/03/26 15:48:07 at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:229)
08/03/26 15:48:07 at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1194)
08/03/26 15:48:07 at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
08/03/26 15:48:07 at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
08/03/26 15:48:07 at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
08/03/26 15:48:07 at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:824)
08/03/26 15:48:07 at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:330)
08/03/26 15:48:07 at com.evermind.server.http.ServletRequestDispatcher.forward(ServletRequestDispatcher.java:222)
08/03/26 15:48:07 at org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1063)
08/03/26 15:48:07 at org.apache.struts.tiles.TilesRequestProcessor.doForward(TilesRequestProcessor.java:263)
08/03/26 15:48:07 at org.apache.struts.action.RequestProcessor.processForwardConfig(RequestProcessor.java:386)
08/03/26 15:48:07 at org.apache.struts.tiles.TilesRequestProcessor.processForwardConfig(TilesRequestProcessor.java:318)
08/03/26 15:48:07 at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:229)
08/03/26 15:48:07 at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1194)
08/03/26 15:48:07 at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
08/03/26 15:48:07 at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
08/03/26 15:48:07 at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
08/03/26 15:48:07 at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:824)
08/03/26 15:48:07 at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:330)
08/03/26 15:48:07 at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:830)
08/03/26 15:48:07 at com.evermind.server.http.AJPRequestHandler.run(AJPRequestHandler.java:224)
08/03/26 15:48:07 at com.evermind.server.http.AJPRequestHandler.run(AJPRequestHandler.java:133)
08/03/26 15:48:07 at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:192)
08/03/26 15:48:07 at java.lang.Thread.run(Thread.java:534)
Error is coming in compiled JSP:
org.apache.struts.taglib.bean.WriteTag __jsp_taghandler_12=(org.apache.struts.taglib.bean.WriteTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.WriteTag.class,"org.apache.struts.taglib.bean.WriteTag name property");
In Struts Action we have used below code
CoverageModel[] cs = (CoverageModel[])coverageCol.toArray(new CoverageModel[0]);
f.set("coverage", cs);
We are facing above exception after 6/8 hours of Application restart. . Some time we not facing above exception till 48hrs.
5 users accessing application day time.
e.g.
If we restart server @ 1 PM then try to login with new browser session at 7 PM or 9 PM, we are facing "java.lang.ClassCastException" on JSP page.
If we restart Applcation Server then code is working fine. After restart, we not get null pointer class cast exception for next 6/8 hour.
Please let me know if anybody has any suggestion/solution.
Thanks and Regards,
KailasHi All,
We are facing "java.lang.ClassCastException" in JSP page. Below are JSP code, printStackTrace and compiled JSP (from Application Server) file.
We are using Struts 1.2.7, JDK 1.4.2 and Oracle 10g OC4J.
JSP Code:
<nested:iterate property="coverage">
<tr>
<td class="text" align="left" valign="top" width="198" height="2">
<html:hidden name="coverage" property="coverageType" indexed="true"/>
<bean:write name="coverage" property="coverageDescription"/>
</nested:iterate>
printStackTrace:
08/03/26 15:48:07 java.lang.ClassCastException
08/03/26 15:48:07 at jsp.quickquote._Coverages._jspService(_Coverages.java:244)
08/03/26 15:48:07 at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:56)
08/03/26 15:48:07 at oracle.jsp.runtimev2.JspPageTable.compileAndServe(JspPageTable.java:569)
08/03/26 15:48:07 at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:305)
08/03/26 15:48:07 at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:509)
08/03/26 15:48:07 at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:413)
08/03/26 15:48:07 at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
08/03/26 15:48:07 at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:824)
08/03/26 15:48:07 at com.evermind.server.http.ServletRequestDispatcher.include(ServletRequestDispatcher.java:121)
08/03/26 15:48:07 at com.evermind.server.http.EvermindPageContext.include(EvermindPageContext.java:267)
08/03/26 15:48:07 at org.apache.struts.tiles.TilesUtilImpl.doInclude(TilesUtilImpl.java:99)
08/03/26 15:48:07 at org.apache.struts.tiles.TilesUtil.doInclude(TilesUtil.java:135)
08/03/26 15:48:07 at org.apache.struts.taglib.tiles.InsertTag.doInclude(InsertTag.java:760)
08/03/26 15:48:07 at org.apache.struts.taglib.tiles.InsertTag$InsertHandler.doEndTag(InsertTag.java:892)
08/03/26 15:48:07 at org.apache.struts.taglib.tiles.InsertTag.doEndTag(InsertTag.java:462)
08/03/26 15:48:07 at jsp.template._mainLayout._jspService(_mainLayout.java:93)
08/03/26 15:48:07 at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:56)
08/03/26 15:48:07 at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:350)
08/03/26 15:48:07 at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:509)
08/03/26 15:48:07 at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:413)
08/03/26 15:48:07 at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
08/03/26 15:48:07 at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:824)
08/03/26 15:48:07 at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:330)
08/03/26 15:48:07 at com.evermind.server.http.ServletRequestDispatcher.forward(ServletRequestDispatcher.java:222)
08/03/26 15:48:07 at org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1063)
08/03/26 15:48:07 at org.apache.struts.tiles.TilesRequestProcessor.doForward(TilesRequestProcessor.java:263)
08/03/26 15:48:07 at org.apache.struts.tiles.TilesRequestProcessor.processTilesDefinition(TilesRequestProcessor.java:239)
08/03/26 15:48:07 at org.apache.struts.tiles.TilesRequestProcessor.processForwardConfig(TilesRequestProcessor.java:302)
08/03/26 15:48:07 at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:229)
08/03/26 15:48:07 at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1194)
08/03/26 15:48:07 at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
08/03/26 15:48:07 at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
08/03/26 15:48:07 at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
08/03/26 15:48:07 at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:824)
08/03/26 15:48:07 at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:330)
08/03/26 15:48:07 at com.evermind.server.http.ServletRequestDispatcher.forward(ServletRequestDispatcher.java:222)
08/03/26 15:48:07 at org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1063)
08/03/26 15:48:07 at org.apache.struts.tiles.TilesRequestProcessor.doForward(TilesRequestProcessor.java:263)
08/03/26 15:48:07 at org.apache.struts.action.RequestProcessor.processForwardConfig(RequestProcessor.java:386)
08/03/26 15:48:07 at org.apache.struts.tiles.TilesRequestProcessor.processForwardConfig(TilesRequestProcessor.java:318)
08/03/26 15:48:07 at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:229)
08/03/26 15:48:07 at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1194)
08/03/26 15:48:07 at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
08/03/26 15:48:07 at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
08/03/26 15:48:07 at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
08/03/26 15:48:07 at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:824)
08/03/26 15:48:07 at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:330)
08/03/26 15:48:07 at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:830)
08/03/26 15:48:07 at com.evermind.server.http.AJPRequestHandler.run(AJPRequestHandler.java:224)
08/03/26 15:48:07 at com.evermind.server.http.AJPRequestHandler.run(AJPRequestHandler.java:133)
08/03/26 15:48:07 at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:192)
08/03/26 15:48:07 at java.lang.Thread.run(Thread.java:534)
Error is coming in compiled JSP:
org.apache.struts.taglib.bean.WriteTag __jsp_taghandler_12=(org.apache.struts.taglib.bean.WriteTag)OracleJspRuntime.getTagHandler(pageContext,org.apache.struts.taglib.bean.WriteTag.class,"org.apache.struts.taglib.bean.WriteTag name property");
In Struts Action we have used below code
CoverageModel[] cs = (CoverageModel[])coverageCol.toArray(new CoverageModel[0]);
f.set("coverage", cs);
We are facing above exception after 6/8 hours of Application restart. . Some time we not facing above exception till 48hrs.
5 users accessing application day time.
e.g.
If we restart server @ 1 PM then try to login with new browser session at 7 PM or 9 PM, we are facing "java.lang.ClassCastException" on JSP page.
If we restart Applcation Server then code is working fine. After restart, we not get null pointer class cast exception for next 6/8 hour.
Please let me know if anybody has any suggestion/solution.
Thanks and Regards,
Kailas -
Java.lang.ClassCastException in JSP page
My JSP page:
<%@page contentType="text/html"%>
<HTML>
<HEAD>
<TITLE> JDBC Servlet/JSP Example </TITLE>
</HEAD>
<BODY>
<%@ page import="myBeans.memoryBean" %>
<%@ page import="java.util.Vector" %>
<H1> JDBC Servlet/JSP Example </H1>
<H2> <%= session.getValue("message") %>
</H2>
<UL>
<%
Vector vData = (Vector) session.getValue("res");
myBeans.memoryBean mb;
Object o;
for (Enumeration e = vData.elements() ; e.hasMoreElements() ;) {
o = e.nextElement();
mb = (myBeans.memoryBean) o;
%>
<LI> <%= o.getClass().getName() %>
<% } // end for
%>
</UL>
</BODY>
</HTML>Notice that I don't even use the object I cast but I still get the error message:
Exception:
java.lang.ClassCastException
at _memory._search._jspService(_search.java:66)
at oracle.jsp.runtime.HttpJsp.service(HttpJsp.java)
at oracle.jsp.app.JspApplication.dispatchRequest(JspApplication.java)
at oracle.jsp.JspServlet.doDispatch(JspServlet.java)
at oracle.jsp.JspServlet.internalService(JspServlet.java)
at oracle.jsp.JspServlet.service(JspServlet.java)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:588)
at org.apache.jserv.JServConnection.processRequest(JServConnection.java:314)
at org.apache.jserv.JServConnection.run(JServConnection.java:188)
at java.lang.Thread.run(Thread.java:534)When I comment out the line that castes my object my browser displays:
JDBC Servlet/JSP Example
Records Found:
* myBeans.memoryBean
* myBeans.memoryBean
* myBeans.memoryBean Notice that the three objects that are returned are exactly the type that I caste to.
Also, I did a getClass().getClassLoader() when I create the objects in my servlet code and again on the JSP pages for each object I pull out of the vector and the class loader matched.
I even changed the package on my bean class and recompiled everything to make sure it wasn't a old .class file floating around.
Could this have something to do with my classpath or where my classes are being placed? I found a similar problem here: http://forum.java.sun.com/thread.jsp?forum=33&thread=380437&start=0&range=15&hilite=false&q=
but the explanation of what was done wasn't clear
Anyone have any idea what's going on here?
I am using:
Oracle 9i
Oracle HTTP Server Powered by Apache/1.3.12 (Unix)
ApacheJServ/1.1
Thanks in advance.
- LinusIs ti at all possible that you have another jar / zip file with the same class file in it, seemingly away from the Server classpath ? In which case this could happen even though logically it shouldn't !!!
-
How to catch ClassCastException from JSP page?
I get a ClassCastException within my JSP page and I know where my bug is. However, this classcastexception message is displayed in the browser and I want to catch this exception to also log it into my log file. But I can't find the place where to catch it: in my servlet's doPost() method I can't catch it - i tried it by enclosing the method body with try/catch but it isn't catched. I wonder if I can catch it at all or if this error is handled internally in the servlet engine?
It should only be displayed in the browser if you're not catching the exception in the jsp itself. If the exception is happening in the jsp, then there's no point in trying to catch it in the servlet.
What happens if you put a try-catch just around the actual code in the jsp? You could put it around the entire jsp, but that's not necessary.
One problem I've encountered in catching exceptions is if there are escape sequences within the try block, for example:
try{
//java code
%>
<!--html -->
<%
//java
catch (Exception e)I'm not sure if that works or not, but to be safe, make sure you're not escaping from jsp within the try block. -
Java.lang.ClassCastException in jsp trying to access session bean
Ok I'm totally stuck on this. I've been able to deploy my session bean facade to a bunch of entities bean with no problem. Now I'm trying to access the bean from a JSP. I can do a lookup ok, I can even do a PortableRemoteObject.narrow() ok, but when I try to actually cast the object I get an error. I can't understand why narrow works if the object is not of the correct type, when I do reflection I can verify that the object implements the interface I am trying to cast to. But when I do an instanceof the object from narrow is not the right type. I'm totally confused by this.
Here's my jsp,
<%@taglib uri="/com/sct/socrates/web/jsp/tld/UserAdmin.tld" prefix="UserAdmin" %>
<%@ page import="java.sql.*" %>
<%@ page import="javax.naming.*" %>
<%@ page import="com.sct.socrates.useradmin.model.UserAdminHome" %>
<%@page import="javax.rmi.PortableRemoteObject"%>
<html>
<body>
<pre>
<%
try {
InitialContext context = new InitialContext();
Object object1 = context.lookup("com.sct.socrates.useradmin.model.UserAdminHome");
out.println(object1.getClass().getName());
Object object2 = PortableRemoteObject.narrow(object1, UserAdminHome.class);
out.println(object2.getClass().getName());
if (object2 instanceof UserAdminHome) out.println("is instance");
Class[] list = object2.getClass().getInterfaces();
for(int i=0;i<list.length;i++)
out.println(list.getName());
UserAdminHome home = (UserAdminHome) object2;
} catch (Exception e){
e.printStackTrace();
%>
</pre>
</body>
</html>
Here's the output from the JSP,
com.sct.socrates.useradmin.model._UserAdminHome_Stub
com.sct.socrates.useradmin.model._UserAdminHome_Stub
com.sct.socrates.useradmin.model.UserAdminHome
Here's the server output,
FINE: for host 127.0.0.1 trying to GET /socrates/jsp/guest/test.jsp, ntrans-j2ee reports: mapped uri "/jsp/guest/test.jsp" in context "/socrates" to resource
FINE: context = StandardEngine[null].StandardHost[server1].StandardContext[socrates]
FINE: contextPath = /socrates
FINE: wrapper = StandardEngine[null].StandardHost[server1].StandardContext[socrates].StandardWrapper[jsp]
FINE: servletPath = /jsp/guest/test.jsp
FINE: pathInfo = null
FINE: SingleSignOn[server1]: Process request for '/socrates/jsp/guest/test.jsp'
FINE: SingleSignOn[server1]: Checking for SSO cookie
FINE: SingleSignOn[server1]: SSO cookie is not present
FINE: Authenticator[socrates]: Security checking request GET /socrates/jsp/guest/test.jsp
FINE: Authenticator[socrates]: Checking constraint 'SecurityConstraint[community]' against GET /jsp/guest/test.jsp --> false
FINE: Authenticator[socrates]: Checking constraint 'SecurityConstraint[user]' against GET /jsp/guest/test.jsp --> false
FINE: Authenticator[socrates]: Checking constraint 'SecurityConstraint[community]' against GET /jsp/guest/test.jsp --> false
FINE: Authenticator[socrates]: Checking constraint 'SecurityConstraint[moderator]' against GET /jsp/guest/test.jsp --> false
FINE: Authenticator[socrates]: Checking constraint 'SecurityConstraint[admin]' against GET /jsp/guest/test.jsp --> false
FINE: Authenticator[socrates]: No applicable constraint located
FINE: Authenticator[socrates]: Not subject to any constraint
FINE: JspEngine --> /jsp/guest/test.jsp
FINE: ServletPath: /jsp/guest/test.jsp
FINE: PathInfo: null
FINE: RealPath: E:\dev\app_server\sun\appserv\domains\domain1\server1\applications\j2ee-apps\socrates_3\socrates_war\jsp\guest\test.jsp
FINE: RequestURI: /socrates/jsp/guest/test.jsp
FINE: QueryString: null
FINE: ++++ Entered SecClientRequestInterceptor::send_request()
FINE: Security context is null (nothing to add to service context)
FINE: No SAS context element found in service context list
FINE: ++++ Entered SecClientRequestInterceptor::receive_reply
FINE: No SAS context element found in service context list
FINE: Status to be set : 0
FINE: Invoked receivedReply()
FINE: ++++ Entered SecClientRequestInterceptor::send_request()
FINE: Security context is null (nothing to add to service context)
FINE: No SAS context element found in service context list
FINE: ++++ Entered SecClientRequestInterceptor::receive_reply
FINE: No SAS context element found in service context list
FINE: Status to be set : 0
FINE: Invoked receivedReply()
FINE: service-j2ee: name = "com.sct.socrates.useradmin.model._UserAdminHome_Stub", codebase = ""
FINER: service-j2ee: (thread context class loader: WebappClassLoader
available:
delegate: false
repositories:
/WEB-INF/classes/
required:
----------> Parent Classloader:
EJB CL:
[com.iplanet.ias.loader.EJBClassLoader$URLEntry@e1df6e, com.iplanet.ias.loader.EJBClassLoader$URLEntry@13b9fb]
FINER: service-j2ee: class "com.sct.socrates.useradmin.model._UserAdminHome_Stub" found via codebase, defined by EJB CL:
[com.iplanet.ias.loader.EJBClassLoader$URLEntry@e1df6e, com.iplanet.ias.loader.EJBClassLoader$URLEntry@13b9fb]
FINE: ++++ Entered SecClientRequestInterceptor::send_request()
FINE: Security context is null (nothing to add to service context)
FINE: No SAS context element found in service context list
FINE: ++++ Entered SecClientRequestInterceptor::receive_reply
FINE: No SAS context element found in service context list
FINE: Status to be set : 0
FINE: Invoked receivedReply()
FINE: service-j2ee: name = "com.sct.socrates.useradmin.model._UserAdminHome_Stub", codebase = ""
FINER: service-j2ee: (thread context class loader: WebappClassLoader
available:
delegate: false
repositories:
/WEB-INF/classes/
required:
----------> Parent Classloader:
EJB CL:
[com.iplanet.ias.loader.EJBClassLoader$URLEntry@e1df6e, com.iplanet.ias.loader.EJBClassLoader$URLEntry@13b9fb]
FINER: service-j2ee: class "com.sct.socrates.useradmin.model._UserAdminHome_Stub" found via codebase, defined by EJB CL:
[com.iplanet.ias.loader.EJBClassLoader$URLEntry@e1df6e, com.iplanet.ias.loader.EJBClassLoader$URLEntry@13b9fb]
WARNING: CORE3283: stderr: java.lang.ClassCastException: com.sct.socrates.useradmin.model._UserAdminHome_Stub
WARNING: CORE3283: stderr: at jasper.jsp._guest._test_jsp._jspService(_test_jsp.java:89)
WARNING: CORE3283: stderr: at org.apache.jasper.runtime.HttpJspBase.service(Unknown Source)
WARNING: CORE3283: stderr: at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
WARNING: CORE3283: stderr: at com.iplanet.ias.web.jsp.JspServlet$JspServletWrapper.service(Unknown Source)
WARNING: CORE3283: stderr: at com.iplanet.ias.web.jsp.JspServlet.serviceJspFile(Unknown Source)
WARNING: CORE3283: stderr: at com.iplanet.ias.web.jsp.JspServlet.service(Unknown Source)
WARNING: CORE3283: stderr: at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
WARNING: CORE3283: stderr: at org.apache.catalina.core.StandardWrapperValve.invokeServletService(Unknown Source)
WARNING: CORE3283: stderr: at org.apache.catalina.core.StandardWrapperValve.access$000(Unknown Source)
WARNING: CORE3283: stderr: at org.apache.catalina.core.StandardWrapperValve$1.run(Unknown Source)
WARNING: CORE3283: stderr: at java.security.AccessController.doPrivileged(Native Method)
WARNING: CORE3283: stderr: at org.apache.catalina.core.StandardWrapperValve.invoke(Unknown Source)
WARNING: CORE3283: stderr: at org.apache.catalina.core.StandardPipeline.invoke(Unknown Source)
WARNING: CORE3283: stderr: at org.apache.catalina.core.StandardContextValve.invoke(Unknown Source)
WARNING: CORE3283: stderr: at org.apache.catalina.core.StandardPipeline.invoke(Unknown Source)
WARNING: CORE3283: stderr: at org.apache.catalina.core.StandardHostValve.invoke(Unknown Source)
WARNING: CORE3283: stderr: at org.apache.catalina.core.StandardPipeline.invoke(Unknown Source)
WARNING: CORE3283: stderr: at com.iplanet.ias.web.connector.nsapi.NSAPIProcessor.process(Unknown Source)
WARNING: CORE3283: stderr: at com.iplanet.ias.web.WebContainer.service(Unknown Source)Please configure the classloader to delegate to the parent loader by specifying the following in WEB-INF/sun-web.xml (the Sun ONE Application Server specific deployment descriptor for web applications)
<class-loader delegate="true"/>
More information on this can be found at
http://docs.sun.com/source/816-7150-10/dwdeploy.html#48102
Thanks,
Arvind -
I'm getting this weird exception when I load a jsp form:
java.lang.ClassCastException: fxmatcher.FxFormBean
Here's the line in the generated Java file (from the original JSP)where the exception occurred:
fxFormBean = (fxmatcher.FxFormBean)request.getAttribute("fxFormBean");
The weird problem is that I only get the error the first time I load the jsp. If I reload it, everything is fine.
Here are some relevant snippets from the jsp:
<jsp:useBean id="fxFormBean" class="fxmatcher.FxFormBean" scope="request"/>
<%@ page import="java.util.*,java.io.*, java.lang.*" %>
Does any one know why this is happening? I think it has something to do with request.getAttribute returning a null because the bean is not instantiated yet when I call the jsp the first time, but I'm not sure. If this is indeed the case, how can I rewrite my jsp so that this doesn't happen again? Thanks for your helpSure thing.
Here's the stack trace:
java.lang.ClassCastException: fxmatcher.FxFormBean
at jsp_servlet.__index._jspService(__index.java:90)
at weblogic.servlet.jsp.JspBase.service(JspBase.java:27)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:265)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:200)
at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:2495)
at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2204)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
relevant snippets of compiled code:
/* compiled from JSP: /index.jsp
* This code was automatically generated at 4:12:26 PM on Aug 27, 2003
* by weblogic.servlet.jsp.Jsp2Java -- do not edit.
javax.servlet.http.HttpSession session = request.getSession(true);
try { // error page try block
fxmatcher.FxFormBean fxFormBean = null; //[ /index.jsp; Line: 1]
fxFormBean = (fxmatcher.FxFormBean)session.getAttribute("fxFormBean"); //[ /
index.jsp; Line: 1]
if (fxFormBean == null) { // begin 'fxFormBean' instantiation block... //[ /
index.jsp; Line: 1]
synchronized (session) { //[ /index.jsp; Line: 1]
fxFormBean = (fxmatcher.FxFormBean)session.getAttribute("fxFormBean"
); //[ /index.jsp; Line: 1]
if (fxFormBean == null) { // begin 'fxFormBean' synchronized instant
iation block... //[ /index.jsp; Line: 1]
fxFormBean = new fxmatcher.FxFormBean(); //[ /index.jsp; Line: 1
session.setAttribute("fxFormBean", fxFormBean); //[ /index.jsp;
Line: 1]
} // end synchronized bean instantiation block... //[ /index.jsp; Li
ne: 1]
} // end synchronized bean scope block... //[ /index.jsp; Line: 1]
} // end bean instantiation block... //[ /index.jsp; Line: 1]
out.print("\r\n"); -
Web application deployment problem. FacesServlet exception.
Hello.
I used Jdeveloper 10.1.3.4 and deployed my web-app on OAS 10.1.3 (Windows) succesfully. But when I'm trying to access my application, I get in application.log following errors:
11/02/08 14:29:18.213 test: Error initializing servlet
java.lang.ClassCastException: oracle.jsp.runtimev2.JspServlet cannot be cast to com.evermind.server.http.JspInterface
at com.evermind.server.http.JspServletInstanceInfo.initializeJsp(JspServletInstanceInfo.java:127)
at com.evermind.server.http.HttpApplication.loadServlet(HttpApplication.java:2505)
at com.evermind.server.http.HttpApplication.findServlet(HttpApplication.java:5006)
at com.evermind.server.http.HttpApplication.findServlet(HttpApplication.java:4930)
at com.evermind.server.http.HttpApplication.initPreloadServlets(HttpApplication.java:5118)
at com.evermind.server.http.HttpApplication.initDynamic(HttpApplication.java:1283)
at com.evermind.server.http.HttpApplication.<init>(HttpApplication.java:848)
at com.evermind.server.ApplicationStateRunning.getHttpApplication(ApplicationStateRunning.java:435)
at com.evermind.server.Application.getHttpApplication(Application.java:592)
at com.evermind.server.http.HttpSite$HttpApplicationRunTimeReference.createHttpApplicationFromReference(HttpSite.java:2280)
at com.evermind.server.http.HttpSite$HttpApplicationRunTimeReference.<init>(HttpSite.java:2199)
at com.evermind.server.http.HttpSite.addHttpApplication(HttpSite.java:1833)
at oracle.oc4j.admin.internal.WebApplicationBinder.bindWebApp(WebApplicationBinder.java:304)
at oracle.oc4j.admin.internal.WebApplicationBinder.bindWebApp(WebApplicationBinder.java:120)
at oracle.oc4j.admin.internal.WebApplicationBinder.bindWebApp(WebApplicationBinder.java:92)
at oracle.oc4j.admin.internal.ApplicationDeployer.bindWebApp(ApplicationDeployer.java:825)
at oracle.oc4j.admin.internal.ApplicationDeployer.doDeploy(ApplicationDeployer.java:276)
at oracle.oc4j.admin.internal.DeployerBase.execute(DeployerBase.java:100)
at oracle.oc4j.admin.jmx.server.mbeans.deploy.OC4JDeployerRunnable.doRun(OC4JDeployerRunnable.java:52)
at oracle.oc4j.admin.jmx.server.mbeans.deploy.DeployerRunnable.run(DeployerRunnable.java:81)
at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:298)
at java.lang.Thread.run(Thread.java:619)
11/02/08 14:29:18.214 test: Error preloading servlet
javax.servlet.ServletException: Error initializing servlet
at com.evermind.server.http.HttpApplication.findServlet(HttpApplication.java:5033)
at com.evermind.server.http.HttpApplication.findServlet(HttpApplication.java:4930)
at com.evermind.server.http.HttpApplication.initPreloadServlets(HttpApplication.java:5118)
at com.evermind.server.http.HttpApplication.initDynamic(HttpApplication.java:1283)
at com.evermind.server.http.HttpApplication.<init>(HttpApplication.java:848)
at com.evermind.server.ApplicationStateRunning.getHttpApplication(ApplicationStateRunning.java:435)
at com.evermind.server.Application.getHttpApplication(Application.java:592)
at com.evermind.server.http.HttpSite$HttpApplicationRunTimeReference.createHttpApplicationFromReference(HttpSite.java:2280)
at com.evermind.server.http.HttpSite$HttpApplicationRunTimeReference.<init>(HttpSite.java:2199)
at com.evermind.server.http.HttpSite.addHttpApplication(HttpSite.java:1833)
at oracle.oc4j.admin.internal.WebApplicationBinder.bindWebApp(WebApplicationBinder.java:304)
at oracle.oc4j.admin.internal.WebApplicationBinder.bindWebApp(WebApplicationBinder.java:120)
at oracle.oc4j.admin.internal.WebApplicationBinder.bindWebApp(WebApplicationBinder.java:92)
at oracle.oc4j.admin.internal.ApplicationDeployer.bindWebApp(ApplicationDeployer.java:825)
at oracle.oc4j.admin.internal.ApplicationDeployer.doDeploy(ApplicationDeployer.java:276)
at oracle.oc4j.admin.internal.DeployerBase.execute(DeployerBase.java:100)
at oracle.oc4j.admin.jmx.server.mbeans.deploy.OC4JDeployerRunnable.doRun(OC4JDeployerRunnable.java:52)
at oracle.oc4j.admin.jmx.server.mbeans.deploy.DeployerRunnable.run(DeployerRunnable.java:81)
at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:298)
at java.lang.Thread.run(Thread.java:619)
11/02/08 14:29:18.285 test: Error initializing servlet
java.lang.NullPointerException
at javax.faces.webapp.FacesServlet.init(FacesServlet.java:165)
at com.evermind.server.http.HttpApplication.loadServlet(HttpApplication.java:2528)
at com.evermind.server.http.HttpApplication.findServlet(HttpApplication.java:5006)
at com.evermind.server.http.HttpApplication.findServlet(HttpApplication.java:4930)
at com.evermind.server.http.HttpApplication.initPreloadServlets(HttpApplication.java:5118)
at com.evermind.server.http.HttpApplication.initDynamic(HttpApplication.java:1283)
at com.evermind.server.http.HttpApplication.<init>(HttpApplication.java:848)
at com.evermind.server.ApplicationStateRunning.getHttpApplication(ApplicationStateRunning.java:435)
at com.evermind.server.Application.getHttpApplication(Application.java:592)
at com.evermind.server.http.HttpSite$HttpApplicationRunTimeReference.createHttpApplicationFromReference(HttpSite.java:2280)
at com.evermind.server.http.HttpSite$HttpApplicationRunTimeReference.<init>(HttpSite.java:2199)
at com.evermind.server.http.HttpSite.addHttpApplication(HttpSite.java:1833)
at oracle.oc4j.admin.internal.WebApplicationBinder.bindWebApp(WebApplicationBinder.java:304)
at oracle.oc4j.admin.internal.WebApplicationBinder.bindWebApp(WebApplicationBinder.java:120)
at oracle.oc4j.admin.internal.WebApplicationBinder.bindWebApp(WebApplicationBinder.java:92)
at oracle.oc4j.admin.internal.ApplicationDeployer.bindWebApp(ApplicationDeployer.java:825)
at oracle.oc4j.admin.internal.ApplicationDeployer.doDeploy(ApplicationDeployer.java:276)
at oracle.oc4j.admin.internal.DeployerBase.execute(DeployerBase.java:100)
at oracle.oc4j.admin.jmx.server.mbeans.deploy.OC4JDeployerRunnable.doRun(OC4JDeployerRunnable.java:52)
at oracle.oc4j.admin.jmx.server.mbeans.deploy.DeployerRunnable.run(DeployerRunnable.java:81)
at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:298)
at java.lang.Thread.run(Thread.java:619)
11/02/08 14:29:18.286 test: Error preloading servlet
javax.servlet.ServletException: Error initializing servlet
at com.evermind.server.http.HttpApplication.findServlet(HttpApplication.java:5033)
at com.evermind.server.http.HttpApplication.findServlet(HttpApplication.java:4930)
at com.evermind.server.http.HttpApplication.initPreloadServlets(HttpApplication.java:5118)
at com.evermind.server.http.HttpApplication.initDynamic(HttpApplication.java:1283)
at com.evermind.server.http.HttpApplication.<init>(HttpApplication.java:848)
at com.evermind.server.ApplicationStateRunning.getHttpApplication(ApplicationStateRunning.java:435)
at com.evermind.server.Application.getHttpApplication(Application.java:592)
at com.evermind.server.http.HttpSite$HttpApplicationRunTimeReference.createHttpApplicationFromReference(HttpSite.java:2280)
at com.evermind.server.http.HttpSite$HttpApplicationRunTimeReference.<init>(HttpSite.java:2199)
at com.evermind.server.http.HttpSite.addHttpApplication(HttpSite.java:1833)
at oracle.oc4j.admin.internal.WebApplicationBinder.bindWebApp(WebApplicationBinder.java:304)
at oracle.oc4j.admin.internal.WebApplicationBinder.bindWebApp(WebApplicationBinder.java:120)
at oracle.oc4j.admin.internal.WebApplicationBinder.bindWebApp(WebApplicationBinder.java:92)
at oracle.oc4j.admin.internal.ApplicationDeployer.bindWebApp(ApplicationDeployer.java:825)
at oracle.oc4j.admin.internal.ApplicationDeployer.doDeploy(ApplicationDeployer.java:276)
at oracle.oc4j.admin.internal.DeployerBase.execute(DeployerBase.java:100)
at oracle.oc4j.admin.jmx.server.mbeans.deploy.OC4JDeployerRunnable.doRun(OC4JDeployerRunnable.java:52)
at oracle.oc4j.admin.jmx.server.mbeans.deploy.DeployerRunnable.run(DeployerRunnable.java:81)
at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:298)
at java.lang.Thread.run(Thread.java:619)
11/02/08 14:29:18.286 test: 10.1.3.5.0 Started
11/02/08 14:32:29.511 test: Servlet error
java.lang.NullPointerException
at com.evermind[Oracle Containers for J2EE 10g (10.1.3.5.0) ].server.http.JspServletInstanceInfo.isJspPageExists(JspServletInstanceInfo.java:164)
at com.evermind[Oracle Containers for J2EE 10g (10.1.3.5.0) ].server.http.HttpApplication.getRequestDispatcher(HttpApplication.java:2771)
at com.evermind[Oracle Containers for J2EE 10g (10.1.3.5.0) ].server.http.HttpRequestHandler.doProcessRequest(HttpRequestHandler.java:775)
at com.evermind[Oracle Containers for J2EE 10g (10.1.3.5.0) ].server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:458)
at com.evermind[Oracle Containers for J2EE 10g (10.1.3.5.0) ].server.http.AJPRequestHandler.run(AJPRequestHandler.java:313)
at com.evermind[Oracle Containers for J2EE 10g (10.1.3.5.0) ].server.http.AJPRequestHandler.run(AJPRequestHandler.java:199)
at oracle.oc4j.network.ServerSocketReadHandler$SafeRunnable.run(ServerSocketReadHandler.java:260)
at com.evermind[Oracle Containers for J2EE 10g (10.1.3.5.0) ].util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:303)
at java.lang.Thread.run(Thread.java:619)
11/02/08 14:37:27.173 test: Servlet error
java.lang.NullPointerException
at com.evermind[Oracle Containers for J2EE 10g (10.1.3.5.0) ].server.http.JspServletInstanceInfo.isJspPageExists(JspServletInstanceInfo.java:164)
at com.evermind[Oracle Containers for J2EE 10g (10.1.3.5.0) ].server.http.HttpApplication.getRequestDispatcher(HttpApplication.java:2771)
at com.evermind[Oracle Containers for J2EE 10g (10.1.3.5.0) ].server.http.HttpRequestHandler.doProcessRequest(HttpRequestHandler.java:775)
at com.evermind[Oracle Containers for J2EE 10g (10.1.3.5.0) ].server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:458)
at com.evermind[Oracle Containers for J2EE 10g (10.1.3.5.0) ].server.http.AJPRequestHandler.run(AJPRequestHandler.java:313)
at com.evermind[Oracle Containers for J2EE 10g (10.1.3.5.0) ].server.http.AJPRequestHandler.run(AJPRequestHandler.java:199)
at oracle.oc4j.network.ServerSocketReadHandler$SafeRunnable.run(ServerSocketReadHandler.java:260)
at oracle.oc4j.network.ServerSocketAcceptHandler.procClientSocket(ServerSocketAcceptHandler.java:234)
at oracle.oc4j.network.ServerSocketAcceptHandler.access$700(ServerSocketAcceptHandler.java:29)
at oracle.oc4j.network.ServerSocketAcceptHandler$AcceptHandlerHorse.run(ServerSocketAcceptHandler.java:879)
at com.evermind[Oracle Containers for J2EE 10g (10.1.3.5.0) ].util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:303)
at java.lang.Thread.run(Thread.java:619)
11/02/08 14:40:07.383 test: Servlet error
java.lang.NullPointerException
at com.evermind[Oracle Containers for J2EE 10g (10.1.3.5.0) ].server.http.JspServletInstanceInfo.isJspPageExists(JspServletInstanceInfo.java:164)
at com.evermind[Oracle Containers for J2EE 10g (10.1.3.5.0) ].server.http.HttpApplication.getRequestDispatcher(HttpApplication.java:2771)
at com.evermind[Oracle Containers for J2EE 10g (10.1.3.5.0) ].server.http.HttpRequestHandler.doProcessRequest(HttpRequestHandler.java:775)
at com.evermind[Oracle Containers for J2EE 10g (10.1.3.5.0) ].server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:458)
at com.evermind[Oracle Containers for J2EE 10g (10.1.3.5.0) ].server.http.AJPRequestHandler.run(AJPRequestHandler.java:313)
at com.evermind[Oracle Containers for J2EE 10g (10.1.3.5.0) ].server.http.AJPRequestHandler.run(AJPRequestHandler.java:199)
at oracle.oc4j.network.ServerSocketReadHandler$SafeRunnable.run(ServerSocketReadHandler.java:260)
at oracle.oc4j.network.ServerSocketAcceptHandler.procClientSocket(ServerSocketAcceptHandler.java:234)
at oracle.oc4j.network.ServerSocketAcceptHandler.access$700(ServerSocketAcceptHandler.java:29)
at oracle.oc4j.network.ServerSocketAcceptHandler$AcceptHandlerHorse.run(ServerSocketAcceptHandler.java:879)
at com.evermind[Oracle Containers for J2EE 10g (10.1.3.5.0) ].util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:303)
at java.lang.Thread.run(Thread.java:619)
I've found solution for this error: it is necessary to add to web.xml following:
<listener>
<listener-class>com.sun.faces.config.ConfigureListener</listener-class>
</listener>
I've added this, and now get a deployment error:
[Feb 8, 2011 6:04:33 PM] Exception: NoClassDefFoundError: oracle/adf/view/faces/event/industrial/VirtualFunctionKeyActionEvent
[Feb 8, 2011 6:04:34 PM] Operation failed with error: oracle/adf/view/faces/event/industrial/VirtualFunctionKeyActionEvent
Need help to solve the problem!OK. You can call me stupid. I forgot to set the default web application for the
specific server. Another Stupid User Eror Problem. Doh! Later...
- Wayne
"Wayne Lau" <[email protected]> wrote:
>
I'm having an issue where with an exploded directory web application
deployment
on a UNIX server. It doesn't seem that weblogic is finding the JSP.
I'm getting
Error 404.
- porting from wls 5.1 to wls 6.1
- got it ported on Windows 2000
- iPlanet as the web server
- wls 6.1 as the application server
- all JSPs under
/data/current/weblogic_files/applications/prodssl
- for the WebApplication, I have the following settings:
- Name = webap_prodssl
- URI = prodssl
- Path = /data/current/weblogic_files/applications
- in the prod_access.log, I do see that weblogic gets the request
Any ideas? I have not made any security changes. Basically, I installed
wls
6.1, created the servers, created the Web Apps and targeted the Web Apps.
Thanks for any help. Later...
- Wayne -
RequestDispatcher exception?
Hi,
Following sample code trying to forward a jsp page and pass a parameter to the next page
String t = "test";
request.setAttribute("t",t);
try{
RequestDispatcher aDispatcher = request.getRequestDispatcher("UnitScr.jsp");
aDispatcher.forward(request, response);
}catch(Exception ex){
ex.printStackTrace();
But receive following runtime exception. Please let me know if i missed something
java.lang.ClassCastException: oracle.jsp.provider.JspUniversalHttpRequest
void org.apache.tomcat.facade.RequestDispatcherImpl.doForward(javax.servlet.ServletRequest, javax.servlet.ServletResponse)
RequestDispatcherImpl.java:172Hi,
Following sample code trying to forward a jsp page and pass a parameter to the next page
String t = "test";
request.setAttribute("t",t);
try{
RequestDispatcher aDispatcher = request.getRequestDispatcher("UnitScr.jsp");
aDispatcher.forward(request, response);
}catch(Exception ex){
ex.printStackTrace();
But receive following runtime exception. Please let me know if i missed something
java.lang.ClassCastException: oracle.jsp.provider.JspUniversalHttpRequest
void org.apache.tomcat.facade.RequestDispatcherImpl.doForward(javax.servlet.ServletRequest, javax.servlet.ServletResponse)
RequestDispatcherImpl.java:172 -
Hi All,
I am trying to make a simple cascade application.The scenario what i have taken is as follows.
PArent SyncBo:
It fetches data from table consisting of two columns employeeid and designation.
Child SyncBO:
It fetches data from table consisting of two columns designation and salary.
I have used the cascade relation ship between parent and child syncBO.I have defined parent syncBO as related syncBO in child syncBO.
when i am running the application on client.Its giving me the following error.
Error: 500
Location: /ZMDTEST11/jsp/overview_syncbonames.jsp
Internal Servlet Error:
javax.servlet.ServletException
at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:461)
at jsp.overview_0005fsyncbonames._jspService(overview_0005fsyncbonames.java:168)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:119)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:405)
at org.apache.tomcat.core.Handler.service(Handler.java:287)
at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
at org.apache.tomcat.facade.RequestDispatcherImpl.doForward(RequestDispatcherImpl.java:222)
at org.apache.tomcat.facade.RequestDispatcherImpl.forward(RequestDispatcherImpl.java:162)
at com.sap.ip.me.api.runtime.jsp.AbstractMEHttpServlet.dispatchRequest(AbstractMEHttpServlet.java:905)
at com.sap.ip.me.api.runtime.jsp.AbstractMEHttpServlet.doGetNotThreadSafe(AbstractMEHttpServlet.java:344)
at com.sap.ip.me.api.runtime.jsp.AbstractMEHttpServlet.doGet(AbstractMEHttpServlet.java:687)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at com.sap.ip.me.api.runtime.jsp.AbstractMEHttpServlet.service(AbstractMEHttpServlet.java:311)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:405)
at org.apache.tomcat.core.Handler.service(Handler.java:287)
at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
at org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:806)
at org.apache.tomcat.core.ContextManager.service(ContextManager.java:752)
at org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpConnectionHandler.java:213)
at org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416)
at org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:501)
at java.lang.Thread.run(Thread.java:534)
Root cause:
java.lang.ClassCastException
at jsp.overview_0005fsyncbonames._jspService(overview_0005fsyncbonames.java:66)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:119)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:405)
at org.apache.tomcat.core.Handler.service(Handler.java:287)
at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
at org.apache.tomcat.facade.RequestDispatcherImpl.doForward(RequestDispatcherImpl.java:222)
at org.apache.tomcat.facade.RequestDispatcherImpl.forward(RequestDispatcherImpl.java:162)
at com.sap.ip.me.api.runtime.jsp.AbstractMEHttpServlet.dispatchRequest(AbstractMEHttpServlet.java:905)
at com.sap.ip.me.api.runtime.jsp.AbstractMEHttpServlet.doGetNotThreadSafe(AbstractMEHttpServlet.java:344)
at com.sap.ip.me.api.runtime.jsp.AbstractMEHttpServlet.doGet(AbstractMEHttpServlet.java:687)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at com.sap.ip.me.api.runtime.jsp.AbstractMEHttpServlet.service(AbstractMEHttpServlet.java:311)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:405)
at org.apache.tomcat.core.Handler.service(Handler.java:287)
at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
at org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:806)
at org.apache.tomcat.core.ContextManager.service(ContextManager.java:752)
at org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpConnectionHandler.java:213)
at org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416)
at org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:501)
at java.lang.Thread.run(Thread.java:534)
Can anyone help me in this regards .
Thanks in advance.
DevendraHi Devendrakumar,
While creating the MCD, you should have to select both the parent and child syncbos with the installation order of the parent as the highest one.The cascading relationship, and reference syncbo relationship you are mentioning through the SyncBO builder(merep_sbuilder) and the Profile Dialog(merep_pd).
You should select all the syncbos in your MCD , adjust the installation order , export the meRepMeta.xml file and use it for project creation in the Developer Studio.If you have already created a project , then you only have to replace the old meRepMeta.xml file with the new one. And upload this WAR file against your created MCD.
Regards,
Kishor Gopinathan -
Hi,
I'm a newbie to the MI. I'm trying to run the <a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/21eba3a7-0601-0010-b982-92f1fca3258a">Ist Example JSP</a>, but the jsp page as in the tutorial was not displayed. Instead, the URL invoked (i checked "Run the mobile application" during the export) pointed to <b>http://DNSHOST:4444/me</b> (Page was not found error). I had installed the MI client, if i typed http://localhost:4444/me, the login page was prompted.
1. Why it invoked the DNSHOST, but not my localhost?
2. In my MDK configuration, why my MI login username and password cannot be saved (though test setting successful)?
3. What should i do to be able to run and view the 1st Example JSP successfully?
4. I tried another way, uploaded the MDK_ConfigExampleJSP.war to Webconsole and sync it to my local PC. But here is the error when i trie to view it locally,
Error: 500
Location: /MDK_CONFIGEXAMPLEJSP/jsp/tableView.jsp
Internal Servlet Error:
javax.servlet.ServletException
at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:461)
at jsp.tableView._jspService(tableView.java:159)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:119)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:405)
at org.apache.tomcat.core.Handler.service(Handler.java:287)
at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
at org.apache.tomcat.facade.RequestDispatcherImpl.doForward(RequestDispatcherImpl.java:222)
at org.apache.tomcat.facade.RequestDispatcherImpl.forward(RequestDispatcherImpl.java:162)
at com.sap.ip.me.api.runtime.jsp.AbstractMEHttpServlet.dispatchRequest(AbstractMEHttpServlet.java:896)
at com.sap.ip.me.api.runtime.jsp.AbstractMEHttpServlet.doGetNotThreadSafe(AbstractMEHttpServlet.java:347)
at com.sap.ip.me.api.runtime.jsp.AbstractMEHttpServlet.doGet(AbstractMEHttpServlet.java:678)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at com.sap.ip.me.api.runtime.jsp.AbstractMEHttpServlet.service(AbstractMEHttpServlet.java:326)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
Root cause:
java.lang.ClassCastException
at jsp.tableView._jspService(tableView.java:66)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:119)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:405)
at org.apache.tomcat.core.Handler.service(Handler.java:287)
at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
at org.apache.tomcat.facade.RequestDispatcherImpl.doForward(RequestDispatcherImpl.java:222)
at org.apache.tomcat.facade.RequestDispatcherImpl.forward(RequestDispatcherImpl.java:162)
at com.sap.ip.me.api.runtime.jsp.AbstractMEHttpServlet.dispatchRequest(AbstractMEHttpServlet.java:896)
at com.sap.ip.me.api.runtime.jsp.AbstractMEHttpServlet.doGetNotThreadSafe(AbstractMEHttpServlet.java:347)
at com.sap.ip.me.api.runtime.jsp.AbstractMEHttpServlet.doGet(AbstractMEHttpServlet.java:678)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at com.sap.ip.me.api.runtime.jsp.AbstractMEHttpServlet.service(AbstractMEHttpServlet.java:326)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:405)
Any help would be much appreciated.
Thanks.
- juliushi julius,
the MDK checks if your application has already been deployed into your local MI
installation. if it doesn't find it, it will open a browser pointing to the WebConsole
url which depends on the MDK configuration. there's a need to deploy the app to
your MI client before you can run it on top of MI.
>Do i need to directly upload the generated WAR file to the web console and
>synchronized it back to my PC everytime i changed something to the source
>files? Because i think will be a time-consuming process.
You need to upload, assign and deploy it once for your application MCD be delivered
to you MI client registry. I do agree that in the very early phase of client application
development, deployment via the WebConsole is something very inconvenient, esp
if you don't have one. i had posted a workaround on this to enable you to deploy
an app without WebConsole with some limitations however... you can find the
article here:
/people/jogel.santiago/blog/2006/07/27/mi-lad-tool-for-deploying-mi-app-without-using-mi-webconsole
regards
jo -
ClassCastException in method declaration in JSP page??
i keep getting this ClassCastException in my jsp page. The line that
is apparently the problem is the <%! where the method declaration
starts. I can't seem to figure out why this is happening, can someone
please help? Here is the full code:
java.lang.ClassCastException
at quickfix0itm_0submit__jsp.addUpdate(/epsc/quickfix_itm_submit.jsp:25)
at quickfix0itm_0submit__jsp._jspService(/epsc/quickfix_itm_submit.jsp:165)
at com.caucho.jsp.JavaPage.service(JavaPage.java:75)
at com.caucho.jsp.Page.subservice(Page.java:506)
at com.caucho.server.http.FilterChainPage.doFilter(FilterChainPage.java:182)
at com.caucho.server.http.Invocation.service(Invocation.java:315)
at com.caucho.server.http.CacheInvocation.service(CacheInvocation.java:135)
at com.caucho.server.http.RunnerRequest.handleRequest(RunnerRequest.java:344)
at com.caucho.server.http.RunnerRequest.handleConnection(RunnerRequest.java:274)
at com.caucho.server.TcpConnection.run(TcpConnection.java:139)
at java.lang.Thread.run(Thread.java:534)
<%
if ( (session.getAttribute("setID") == null ) || ( !session.getAttribute("setID").equals(session.getId()) ))
out.write("You are either not logged in or your session has timed out due to inactivity.<BR>"
+ "Please <a href=\"index.jsp\">return to the login screen</a> and login again<BR><BR>");
else
%>
<%@ page language=java %>
<%@ page import='java.sql.*' %>
<%@ page import='javax.sql.*' %>
<%@ page import='javax.naming.*' %>
<%@ page import='java.io.*' %>
<%@ page import='java.util.Hashtable' %>
<%@ page import='java.util.Vector' %>
<%@ page import='java.util.Enumeration' %>
<%@ page import='java.util.Calendar' %>
<%@ page import='java.util.GregorianCalendar' %>
<%!
private void addUpdate(String[] tmpP, String[] UIDs, String curName, String colName, String lastIdx, Hashtable uid_updates)
if (curName.equals(colName))
for (int c = 0; c < UIDs.length; c++)
Object[] tmp = (Object[])uid_updates.get(UIDs[c]);
Vector colNames = new Vector();
Vector colValues = new Vector();
if (tmp == null)
tmp = new Object[2];
else
colNames = (Vector)tmp[0];
colValues = (Vector)tmp[1];
String updateVal = tmpP[0];
colNames.add(curName);
colValues.add(updateVal);
tmp[0] = colNames;
tmp[1] = colValues;
uid_updates.remove(UIDs[c]);
uid_updates.put(UIDs[c], tmp);
else
int uidIdx = curName.lastIndexOf(lastIdx);
String uidcode = curName.substring(uidIdx + 1);
Object[] tmp = (Object[])uid_updates.get(uidcode);
Vector colNames = new Vector();
Vector colValues = new Vector();
if (tmp == null)
tmp = new Object[2];
else
colNames = (Vector)tmp[0];
colValues = (Vector)tmp[1];
//String[] tmpP = request.getParameterValues(curName);
String updateVal = tmpP[0];
colNames.add(colName);
colValues.add(updateVal);
tmp[0] = colNames;
tmp[1] = colValues;
uid_updates.remove(uidcode);
uid_updates.put(uidcode, tmp);
%>
<%
String ss = "0";
String force_noon = "0";
String qfix_duration = "2";
int qfixd = 2;
String mod_keys = "";
String[] mktmp = request.getParameterValues("mod_keys");
if (mktmp == null)
out.print("Error! Please go back and try again.");
else
mod_keys = mktmp[0];
Hashtable uid_updates = new Hashtable();
String[] UIDs = new String[1];
if (mod_keys.equals("1"))
UIDs = request.getParameterValues("UID");
for (int storeUIDs = 0; storeUIDs < UIDs.length; storeUIDs++)
Vector tmp = new Vector();
uid_updates.put(UIDs[storeUIDs], tmp);
Enumeration cols = request.getParameterNames();
while (cols.hasMoreElements())
String curName = (String)cols.nextElement();
if (curName.indexOf("BusName") != -1)
addUpdate(request.getParameterValues(curName), UIDs, curName, "BusName", "e", uid_updates);
else if (curName.equals("ss"))
String[] asdfadf = request.getParameterValues(curName);
if (asdfadf != null)
ss = "1";
else
ss = "0";
else if (curName.equals("force_noon"))
String[] asdfadf = request.getParameterValues(curName);
force_noon = asdfadf[0];
else if (curName.equals("qfix_duration"))
String[] asdfadf = request.getParameterValues(curName);
qfix_duration = asdfadf[0];
qfixd = Integer.parseInt(qfix_duration);
else if (curName.indexOf("DisplayLine") != -1)
addUpdate(request.getParameterValues(curName), UIDs, curName, "DisplayLine", "e", uid_updates);
else if (curName.indexOf("CityName") != -1)
addUpdate(request.getParameterValues(curName), UIDs, curName, "CityName", "e", uid_updates);
else if (curName.indexOf("PAC") != -1)
addUpdate(request.getParameterValues(curName), UIDs, curName, "PAC", "C", uid_updates);
else if (curName.indexOf("ProvDisp") != -1)
addUpdate(request.getParameterValues(curName), UIDs, curName, "ProvDisp", "p", uid_updates);
else if (curName.indexOf("TeleNum") != -1)
addUpdate(request.getParameterValues(curName), UIDs, curName, "TeleNum", "m", uid_updates);
else if (curName.indexOf("ProvCode") != -1)
addUpdate(request.getParameterValues(curName), UIDs, curName, "ProvCode", "e", uid_updates);
else if (curName.indexOf("Dircode") != -1)
addUpdate(request.getParameterValues(curName), UIDs, curName, "Dircode", "e", uid_updates);
else if (curName.indexOf("Hdgcode") != -1)
addUpdate(request.getParameterValues(curName), UIDs, curName, "Hdgcode", "e", uid_updates);
else if (curName.indexOf("EMail") != -1)
addUpdate(request.getParameterValues(curName), UIDs, curName, "EMail", "l", uid_updates);
else if (curName.indexOf("URL") != -1)
addUpdate(request.getParameterValues(curName), UIDs, curName, "URL", "L", uid_updates);
else if (curName.indexOf("DispAd") != -1)
addUpdate(request.getParameterValues(curName), UIDs, curName, "DispAd", "d", uid_updates);
else if (curName.indexOf("TOPlus") != -1)
addUpdate(request.getParameterValues(curName), UIDs, curName, "TOPlus", "s", uid_updates);
else if (curName.indexOf("EStore") != -1)
addUpdate(request.getParameterValues(curName), UIDs, curName, "EStore", "e", uid_updates);
else if (curName.indexOf("HSLINE_EN") != -1)
addUpdate(request.getParameterValues(curName), UIDs, curName, "HSLINE_EN", "N", uid_updates);
else if (curName.indexOf("HSLINE_FR") != -1)
addUpdate(request.getParameterValues(curName), UIDs, curName, "HSLINE_FR", "R", uid_updates);
else if (curName.indexOf("MtlPlus") != -1)
addUpdate(request.getParameterValues(curName), UIDs, curName, "MtlPlus", "s", uid_updates);
else if (curName.indexOf("CalPlus") != -1)
addUpdate(request.getParameterValues(curName), UIDs, curName, "CalPlus", "s", uid_updates);
else if (curName.indexOf("EdmPlus") != -1)
addUpdate(request.getParameterValues(curName), UIDs, curName, "EdmPlus", "s", uid_updates);
else if (curName.indexOf("VanPlus") != -1)
addUpdate(request.getParameterValues(curName), UIDs, curName, "VanPlus", "s", uid_updates);
else if (curName.indexOf("DEALER_LOCATOR") != -1)
addUpdate(request.getParameterValues(curName), UIDs, curName, "DEALER_LOCATOR", "R", uid_updates);
long curTime = System.currentTimeMillis();
long monthMS = 2629743832L;
long expLength = monthMS * qfixd;
long expTime = curTime + expLength;
java.sql.Date d1 = new java.sql.Date(System.currentTimeMillis());
String Start_Date = d1.toString();
d1 = new java.sql.Date(expTime);
String Expiry_Date = d1.toString();
Context env1 = (Context) new InitialContext().lookup("java:comp/env");
DataSource source1 = (DataSource) env1.lookup("jdbc/epsc");
Connection conn1 = source1.getConnection();
String Pub_ID = "";
try {
Enumeration uidKeys = uid_updates.keys();
while (uidKeys.hasMoreElements())
String Unique_ID = (String)uidKeys.nextElement();
Object[] updateData = (Object[])uid_updates.get(Unique_ID);
Vector colNames = (Vector)updateData[0];
Vector colValues = (Vector)updateData[1];
String selectRecord = "SELECT * from epsc_ypca WHERE Unique_ID='" + Unique_ID + "';";
Statement getRecord = conn1.createStatement();
ResultSet returned = getRecord.executeQuery(selectRecord);
Pub_ID = returned.getString("Pub_ID");
boolean createDelete = false;
String updateString = "";
for (int b = 0; b < colNames.size(); b++)
if (b != 0)
updateString = updateString + ", ";
String colName = (String)colNames.get(b);
String colVals = (String)colValues.get(b);
if (colName.equals("BusName") || colName.equals("DisplayLine") || colName.equals("ProvDisp") || colName.equals("CityName") || colName.equals("PAC") || colName.equals("TeleNum"))
if (!((returned.getString(colName)).equals(colVals)))
createDelete = true;
updateString = updateString + colName + "='" + colVals + "'";
if (createDelete)
//create delete
String delFromQuickfixes = "DELETE FROM epsc_quickfixes WHERE Start_Date='" + Start_Date + "' AND Pub_ID='" + Pub_ID + "' AND QFix_Type='2';";
Statement delItm = conn1.createStatement();
delItm.execute(delFromQuickfixes);
String insertQfixDel = "INSERT INTO epsc_quickfixes SELECT *, '0' as UID, '" + Start_Date + "' as Start_Date, '" + Expiry_Date + "' as Expiry_Date, '2' as QFix_Type, '0' as ss, '" + force_noon + "' as force_noon FROM epsc_ypca WHERE Pub_ID='" + Pub_ID + "' AND (Record_Ind='2' OR Record_Ind='4' OR Record_Ind='6');";
Statement insertQFDEL = conn1.createStatement();
insertQFDEL.execute(insertQfixDel);
String updateRecords = "UPDATE epsc_ypca SET " + updateString + " WHERE Unique_ID='" + Unique_ID + "';";
String selectAndInsert = "INSERT INTO epsc_quickfixes SELECT *, '0' as UID, '" + Start_Date + "' as Start_Date, '" + Expiry_Date + "' as Expiry_Date, '3' as QFix_Type, '" + ss + "' as ss, '" + force_noon + "' as force_noon FROM epsc_ypca WHERE Pub_ID='" + Pub_ID + "';";
Statement insertIntoQfix = conn1.createStatement();
insertIntoQfix.execute(selectAndInsert);
out.write("Quickfix Successfully submitted.<BR><BR>\r\n");
catch (SQLException e)
out.write("<h1>SQL ERROR: " + e.getMessage() + "<BR><BR>Please report to administrator</h1>");
finally{
conn1.close();
%>
<BR><BR>[ <a href="menu.jsp">Return To Main</a> ]
</center>
</BODY>
</HTML>
<%
%>it is the exact same as the one i originally posted:
500 Servlet Exception
java.lang.ClassCastException
at quickfix0itm_0submit__jsp.addUpdate(/epsc/quickfix_itm_submit.jsp:24)
at quickfix0itm_0submit__jsp._jspService(/epsc/quickfix_itm_submit.jsp:169)
at com.caucho.jsp.JavaPage.service(JavaPage.java:75)
at com.caucho.jsp.Page.subservice(Page.java:506)
at com.caucho.server.http.FilterChainPage.doFilter(FilterChainPage.java:182)
at com.caucho.server.http.Invocation.service(Invocation.java:315)
at com.caucho.server.http.CacheInvocation.service(CacheInvocation.java:135)
at com.caucho.server.http.RunnerRequest.handleRequest(RunnerRequest.java:344)
at com.caucho.server.http.RunnerRequest.handleConnection(RunnerRequest.java:274)
at com.caucho.server.TcpConnection.run(TcpConnection.java:139)
at java.lang.Thread.run(Thread.java:534) -
Servlet passing values to JSP and ClasscastException
I am using weblogic 5.1 to run my Servlets.
I want to know when I forward from a servlet to a JSP how do I pass
values especially Java Objects (Sometimes Objects of User written Java
classes).
Uptil now I have been putting all values in the session from where the
JSP picks them up, but somehow I have a feeling that this is not the
right way.
In a code I am putting a Java Object (It contains two attributes of
Java.util.Vector type) in the session so that the JSP to which I am
forwarding it to can use it I have put my class in the ServletClasses.
Intertestingly it runs well till the contents of the Vector are changed.
As the contents of the vector are changed, it throws ClassCastException
The StackTrace is as follows:
java.lang.ClassCastException
at
jsp_servlet._select_95_account_95_profile._jspService(_select_95_account_95_pro
file.java, Compiled Code)
at weblogic.servlet.jsp.JspBase.service(JspBase.java, Compiled
Code)
at
weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java,
C
ompiled Code)
at
weblogic.servlet.internal.RequestDispatcherImpl.forward(RequestDispatcherImpl.j
ava:143)
at
com.logistics.optistopasp.servlet.AccountSelectServlet.doPost(AccountSelectServ
let.java, Compiled Code)
at
com.logistics.optistopasp.servlet.AccountSelectServlet.doGet(AccountSelectServl
et.java:35)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:865)
at
weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java,
C
ompiled Code)
at
weblogic.servlet.internal.ServletContextImpl.invokeServlet(ServletContextImpl.j
ava, Compiled Code)
at
weblogic.servlet.internal.ServletContextImpl.invokeServlet(ServletContextImpl.j
ava, Compiled Code)
at
weblogic.servlet.internal.ServletContextManager.invokeServlet(ServletContextMan
ager.java, Compiled Code)
at
weblogic.socket.MuxableSocketHTTP.invokeServlet(MuxableSocketHTTP.java,
Compile
d Code)
at
weblogic.socket.MuxableSocketHTTP.execute(MuxableSocketHTTP.java,
Compiled Code
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java,
Compiled Code)
Can anybody please Help!!!!.
Thanks
Pankaj
Only can confirm your finding - the jsp is using a different class loader to the servlet that originally instantiated the object. There's the rub. I haven't figured out yet how to fix that. I can get the classloader but don't know how to get the runtime to use that class loader to perform cast.
-
Servlet -- HttpSession -- JSP , Why ClassCastException
When I put an object in the HttpSession in a servlet and try to get it
(and casting) , in a JSP within the same session, i get ClassCastException,
any body knows the problem?
thanks,
ali.What WL version you runing? Is this object in your CLASSPATH?
Gene
"ali" <[email protected]> wrote in message news:3a8c5e32$[email protected]..
When I put an object in the HttpSession in a servlet and try to get it
(and casting) , in a JSP within the same session, i get ClassCastException,
any body knows the problem?
thanks,
ali. -
ClassCastException When we use JSP with Normal Bean in WebLogic 5.1
Hai Everybody...
We have an application where JSP files are using the Normal Java beans(Nothing
but a Java Class).Here all jave beans are in a folder ..\myserver\classfiles\
and the jsp files are in ..\myserver\public_html\..... .
This combination is throwing a ClassCastException when the JSP try to Intantiate
the bean....It doesn't give error alway..Initially it works fine and all of a
sudden it throws this error..
Plse..If anybody can help us Do So....
sijo
That is correct; WLS 5.1 does not support the updating of these helper classes.
In WLS 6.0, you can package everything up as a web application or enterprise
application and redeploy the whole thing (including the helper classes)...
Alex wrote:
> But, Robert, that means the JavaBean classes cannot be updated without
> restarting the server.
>
> I tried putting them in the servlet directory. With the result that they
> often work, but sometimes I get the same ClassCastException as sijo. Where
> should JavaBean classes that are used from JSP (and maybe other servlets) be
> put in order to be able to update them?
>
> "Robert Patrick" <[email protected]> escribió en el mensaje
> news:[email protected]...
> > The Java Beans being used by the JSP pages need to be placed into the
> > WEBLOGICCLASSPATH (i.e., -Dweblogic.class.path=...) and not in the working
> directory
> > where the JSP-generated classes are created (i.e., \myserver\classfiles is
> typically
> > the working directory for the JSPServlet and \myserver\serverclasses is
> the
> > appropriate place for the Java Beans used by the JSPs)...
> >
> > sijo wrote:
> >
> > > Hai Everybody...
> > >
> > > We have an application where JSP files are using the Normal Java
> beans(Nothing
> > > but a Java Class).Here all jave beans are in a folder
> ..\myserver\classfiles\
> > > and the jsp files are in ..\myserver\public_html\..... .
> > >
> > > This combination is throwing a ClassCastException when the JSP try to
> Intantiate
> > > the bean....It doesn't give error alway..Initially it works fine and all
> of a
> > > sudden it throws this error..
> > >
> > > Plse..If anybody can help us Do So....
> > >
> > > sijo
> > >
> > >
> >
Maybe you are looking for
-
MS ACCESS, ColdFusion and Image Problems
I have done this before using PHP and Mysql and it was pretty simple. I now need to do this in ColdFusion and MS Access 2003. I want to store logos in a database. After reading up on it, I found that you store images in Access using the OLE Object Da
-
Migration report to move BP and OneOrder texts to def. lang (Note 1155979)
Hello CRM Colleagues, with the procedure described in SAP Note 1155979 "Other users cannot display an entry in the text field" in SAP CRM 6.0 and higher you can define a default language in table COMC_TEXT_COMLNG that will be used for language-indepe
-
I recently installed the FF4Beta6 along side my original 3.6.10 and noticed that both versions have this preference with a user set string value of Mozilla.Firefox.4.0b6. In the taskbar I have shortcuts to both versions pinned in Windows 7. The toolt
-
I have a 10.2 itune and need tp update for newses to be abble to syn with my phone. I have try download many time for new version. after doing it for many hour. My itune still not update. I'm useding the window 7. Still could not find out what is the
-
When I click on a game, the game window opens and is solid, but when it's fully loaded, it becomes semi transparent and washed out. I can post a screen shot of what I'm talking about if this forum supports it.