Class cast exception

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • meru
    New Member
    • Jun 2007
    • 4

    Class cast exception

    The following is a piece of code to calla stored procedure in oracle from java

    ArrayList arrList = new ArrayList();
    arrList.add(new Integer("10"));
    arrList.add(new Integer("7"));
    cstmt = conn.prepareCal l("BEGIN PRM_SMART_FIXTU RE_SEQ1(?,?,?); END;");

    ArrayDescriptor arrayDescriptor = new ArrayDescriptor (
    "FLOORPLAN_LABE L_LIST",
    cstmt.getConnec tion());
    ARRAY acctList = new ARRAY(arrayDesc riptor, conn,arrList.to Array());

    This code works fine from my test harness file..

    But when I try doing the same thing from my actual application like

    flrList.add(new Integer("10"))) ;
    cstmt = conn.prepareCal l(StoreSQLConst ants.RUN_SEQ_ST ORED_PROC);
    ArrayDescriptor arrayDescriptor = new ArrayDescriptor (StoreSQLConsta nts.FLOORPLAN_L ABEL_LIST,cstmt .getConnection( ));
    ARRAY acctList = new ARRAY(arrayDesc riptor,conn,flr List.toArray()) ;


    , it gives me a class cast exception @ the following line
    ARRAY acctList = new ARRAY(arrayDesc riptor,connJDA, flrList.toArray ());

    What could be wrong?
  • jeffbroodwar
    New Member
    • Oct 2006
    • 118

    #2
    Hi,

    I'm not sure but... can you check the parameters you typed :

    Code:
       // You typed :
       ARRAY acctList = new ARRAY(arrayDescriptor,conn,flrList.toArray());
    
       // Required : (see below the connJDA, you typed conn only...)
       ARRAY acctList = new ARRAY(arrayDescriptor,connJDA,flrList.toArray());
    plus, please use code tags when posting codes. Thanks

    Best Regards,
    Jeff

    Comment

    • odefta
      New Member
      • Jul 2007
      • 18

      #3
      I think the problem is at add method.
      Please use add(Object o), not add(int o)

      Read java documentation about ArrayList

      Comment

      Working...