3 Replies Latest reply on Dec 25, 2011 2:43 AM by Kristofer Cruz

    ClassCastException Error

    662320
      I have tried sample tutorial example with search page with create button, when user click on create button it opens a new page to create dept record with passign dept no and it displays that on create page as default value, user enters dept name and location and cliicks on Apply button and it will navigate to main search page with message dept # and dept name record got created.

      When I click on Apply button I am getting error message, Can you please help in this, I checked DeptVO which has Deptno as number with size 2 length, not sure why I am getting this error message

      ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

      oracle.apps.fnd.framework.OAException: java.lang.ClassCastException
           at oracle.apps.fnd.framework.OAException.wrapperException(OAException.java:891)
           at oracle.apps.fnd.framework.webui.OAPageErrorHandler.prepareException(OAPageErrorHandler.java:1145)
           at oracle.apps.fnd.framework.webui.OAPageErrorHandler.processErrors(OAPageErrorHandler.java:1408)
           at oracle.apps.fnd.framework.webui.OAPageBean.processFormRequest(OAPageBean.java:2680)
           at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:1683)
           at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:509)
           at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:430)
           at OA.jspService(OA.jsp:33)
           at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:56)
           at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:317)
           at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:465)
           at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:379)
           at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
           at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:727)
           at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:306)
           at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:767)
           at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:259)
           at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:106)
           at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:803)
           at java.lang.Thread.run(Thread.java:534)
      ## Detail 0 ##
      java.lang.ClassCastException
           at kam.oracle.apps.ak.employee.webui.CreateDeptCO.processFormRequest(CreateDeptCO.java:72)
           at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequest(OAWebBeanHelper.java:810)
           at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processFormRequest(OAWebBeanContainerHelper.java:363)
           at oracle.apps.fnd.framework.webui.OAPageLayoutHelper.processFormRequest(OAPageLayoutHelper.java:1159)
           at oracle.apps.fnd.framework.webui.beans.layout.OAPageLayoutBean.processFormRequest(OAPageLayoutBean.java:1579)
           at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(OAWebBeanHelper.java:1022)
           at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(OAWebBeanHelper.java:988)
           at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequest(OAWebBeanHelper.java:843)
           at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processFormRequest(OAWebBeanContainerHelper.java:363)
           at oracle.apps.fnd.framework.webui.beans.form.OAFormBean.processFormRequest(OAFormBean.java:395)
           at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(OAWebBeanHelper.java:1022)
           at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(OAWebBeanHelper.java:988)
           at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequest(OAWebBeanHelper.java:843)
           at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processFormRequest(OAWebBeanContainerHelper.java:363)
           at oracle.apps.fnd.framework.webui.beans.OABodyBean.processFormRequest(OABodyBean.java:363)
           at oracle.apps.fnd.framework.webui.OAPageBean.processFormRequest(OAPageBean.java:2676)
           at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:1683)
           at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:509)
           at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:430)
           at OA.jspService(OA.jsp:33)
           at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:56)
           at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:317)
           at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:465)
           at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:379)
           at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
           at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:727)
           at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:306)
           at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:767)
           at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:259)
           at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:106)
           at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:803)
           at java.lang.Thread.run(Thread.java:534)
      java.lang.ClassCastException
           at kam.oracle.apps.ak.employee.webui.CreateDeptCO.processFormRequest(CreateDeptCO.java:72)
           at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequest(OAWebBeanHelper.java:810)
           at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processFormRequest(OAWebBeanContainerHelper.java:363)
           at oracle.apps.fnd.framework.webui.OAPageLayoutHelper.processFormRequest(OAPageLayoutHelper.java:1159)
           at oracle.apps.fnd.framework.webui.beans.layout.OAPageLayoutBean.processFormRequest(OAPageLayoutBean.java:1579)
           at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(OAWebBeanHelper.java:1022)
           at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(OAWebBeanHelper.java:988)
           at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequest(OAWebBeanHelper.java:843)
           at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processFormRequest(OAWebBeanContainerHelper.java:363)
           at oracle.apps.fnd.framework.webui.beans.form.OAFormBean.processFormRequest(OAFormBean.java:395)
           at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(OAWebBeanHelper.java:1022)
           at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(OAWebBeanHelper.java:988)
           at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequest(OAWebBeanHelper.java:843)
           at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processFormRequest(OAWebBeanContainerHelper.java:363)
           at oracle.apps.fnd.framework.webui.beans.OABodyBean.processFormRequest(OABodyBean.java:363)
           at oracle.apps.fnd.framework.webui.OAPageBean.processFormRequest(OAPageBean.java:2676)
           at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:1683)
           at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:509)
           at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:430)
           at OA.jspService(OA.jsp:33)
           at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:56)
           at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:317)
           at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:465)
           at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:379)
           at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
           at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:727)
           at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:306)
           at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:767)
           at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:259)
           at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:106)
           at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:803)
           at java.lang.Thread.run(Thread.java:534)


      ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

      Code which gives an error message is

      Number DeptNumber = (Number)vo.getCurrentRow().getAttribute("Deptno");

      __________________________________________________________________________________________________________________________

      The full code for createDeptCO controller file is


      public void processFormRequest(OAPageContext pageContext, OAWebBean webBean)
      {
      super.processFormRequest(pageContext, webBean);
      OAApplicationModule am = pageContext.getApplicationModule(webBean);
      if (pageContext.getParameter("Apply") != null)
      {
      OAViewObject vo = (OAViewObject)am.findViewObject("DeptVO1") ;
      String DeptName = (String)vo.getCurrentRow().getAttribute("Dname");
      Number DeptNumber = (Number)vo.getCurrentRow().getAttribute("Deptno");_
      String deptNum = String.valueOf(DeptNumber.intValue());
      am.invokeMethod("apply");
      MessageToken[] tokens = { new MessageToken("EMP_NAME", DeptName),
      new MessageToken("EMP_NUMBER", deptNum)
      };
      OAException confirmMessage = new OAException("AK",
      "FWK_TBX_T_EMP_CREATE_CONFIRM", tokens,
      OAException.CONFIRMATION, null);
      pageContext.putDialogMessage(confirmMessage);
      pageContext.forwardImmediately("OA.jsp?page=/kam/oracle/apps/ak/employee/webui/EmpSearchPG",
      null,
      OAWebBeanConstants.KEEP_MENU_CONTEXT,
      null,
      null,
      true, // retain AM
      OAWebBeanConstants.ADD_BREAD_CRUMB_NO);
      }
      else if (pageContext.getParameter("Cancel") != null)
      {
      am.invokeMethod("rollback");
      pageContext.forwardImmediately("OA.jsp?page=/kam/oracle/apps/ak/employee/webui/EmpSearchPG",
      null,
      OAWebBeanConstants.KEEP_MENU_CONTEXT,
      null,
      null,
      true, // retain AM
      OAWebBeanConstants.ADD_BREAD_CRUMB_NO);
      }