3 Replies Latest reply: Jun 20, 2013 5:45 AM by Peddi RSS

    error incompatible types

    1011038

      Dears,

      kindly i need your support as i found the error message" incompatible Types; found; int,required: interface java.io.serializable" after compiling the below code in controller:

        • 1. Re: error incompatible types
          Sushant Sharma

          Hi,

           

          Please share your code.

          Are you passing parameters into am.invokeMethod() ?

           

          --Sushant


          • 2. Re: error incompatible types
            1011038

            /*===========================================================================+
            |   Copyright (c) 2001, 2005 Oracle Corporation, Redwood Shores, CA, USA    |
            |                         All rights reserved.                              |
            +===========================================================================+
            |  HISTORY                                                                  |
            +===========================================================================*/
            package te.oracle.apps.pay.selfservice.soe.webui;

            import java.io.Serializable;

            import java.sql.SQLException;
            import java.sql.Types;

            import java.text.DateFormat;
            import java.text.ParseException;
            import java.text.SimpleDateFormat;

            import oracle.apps.fnd.common.VersionInfo;
            import oracle.apps.fnd.framework.OAApplicationModule;
            import oracle.apps.fnd.framework.OAException;
            import oracle.apps.fnd.framework.server.OADBTransaction;
            import oracle.apps.fnd.framework.webui.OAControllerImpl;
            import oracle.apps.fnd.framework.webui.OAPageContext;
            import oracle.apps.fnd.framework.webui.beans.OAWebBean;

            import oracle.jbo.ViewObject;

            import oracle.jbo.domain.Date;
            import java.text.ParseException;

            import oracle.jdbc.OracleCallableStatement;
            import oracle.jdbc.OracleConnection;

            import te.oracle.apps.pay.selfservice.soe.server.SalaryVOImpl;

            /**
            * Controller for ...
            */
            public class SalaryCO extends OAControllerImpl
            {
              public static final String RCS_ID="$Header$";
              public static final boolean RCS_ID_RECORDED =
                    VersionInfo.recordClassVersion(RCS_ID, "%packagename%");

              /**
               * Layout and page setup logic for a region.
               * @param pageContext the current OA page context
               * @param webBean the web bean corresponding to the region
               */
              public void processRequest(OAPageContext pageContext, OAWebBean webBean) {   
               OAApplicationModule am = pageContext.getApplicationModule(webBean);

                  int pAssignmentId =Integer.parseInt(pageContext.getParameter("pAssignmentId"));
                  int payrollId=61;
                  int timePeriodId=211;
                
                    DateFormat formatter = new  SimpleDateFormat("yyyy-MM-dd");
                 


                    try {
                   
                        long periodEndDatelong = formatter.parse("2012-07-31").getTime();
                        java.sql.Date periodEndDate = new java.sql.Date(periodEndDatelong);
                        Serializable parameters[] = {pAssignmentId, payrollId,timePeriodId, periodEndDatelong};

                        Class paramTypes[] = {int.class,int.class,int.class, long.class};

                        am.invokeMethod("setSoe", parameters, paramTypes);    
                       
                    } catch (ParseException e) {
                        // TODO
                    }
             
                       
                       
             
              }

              /**
               * Procedure to handle form submissions for form elements in
               * a region.
               * @param pageContext the current OA page context
               * @param webBean the web bean corresponding to the region
               */
              public void processFormRequest(OAPageContext pageContext, OAWebBean webBean)
              {
                super.processFormRequest(pageContext, webBean);
              }

            }

            • 3. Re: error incompatible types
              Peddi

              While setting the parameter type for invokeMethod, you should always use serializable classes like String, Integer, Number etc but not primitive data types like int, long etc.

              So change your Class[] statement to


              Class paramTypes[] = {Integer.class,Integer.class,Integer.class, Integer.class}; //Check the syntax of setSoe and set the class types accordingly.


              Before you do the above check the syntax of setSoe method in AM and see what are the type of parameters it's taking.


              Regards,

              Peddi.