JSP ERROR - java.lang.ClassCastException

Discussions

EJB programming & troubleshooting: JSP ERROR - java.lang.ClassCastException

  1. JSP ERROR - java.lang.ClassCastException (5 messages)

    I need help please!!

    After i run my jsp (is the EJB client) i get a error

    12:13:30,671 ERROR [[jsp]] Servlet.service() for servlet jsp threw exception
    java.lang.ClassCastException
    at com.sun.corba.se.impl.javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:229)
    at javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:137)
    at org.apache.jsp.zootest_jsp._jspService(org.apache.jsp.zootest_jsp:65)
    at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322)
    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
    at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:81)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
    at org.jboss.web.tomcat.security.CustomPrincipalValve.invoke(CustomPrincipalValve.java:39)
    at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:153)
    at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:59)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:744)
    at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
    at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
    at java.lang.Thread.run(Thread.java:595)
    Caused by: java.lang.ClassCastException: $Proxy108
    at com.sun.corba.se.impl.javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:212)
    ... 27 more


    What is the problem???

    MY JSP:

    <%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <%@ page import="java.util.*, javax.naming.*, javax.rmi.PortableRemoteObject,com.zoo.Tiger,
                     com.zoo.TigerHome, com.zoo.TigerUtil"%>
    <html>
    <head>
    <title>Zoo</title>
    </head>
    <body>
    <%
    Context ctx = new InitialContext(null);

    Object obj = ctx.lookup("Tiger");

    TigerHome home = (TigerHome) javax.rmi.PortableRemoteObject.narrow(obj, TigerHome.class);

    Tiger tiger = home.create();

    System.out.println(tiger.Rrrr());

    tiger.remove();
    %>
    </body>
    </html>


    Thankxx
    Claudia
  2. If you have placed the EJB classes in your .war as well as some .jar file, then remove the classes from the .war file and try out
  3. i need help. i'm getting the same problem while using the jboss. you got the solution? plz let me know as i stuck with the same situation.
  4. i'm getting the same problem and finding nowhere to go. plz let me know also if you got the solution. thanx Amit
  5. Hi All, I have one class cast issue,can any body please help me. The issue is like: I am trying to invoke the scheduler.jar (Scheduler ejb bean)of oc4j from my client Servlet. I have written the code as bellow:in my JobClientServlet.java (cleint code) protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { Scheduler m_scheduler = null; IntervalSchedule schedule = null; try { System.out.println("Inside DoPost()"); InitialContext ic = new InitialContext(); java.lang.Object objRef = ic.lookup("java:comp/env/ejb/scheduler"); System.out.println("Inside DoPost() after lok up-->"+objRef.toString()); SchedulerHome home = (SchedulerHome) PortableRemoteObject.narrow(objRef, SchedulerHome.class); m_scheduler = home.create(); //SchedulerHome home = (SchedulerHome)ic.lookup("java:comp/env/ejb/scheduler"); m_scheduler = home.create(); System.out.println("Got the handle of scheduler"); schedule = new IntervalSchedule(); schedule.setInterval(1000); Properties props = new Properties(); m_scheduler.add("NEW JOB FOR TEST",new PingJob().getClass().getName(),schedule,props); } catch (Exception e) { e.printStackTrace(); } } When i execute the same through my 10.1.3 oc4j server,it says : WARNING: Code-source D:\OC4jDump\oc4j_extended_101330\j2ee\home\applications\FCJEAR\FCJNeoWeb\WEB-INF\lib\classes12.jar (from WEB-INF/lib/ directory in D:\OC4jDump\oc4j_extended_101330\j2ee\home\applications\FCJEAR\FCJNeoWeb\WEB-INF\lib) has the same filename but is not identical to /D:/OC4jDump/oc4j_extended_101330/jdbc/lib/ojdbc14dms.jar (from (ignore manifest Class-Path) in META-INF/boot.xml in D:\OC4jDump\oc4j_extended_101330\j2ee\home\oc4j.jar). If it contains different versions of the same classes, it will be masked as the latter is already visible in the search path of loader FCJEAR.web.FCJNeoWeb:0.0.0. 2008-02-05 19:24:59.760 NOTIFICATION Binding web application(s) to site default-web-site ends... 2008-02-05 19:24:59.760 NOTIFICATION Application Deployer for FCJEAR COMPLETES. Operation time: 23453 msecs 08/02/05 19:25:37 Inside DoPost() 08/02/05 19:25:37 Inside DoPost() after lok up-->oracle.ias.scheduler.Scheduler 08/02/05 19:25:37 java.lang.ClassCastException 08/02/05 19:25:37 at com.sun.corba.se.impl.javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:229) 08/02/05 19:25:37 at javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:137) 08/02/05 19:25:37 at com.iflex.fcc.web.timer.JobClientServlet.doPost(JobClientServlet.java:49) 08/02/05 19:25:37 at com.iflex.fcc.web.timer.JobClientServlet.doGet(JobClientServlet.java:34) 08/02/05 19:25:37 at javax.servlet.http.HttpServlet.service(HttpServlet.java:743) 08/02/05 19:25:37 at javax.servlet.http.HttpServlet.service(HttpServlet.java:856) 08/02/05 19:25:37 at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:713) 08/02/05 19:25:37 at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:370) 08/02/05 19:25:37 at com.evermind.server.http.HttpRequestHandler.doProcessRequest(HttpRequestHandler.java:871) 08/02/05 19:25:37 at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:453) 08/02/05 19:25:37 at com.evermind.server.http.HttpRequestHandler.serveOneRequest(HttpRequestHandler.java:221) 08/02/05 19:25:37 at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:122) 08/02/05 19:25:37 at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:111) 08/02/05 19:25:37 at oracle.oc4j.network.ServerSocketReadHandler$SafeRunnable.run(ServerSocketReadHandler.java:260) 08/02/05 19:25:37 at oracle.oc4j.network.ServerSocketAcceptHandler.procClientSocket(ServerSocketAcceptHandler.java:239) 08/02/05 19:25:37 at oracle.oc4j.network.ServerSocketAcceptHandler.access$700(ServerSocketAcceptHandler.java:34) 08/02/05 19:25:37 at oracle.oc4j.network.ServerSocketAcceptHandler$AcceptHandlerHorse.run(ServerSocketAcceptHandler.java:880) 08/02/05 19:25:37 at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:303) 08/02/05 19:25:37 at java.lang.Thread.run(Thread.java:595) 08/02/05 19:25:37 Caused by: java.lang.ClassCastException: java.lang.String 08/02/05 19:25:37 at com.sun.corba.se.impl.javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:212) Can any one please look into the issue?? Thanks in advance: Anam Bangalore
  6. Scheduler ...[ Go to top ]

    Saidul Anam, you seem to have two different JDBC driver classes in your classpath or project path. classes12.jar and ojdbc14dms.jar remove one of those jars from classpath/project path, then try again. Regards Martin