Class cast exception in jsp plz help

i have written a jsp where i displayed a text box with value given by user inside it
when the user enters some other value in text box and clicks on update button then i forwarded reqeust to servlet which will some data base work
servlet will forward again to the same jsp with the new value in text box.
but i am getting CLASS CAST EXCEPTION when servlet is forwarding reqeust to same JSP
help me what to do ........
thanking you in advance ..cheers

display cart.jsp file:
<%@ page import="java.util.*,org.*" %>
<html>
<body>
<%
Vector cartupdate = (Vector)session.getAttribute("cartlist");
for (int i = 0; i < cartupdate.size(); i++) {
CartListBean clb = (CartListBean)cartupdate.elementAt(i);
%>
<form name="itemslist<%=i%>" action="updateCart" method="post">
<input type="hidden" name="itemcode" value="<%=clb.getItemCode()%>">
     <input type="hidden" name="itemname" value="<%= clb.getItemName()%>">
<input type="hidden" name="price" value="<%= clb.getPrice()%>">
<%= clb.getItemName() %>
<input type="text" name="qty" value="<%=clb.getQuantity()%>">
<input type="submit" name="<%=clb.getItemCode()%>" value="update">
</form>
<br>
<%
%>
<form name="tobuy" action="buysrv" method="post">
<input type="submit" name="buy" value="BUY">
</form>
</body>
</html>
updatecart servlet code:
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
import org.*;
import java.sql.*;
import java.util.*;
public class UpdateCart extends HttpServlet
public void service(HttpServletRequest request,HttpServletResponse response) throws IOException,ServletException
HttpSession session=request.getSession(false);
Vector cartupdate = (Vector)session.getAttribute("cartlist");
for (int i = 0; i < cartupdate.size(); i++) {
org.CartListBean cart = (org.CartListBean)cartupdate.elementAt(i);
if((cart.getItemCode()).equals(request.getParameter("itemcode")))
org.CartListBean clb=new org.CartListBean();
clb.setItemCode(request.getParameter("itemcode"));
     clb.setQuantity(request.getParameter("qty"));
     clb.setItemName(request.getParameter("itemname"));
clb.setPrice(request.getParameter("price"));
cartupdate.setElementAt(clb,i);
session.setAttribute("cartlist",cart);
ServletContext application=getServletContext();
System.out.println("got finished");
          RequestDispatcher rd=application.getRequestDispatcher("/displaycart.jsp");
               rd.forward(request,response);
Message was edited by:
143java

Similar Messages

  • Class Cast Exception in JSP of the component

    Hi,
      I am trying to call a web service from the JSP of the component.I have written the java code as a scriplets in the JSP. The problem i am facing is Class Cast Exception. The code is as follows
    String strKey = "wsclients/proxies/sap.com/CCMSContentBroker/com.sap.ccmscontentbroker.CCMSContentProxy";
    java.lang.Object obj ;
    obj = context.lookup(strKey);
    str1 = obj.getClass().getName();
    ContentBroker objCB= null; 
    objCB = (ContentBroker)obj; // getting error here
    ContentBroker is an web service interface. The same code is working if i write it in the component but not in the scriplet of the JSP.
    Can't we do the type cast in the JSP ?
    Cant we call the web services in the JSP?
    How to eliminate this Class cast Exception in my code?
    Thanks and Regards,
    Saravanan

    Hi Harini,
             Thanks for your reply. I have checked all the import statements in the JSP.The problem is in the Type casting of object <b>obj</b> to ContentBroker variable <b>objCB</b>.
    Are u saying typr casting is not possible in JSP or organising imports in the JSP.
    These are my imports statements in the JSP
    <%@ page import = "java.util.ResourceBundle" %>
    <%@ page import = "com.sapportals.htmlb.*" %>
    <%@ page import = "com.intel.ccmt.ccmscontentbroker.* "%>
    <%@ page import = "com.intel.ccmt.ccmscontentbroker.types.* "%>
    <%@ page import = "com.sapportals.portal.prt.contentconversion.XSLConverter" %>
    <%@ page import = "com.sapportals.portal.prt.component.IPortalComponentRequest" %>
    <%@ page import="java.io.File" %>
    <%@ page import="javax.naming.Context" %>
    <%@ page import="javax.naming.InitialContext" %>
    <%@ page import="javax.naming.NamingException" %>
    <%@ page import="java.util.StringTokenizer"%>
    Can u help me on rectifying this class cast Exception ?
    Thanks and Regards,
    Saravanan

  • Class Cast exception in JSP

    Hi All,
    Softwares used : UI--> JSP/Flex Grid/Dojo framwork
    Spring MVC
    Back end : EJB 3.0
    application Server : Jboss 4.2.2
    i have one Ajax call witch will update my flex grid after getting the data from Backend.
    i am able to get responce object but i am getting the class cast exception in the jsp.
    This ajax call used for upload the file.i have filter witch contains the wrap the request like
    (HttpServletRequest) Proxy.newProxyInstance(
                        (javax.servlet.http.HttpServletRequest.class).getClassLoader(),
                        getInterfacesForObject(request), new HttpServletRequestProxy(
                                  request, entries));
    exception given below
    19:54:04,372 ERROR [[ifx]] Servlet.service() for servlet ifx threw exception
    java.lang.ClassCastException: $Proxy333
         at org.apache.catalina.core.ApplicationDispatcher.unwrapRequest(ApplicationDispatcher.java:776)
         at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:382)
         at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:292)
         at org.springframework.web.servlet.view.InternalResourceView.renderMergedOutputModel(InternalResourceView.java:240)
         at org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:258)
         at org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1174)
         at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:901)
         at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:809)
         at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:571)
         at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:511)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
    Can you help me out for resolve this issue.
    Regards,
    Ritesh Kumar K.

    riteshkumar wrote:
    but we are using copying and pasting the application related lib's in the jboss\lib folder along with default jboss lib'sI am not sure if I understand you.
    any way i tried but it's not resolving my problem.No other causes comes to mind. Sorry, can't help you further. Good luck with solving.

  • Class Cast Exception in Portable Remote Object

    Hai guys,
    I am new to jsp.I have made a simple j2ee application in which i am getting class cast exception in PortableRemoteObject.narrow function.
    The exception is:
    org.apache.jasper.JasperException
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:384)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:297)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:247)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:860)
    sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    java.lang.reflect.Method.invoke(Method.java:585)
    org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:249)
    java.security.AccessController.doPrivileged(Native Method)
    javax.security.auth.Subject.doAsPrivileged(Subject.java:517)
    org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:282)
    org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:165)
    The root cause is :
    java.lang.ClassCastException
         com.sun.corba.ee.impl.javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:229)
    javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:137)
    org.apache.jsp.registration_jsp._jspService(registration_jsp.java:59)
    org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:105)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:860)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:336)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:297)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:247)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:860)
    sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    java.lang.reflect.Method.invoke(Method.java:585)
    org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:249)
    java.security.AccessController.doPrivileged(Native Method)
    javax.security.auth.Subject.doAsPrivileged(Subject.java:517)
    org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:282)
    org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:165)
    The code of the file is :
    <%@ page language="java" import="java.sql.*,pkg.*,javax.ejb.*,javax.naming.*,javax.rmi.PortableRemoteObject,java.rmi.RemoteException" %>
    <html>
    <head>
    <title></title>
    </head>
    <body bgcolor="CCCCFF">
    <h1><center>Welcome to MyBank</center></h1>
    <%
    InitialContext initial = new InitialContext();
    Object objref = initial.lookup("bankDSN");
    pkg.mybankHome vi = (pkg.mybankHome)PortableRemoteObject.narrow(objref,pkg.mybankHome.class);
    %>
    </body>
    </html>
    I have many threads but i was not able to solve this problem.
    It has been 2 to 3 weeks that i am struck in this error.
    Plz help me with this.
    Thanks in advance.
    Edited by: vishal29 on Jul 13, 2008 10:04 PM

    Hai DigitalDreamer,
    Thanks for giving your valuable time to my question.
    I have tried the code you gave me.
    The answer for :
    out.println(objref.getClass().getName());
    that i got is :
    javax.naming.Reference
    And the answer for :
    out.println(objref.getClass().getInterfaces());
    that i got is :
    [Ljava.lang.Class;@213b6e
    Could you please tell me how this can help.
    Actually i am new to jsp.
    Thanks in advance                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Class Cast exception when clicking Search Button in Query component

    Hi
    We have to implement the Query component in ADF programmatically.. We are using Toplink as the Model layer for ADF.
    We followed the Web User Interface Guide for ADF development, Chapter 12 (Using Query Components) for the same.
    We already have implemented the following classes:
    1) QueryModel
    2) QueryDescriptor
    3) AttributeDescriptor
    4) ConjuctionCriterion
    5) AttributeCriterion etc.
    We are able to see the Search panel in UI with selected fields in Basic as well as Advanced mode.
    When we click on Search button, we are getting Class Cast exception.
    The stacktrace of the exception is below:
    <LifecycleImpl> <_handleException> ADF_FACES-60098:Faces lifecycle receives unhandled exceptions in phase INVOKE_APPLICATION 5
    javax.el.ELException: java.lang.ClassCastException: view.QueryDescriptorImpl cannot be cast to oracle.adfinternal.view.faces.model.binding.FacesCtrlSearchBinding$QueryDescriptorImpl
         at com.sun.el.parser.AstValue.invoke(Unknown Source)
         at com.sun.el.MethodExpressionImpl.invoke(Unknown Source)
         at org.apache.myfaces.trinidad.component.UIXComponentBase.broadcastToMethodExpression(UIXComponentBase.java:1300)
         at oracle.adf.view.rich.component.UIXQuery.broadcast(UIXQuery.java:116)
         at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl.broadcastEvents(LifecycleImpl.java:902)
         at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._executePhase(LifecycleImpl.java:313)
         at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:186)
         at javax.faces.webapp.FacesServlet.service(FacesServlet.java:265)
         at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
         at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
         at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:300)
         at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
         at oracle.adf.model.servlet.ADFBindingFilter.doFilter(ADFBindingFilter.java:205)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
         at oracle.adfinternal.view.faces.webapp.rich.RegistrationFilter.doFilter(RegistrationFilter.java:106)
         at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:446)
         at oracle.adfinternal.view.faces.activedata.AdsFilter.doFilter(AdsFilter.java:60)
         at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:446)
         at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._doFilterImpl(TrinidadFilterImpl.java:271)
         at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl.doFilter(TrinidadFilterImpl.java:177)
         at org.apache.myfaces.trinidad.webapp.TrinidadFilter.doFilter(TrinidadFilter.java:92)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
         at oracle.security.jps.ee.http.JpsAbsFilter$1.run(JpsAbsFilter.java:111)
         at java.security.AccessController.doPrivileged(Native Method)
         at oracle.security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:313)
         at oracle.security.jps.ee.util.JpsPlatformUtil.runJaasMode(JpsPlatformUtil.java:413)
         at oracle.security.jps.ee.http.JpsAbsFilter.runJaasMode(JpsAbsFilter.java:94)
         at oracle.security.jps.ee.http.JpsAbsFilter.doFilter(JpsAbsFilter.java:161)
         at oracle.security.jps.ee.http.JpsFilter.doFilter(JpsFilter.java:71)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
         at oracle.dms.servlet.DMSServletFilter.doFilter(DMSServletFilter.java:136)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
         at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:27)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
         at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3715)
         at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3681)
         at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
         at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
         at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2277)
         at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2183)
         at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1454)
         at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
         at weblogic.work.ExecuteThread.run(ExecuteThread.java:178)
    Caused by: java.lang.ClassCastException: view.QueryDescriptorImpl cannot be cast to oracle.adfinternal.view.faces.model.binding.FacesCtrlSearchBinding$QueryDescriptorImpl
         at oracle.adfinternal.view.faces.model.binding.FacesCtrlSearchBinding.processQuery(FacesCtrlSearchBinding.java:374)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:597)
         ... 44 more
    <RegistrationConfigurator> <handleError> ADF_FACES-60096:Server Exception during PPR, #1
    javax.el.ELException: java.lang.ClassCastException: view.QueryDescriptorImpl cannot be cast to oracle.adfinternal.view.faces.model.binding.FacesCtrlSearchBinding$QueryDescriptorImpl
         at com.sun.el.parser.AstValue.invoke(Unknown Source)
         at com.sun.el.MethodExpressionImpl.invoke(Unknown Source)
         at org.apache.myfaces.trinidad.component.UIXComponentBase.broadcastToMethodExpression(UIXComponentBase.java:1300)
         at oracle.adf.view.rich.component.UIXQuery.broadcast(UIXQuery.java:116)
         at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl.broadcastEvents(LifecycleImpl.java:902)
         at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._executePhase(LifecycleImpl.java:313)
         at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:186)
         at javax.faces.webapp.FacesServlet.service(FacesServlet.java:265)
         at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
         at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
         at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:300)
         at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
         at oracle.adf.model.servlet.ADFBindingFilter.doFilter(ADFBindingFilter.java:205)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
         at oracle.adfinternal.view.faces.webapp.rich.RegistrationFilter.doFilter(RegistrationFilter.java:106)
         at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:446)
         at oracle.adfinternal.view.faces.activedata.AdsFilter.doFilter(AdsFilter.java:60)
         at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:446)
         at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._doFilterImpl(TrinidadFilterImpl.java:271)
         at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl.doFilter(TrinidadFilterImpl.java:177)
         at org.apache.myfaces.trinidad.webapp.TrinidadFilter.doFilter(TrinidadFilter.java:92)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
         at oracle.security.jps.ee.http.JpsAbsFilter$1.run(JpsAbsFilter.java:111)
         at java.security.AccessController.doPrivileged(Native Method)
         at oracle.security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:313)
         at oracle.security.jps.ee.util.JpsPlatformUtil.runJaasMode(JpsPlatformUtil.java:413)
         at oracle.security.jps.ee.http.JpsAbsFilter.runJaasMode(JpsAbsFilter.java:94)
         at oracle.security.jps.ee.http.JpsAbsFilter.doFilter(JpsAbsFilter.java:161)
         at oracle.security.jps.ee.http.JpsFilter.doFilter(JpsFilter.java:71)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
         at oracle.dms.servlet.DMSServletFilter.doFilter(DMSServletFilter.java:136)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
         at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:27)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
         at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3715)
         at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3681)
         at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
         at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
         at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2277)
         at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2183)
         at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1454)
         at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
         at weblogic.work.ExecuteThread.run(ExecuteThread.java:178)
    Caused by: java.lang.ClassCastException: view.QueryDescriptorImpl cannot be cast to oracle.adfinternal.view.faces.model.binding.FacesCtrlSearchBinding$QueryDescriptorImpl
         at oracle.adfinternal.view.faces.model.binding.FacesCtrlSearchBinding.processQuery(FacesCtrlSearchBinding.java:374)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:597)
         ... 44 more
    Any help will be highly appreciated.
    Thanks in advance.
    Anup

    Gary Tam wrote:
    I am working on a project that utilize Oracle Ultra Search that will crawl and tag documents in the database.
    The initial code that uses pure JDBC was working fine, but when we switch to get database connection from dataSource, we are getting classCast exception inside Oracle's ultra search. The problems is that the class we get from dataSource.getConnection() returns
    "weblogic.jdbc.wrapper.JTSConnection_oracle_jdbc_driver_T4CConnection". But Oracle UltraSearch is not expecting that.
    Is there anyway to unwrap the connection that we get from dataSource ? I tried casting to OracleConnection,
    assign the connection to "oracle.jdbc.driver.T4CConnection" without any success.
    Any help would be appricated.
    ThanksHi Gary. If the code you want to run is running inside WebLogic, such as in a JSP,
    then look for our documentation on our JDBC extension 'getVendorConnection()". It
    will get you a direct Oracle connection for their mis-declared UltraSearch
    classes (they declare they take java.sql.Connection, but they really demand a
    concrete thin driver connection. No other Oracle driver will be given a chance).
    Joe

  • Getting class cast exception in Web application.

    I have a web application deployed using standard specs for deployment. I
              have and web-inf directory with a web.xml file set up. All the servlet
              classes are in the classes sub-directory of web-inf.
              If I deploy this application using the Tomcat application server,
              everything works as expected. When I deploy this application using the
              Weblogic software, I can get to the initial page, put once I select a
              link that calls the main servlet, I get a classcast exception. Both the
              Tomcat and Weblogic software point to the same directory for the
              application.
              I double checked and made sure that no other instances of my servlet
              classes exist anywhere else in the class path.
              Any one have any thoughts or suggestions. I am perplexed that this web
              app runs fine under the Tomcat software and yet...
              Thanks.
              Paul Garduno
              

    Thanks for your reply. I am not using any EJBs. From what I have
              gathered since writing my message, this may be the "dreaded" class cast
              exception (although I don't know why since it runs under Tomcat).
              Basically, the initial page is displayed. When you select the SEARCH
              button (for example), the request goes to a servlet which puts a vector
              of custom classes into a session parameter. The request is then
              forwarded to the JSP page which uses the information in the classes to
              help build some information on the page. The first line in the JSP is
              processed (a simple output line to the system console) and then the
              classcast exception occurs.
              According to the info that I have seen, this shouldn't happen since I am
              not changing either the servlet or JSP files which would mean that
              nothing should be re-compiled.
              I have a call into tech support. I will post their answer and copy you
              on the message.
              Thanks.
              Paul
              Cameron Purdy wrote:
              >
              > Are you using EJBs hosted on the same instance of WebLogic? If so, delete
              > the home/remote interfaces from your web deployment. Otherwise, post the
              > exception listing ....
              >
              > Cameron Purdy, LiveWater
              >
              > "Paul Garduno" <[email protected]> wrote in message
              > news:[email protected]...
              > > I have a web application deployed using standard specs for deployment. I
              > > have and web-inf directory with a web.xml file set up. All the servlet
              > > classes are in the classes sub-directory of web-inf.
              > >
              > > If I deploy this application using the Tomcat application server,
              > > everything works as expected. When I deploy this application using the
              > > Weblogic software, I can get to the initial page, put once I select a
              > > link that calls the main servlet, I get a classcast exception. Both the
              > > Tomcat and Weblogic software point to the same directory for the
              > > application.
              > >
              > > I double checked and made sure that no other instances of my servlet
              > > classes exist anywhere else in the class path.
              > >
              > > Any one have any thoughts or suggestions. I am perplexed that this web
              > > app runs fine under the Tomcat software and yet...
              > >
              > > Thanks.
              > >
              > > Paul Garduno
              

  • Class Cast Exception in Stateless session bean

    Hi,
    i am getting a class cast exception in this particular line....
    in my EJBClient program i get this error..
    //Getting a reference to the bean's home interface in client program
    SimpleSessionHome home=(SimpleSessionHome)PortableRemoteObject.narrow(ref, SimpleSessionHome.class);Wher SimpleSessionHome is my Home interface.
    I am not able to correct the error. Plz help me.
    Thanks,
    Akshatha

    Hi,
    Make sure you are looking up the correct JNDI name. And, what king of Classloading is being used.
    This could be an issue if there are different classloader in action.
    According to the JBoss 4 Admin Guide.
    Most developers know that the type of a class in Java is a function of the fully qualified name of the class. However the type is also a function of the java.lang.ClassLoader that is used to define that class.
    Feel free to forward your queries / comment.
    Pawan.

  • 'Class Cast Exception' while invoking a EJB from a Servlet

              Hi,
              I am working on J2EE applications.I am using Webgain studio and weblogic server.I
              got a problem while invoking EJB from the servlet.
              While calling an EJB from the servlet, it is giving that "Class Cast Exception".This
              is because, the remote home reference is not able to type casted to the"Home Interface"
              of the EJB, even if I type casted explicitly. It is creating the context and able
              to identify the EJB with the JNDI name.
              Could please help me in solving this problem.I am pasting the code here.
              Thanks in advance,
              Dharma
              public void doGet(HttpServletRequest req, HttpServletResponse resp)
                   throws ServletException, IOException
                        resp.setContentType("text/html");
                        PrintWriter out = new PrintWriter(resp.getOutputStream());
              try
              Context context=getInitialContext();
              Object reference=context.lookup("ArlProjContractorAppletSession");
              ArlProjContractorAppletSessionHome home=(ArlProjContractorAppletSessionHome)PortableRemoteObject.narrow(reference,ArlProjContractorAppletSessionHome.class);
              //Exception is occuring in the above statement. It is unable
              //to cast to the home interface          
                        ArlProjContractorAppletSession the_ejb=null;
              try
              the_ejb=home.create();
              System.out.println("the_ejb = " + the_ejb.toString());
              catch(Exception e)
              e.printStackTrace();
              catch(Exception e)
              e.printStackTrace();
                        // to do: code goes here.
                        out.println("<HTML>");
                        out.println("<HEAD><TITLE>Contractor TimeTracker</TITLE></HEAD>");
                        out.println("<BODY>");
                        // to do: your HTML goes here.
                        out.println("</BODY>");
                        out.println("</HTML>");
                        out.close();
              

              I came across this kind of problem once. My problem went away after I upgraded
              from 5.1 SP6 to 5.1 SP8.
              "Dharma" <[email protected]> wrote:
              >
              >Hi,
              >
              >I am working on J2EE applications.I am using Webgain studio and weblogic
              >server.I
              >got a problem while invoking EJB from the servlet.
              >
              >While calling an EJB from the servlet, it is giving that "Class Cast
              >Exception".This
              >is because, the remote home reference is not able to type casted to the"Home
              >Interface"
              >of the EJB, even if I type casted explicitly. It is creating the context
              >and able
              >to identify the EJB with the JNDI name.
              >
              >Could please help me in solving this problem.I am pasting the code here.
              >
              >Thanks in advance,
              >Dharma
              >
              >
              >public void doGet(HttpServletRequest req, HttpServletResponse resp)
              >     throws ServletException, IOException
              >     {
              >          resp.setContentType("text/html");
              >          PrintWriter out = new PrintWriter(resp.getOutputStream());
              >
              > try
              > {
              >
              > Context context=getInitialContext();
              >
              > Object reference=context.lookup("ArlProjContractorAppletSession");
              >
              > ArlProjContractorAppletSessionHome home=(ArlProjContractorAppletSessionHome)PortableRemoteObject.narrow(reference,ArlProjContractorAppletSessionHome.class);
              >
              >//Exception is occuring in the above statement. It is unable
              >//to cast to the home interface          
              >
              >          ArlProjContractorAppletSession the_ejb=null;
              >
              > try
              > {
              > the_ejb=home.create();
              >
              > System.out.println("the_ejb = " + the_ejb.toString());
              >
              > }
              > catch(Exception e)
              > {
              > e.printStackTrace();
              > }
              > }
              > catch(Exception e)
              > {
              > e.printStackTrace();
              > }
              >          // to do: code goes here.
              >
              >          out.println("<HTML>");
              >          out.println("<HEAD><TITLE>Contractor TimeTracker</TITLE></HEAD>");
              >          out.println("<BODY>");
              >
              >          // to do: your HTML goes here.
              >
              >          out.println("</BODY>");
              >          out.println("</HTML>");
              >          out.close();
              >     }
              >
              >
              >
              >
              >
              

  • Class Cast Exception in a custom adapter processing module

    Hi,
    I am trying to create a Custom adapter module in my file adapter as a Local enterprise Bean.
    I have taken the "ConvertCRLFfromToLF" sample given by SAP as a reference, created an EJB module project, and deployed the enterprise archive to the J2EE engine.
    However, i am getting a Class Cast Exception in the Adapter Engine for my communication channel.
    Any help on this will much appreciated.
    Thanks & Regards,
    Renjith.

    HI,
    Managed to solve this..this was due to the additional jars which was included by the Developer Studio in the EAR file. We have to remoce the jars from the EAR, change the application.xml and sap_manifest.mf files to give reference to the jars already deployed in the J2EE engine.
    Thanks & Regards,
    Renjith

  • (Class cast Exception)Problem while loading data fro database in java class

    Dear all,
    Please help me...to solve this
    I have a database having two columns of String and Date Types.
    In my java code i was trying to load the data to a UI.
    I am successfull in loading the String type value.
    But while loading date field value,is showing Class cast Exception.
    What i am doing is Getting the values from database to a String[] array.
    So my question is how to
    get the Date field as date field itself,Then convert it to a String..Then put it in to String[] array...
    Any body please help...If any one want more clarification in question i will give......

    Hi,
    I am using GWT to display my data in a Grid.
    So it will accept a Single two dimensional String array....Here i have one as String and other as Date.
    So i was trying to get each row in a sindle dimensional array array[] then store it in a list.
    Iteration goes up to 10 rows.After i am setting it in to a list
    ie list.add(array);
    Now while returning this list i am doing this
    "return (String[][])list.toArray(new String[0][]);"
    When i tried to get the date element to String array it is showing class cast exception. When i tried with toString() method it is showing the same problem.

  • Class cast exception in Process Control

    Hello,
    I am trying to use a SubProcess through a Process Control from a ParentProcess in another Workshop application.
    They are both deployed in the same domain.
    The SubProcess Control is packaged in a Control Project whose jar is imported in the other ParentProcess Workshop application.
    The data that is passed is in form of XML documents described as schemas. And both applications use the same Schema.jar.
    The call from the ParentProcess looks like it is OK.
    But when the reply comes back it looks like the transform fails. I get a "class cast exception"
    The feeling I get is that the returning xml document variable can't be cast into the local xml document variable. Even though they are of the exact same type...
    All help is very much appreciated!!!
    Unhandled Process Exception:
    java.lang.ClassCastException
    at se.telia.object.kund.control.sokKundPControl.clientRequest(Unknown Source)
    at se.telia.tab.regae.process.Untitled.sokKundPctrlClientRequest(Untitled.jpd:101)
    -------------

    I'm having some problems with a transformation and I'm getting a cast exception so maybe it's the same thing.
    The problem is when the source schema has some element with minOccurs="0". If the element is not present in the xml document that is received, the transformation seems to be trying to cast it anyway.

  • Class Cast exception in ArrayDescriptor.createDescriptor(

    I want to pass an array into a an Oracle procedure called using a callableSatement.
    When I create the array descriptor i get an class cast exception. I believe this error occurs when the sun.jdbc.odbc.JdbcOdbcConnection
    or the weblogic.jdbc.wrapper.PoolConnection_weblogic_jdbc_oci_Connection connection object is being cast to oracle.jdbc.driver.OracleConnection by createDescriptor method how can i overcome this run time error????

    Welcome to the forum!
    >
    am trying to pass ArrayList to Oracle procedure
    but when i am excuting the code i got the following error
    java.lang.ClassCastException: com.ibm.ws.rsadapter.jdbc.WSJdbcConnection incompatible with oracle.jdbc.OracleConnection
    Can anybody help me to resolve this problem.
    >
    Not if you don't provide the code you are using so we can see what it is doing. Also post your 4 digit Oracle version, Java version, JDBC jar file name/version and the procedure signature that shows the language, parameters and types.
    An ArrayList is a Java object so are you using a Java stored procedure?
    Or are you using WebSphere? If WebSphere see this IBM link which appears to apply to the problem you are describing.
    http://www-01.ibm.com/support/docview.wss?uid=swg21409335

  • Class Cast exception in Servlet...

    hello guys, hope you can help...i am trying to build an application where data are exchanged between pages....form data are retrieved and sent to Servlet1,
    in Servglet1..i have
    String name=(String)request.getParameter("username");
    then that variable was added to the user seesion using..session.setAttribute("user",name);
    so in the current servlet(Servlet2), i am simply trying to retrieve it with..
    String usr=(String)session.getAttribute("user");
    but i still get a Class Cast exception....i really cant work out why...
    here is the stack strace...
    java.lang.ClassCastException: CheckUpdate$User
    at UpdateServlet.doPost(UpdateServlet.java:59)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
    at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:672)
    at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:463)
    at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:398)
    at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:301)
    at CheckUpdate.doPost(CheckUpdate.java:136)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
    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.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:869)
    at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
    at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
    at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
    at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
    at java.lang.Thread.run(Thread.java:595)
    thanks

    I'm really doubting that the value retrieval is the actual cause of the problem.
    UpdateServlet.java:59What does line 59 of that servlet contain?

  • Type problem - Class Cast Exception - trying to understand

    hello,
    i get a Class cast exception in the following code.
    interface Foo {}
    class Alpha implements Foo {}
    class Beta extends Alpha {}
    class Delta extends Beta {
    public static void main( String[] args ) {
    Beta x = new Beta();
    Beta b = (Beta)(Alpha)x; //fine
    Foo f = (Delta)x; //CCE
    Object ob = new Object();
    String s = new String();
    ob = s; //fine, no need of case
    s = (String)ob; //needs a castI was just thinking, implicitly Delta and Beta both of them IS-A Foo, and assigning x to a type foo shouldnt be a problem(while making it refer to the Delta class) so, what could cause the CCE ?
    I would appreciate if someone could please help me understand this.
    Rgds

    Hi.
    Assigning your "x" to a variable typed Foo is not a problem. The problem is that you are trying to cast an instance of Beta ("x") into type Delta which is not possible. Every Delta is a Beta, but not every Beta will be a Delta!
    Simple as that.
    Bye.

  • Remote Class cast Exception

    Greetings,
    I took my first steps into the RMI world. I managed to get a tutorial example working. Now I did my own RMI system, but I can`t get rid of this problem.
    - rmiregistry is running OK
    - my RMIServer is running OK
    but my RMIClient Throws: java.lang.ClassCastExceptionI took a closer look at the Object I receive on the client side, and it was:
    DBManager_Stub[RemoteStub [ref: [endpoint:[ ... [/b]
    Here are the code snippets:
    public interface DefaultDBManager extends java.rmi.Remote
    public class DBManager implements DefaultDBManagerIn my RMIServer:
    LocateRegistry.createRegistry(PORT);
    DefaultDBManager DB_MANAGER = new DBManager();
    UnicastRemoteObject.exportObject(((DefaultDBManager)DB_MANAGER));
    Naming.rebind(URL,DB_MANAGER);and in the client code:
    DBManager DB_MANAGER = (DBManager)Naming.lookup(URL);But the client code Throws Class cast Exception.
    What is it I`m not seeing here?
    Help appreciated,
    Eki

    and in the client code:
    DBManager DB_MANAGER = (DBManager)Naming.lookup(URL);You should be casting to the interface not the impl class.
    DefaultDBManager DB_MANAGER = (DefaultDBManager)Naming.lookup(URL);

Maybe you are looking for

  • Getting Runtiime error while exporting to Excel 97-2000 format (URGENT)

    Post Author: net_us2001 CA Forum: Exporting Hello Everyone, This is my first time in this forum. I am getting runtime error while exporting the report in EXCEL 97-2000, but exporting perfactly in MS-EXCEL (Data only) format. I found the reason is, us

  • I can't acces Ovi store

    Hi! I have a nokia 5530 xpressmusic and I have a problem.I can't acces Ovi.I can see just the image with ovi nokia and this is all.I think I have some viruses.what do you think? thank you! Solved! Go to Solution.

  • Messages in Inbox gone/disappeared/deleted?

    Opened up Mail today and all the messages in my inbox before yesterday are gone. They are not in the deleted messages. They are not in an On My Mac folder. They have just disappeared. This is actually the second machine this has happened to me on. Th

  • Local adjustments undo keystroke

    Just wanted to mention this as an annoying behavioral bug that I'd appreciate you fixing before release. When making local adjustments, if I'm modifying one of the sliders to an existing adjustment, then hit undo it de-selects the adjustment, so I ha

  • Upgrade CS3 - CS5 iMac really slow

    Hi, I've upgraded my Adobe CS3 to CS5. Now it seems my entire iMac to be slower. Especially when using Photoshop and Bridge (Camara RAW). Do you recognize this? I have an iMac 24 inch Mac OS X 10.6.4 with a 2.4 GHz Intel Core 2 Duo processor. I also