Results 1 to 5 of 5
  1. #1
    wrwelden is offline Member
    Join Date
    May 2008
    Posts
    2
    Rep Power
    0

    Default java.lang.ClassCastException

    Hello,

    I am new to java> I have built a web page to query an oracle table and return rows of data. I have added a button to execute a delete method. When executing the delete method, I get the following error:

    What is the problem and how do I correct it?

    ## Detail 0 ##
    java.lang.ClassCastException
    at oracle.apps.cust.xxdpOrgDesc.server.xxdpOrgDescAMI mpl.DeleteOrgDescRow(xxdpOrgDescAMImpl.java:59)

    //*** ---- *** This is the row referenced in the error message *** ---- ****

    Xxdp00OrgDescriptionsVORowImpl rowi = (Xxdp00OrgDescriptionsVORowImpl)row[i];

    //*** ---- *** ----------------------------------------------- *** ---- ****
    Error Explanation:
    Thrown to indicate that the code has attempted to cast
    an object to a subclass of which it is not an instance.

  2. #2
    Zosden's Avatar
    Zosden is offline Senior Member
    Join Date
    Apr 2008
    Posts
    384
    Rep Power
    7

    Default

    Sounds like your trying to make one object be another object. For example you can not in java make a class called Car and try to cast it to a fruit. It won't let you.
    My IP address is 127.0.0.1

  3. #3
    danielstoner's Avatar
    danielstoner is offline Senior Member
    Join Date
    Apr 2008
    Location
    Canada
    Posts
    191
    Rep Power
    7

    Default

    It seems row[i] doesn't contain an instance of Xxdp00OrgDescriptionsVORowImpl. Can you show the actual code leading to this line?
    Daniel @ [www.littletutorials.com]
    Language is froth on the surface of thought

  4. #4
    wrwelden is offline Member
    Join Date
    May 2008
    Posts
    2
    Rep Power
    0

    Default Here is the actual code in AM

    Here is the actual code

    Java Code:
    package oracle.apps.cust.xxdpOrgDesc.server;
    import oracle.apps.fnd.framework.server.OAApplicationModuleImpl;
    import oracle.apps.cust.xxdpOrgDesc.webui.Xxdp00OrgDescriptionsVOImpl;
    //import oracle.apps.fnd.framework.server.OAUtility.*;
    import oracle.jbo.Row;
    //import oracle.apps.fnd.framework.server.*;
    //import oracle.apps.fnd.framework.*;
     
    //  ---------------------------------------------------------------
    //  ---    File generated by Oracle Business Components for Java.
    //  ---------------------------------------------------------------
    
    public class xxdpOrgDescAMImpl extends OAApplicationModuleImpl 
    {
      /**
       * 
       * This is the default constructor (do not remove)
       */
      public xxdpOrgDescAMImpl()
      {
      }
    
      /**
       * 
       * Container's getter for Xxdp00OrgDescriptionsVO
       */                                
          public Xxdp00OrgDescriptionsVOImpl getXxdp00OrgDescriptionsVO1()
      //     public Xxdp00OrgDescriptionsVOImpl getXxdp00OrgDescriptionsVO() /* orig */
      {
      // return (Xxdp00OrgDescriptionsVOImpl)findViewObject("Xxdp00OrgDescriptionsVO");       /* orig */
         return (Xxdp00OrgDescriptionsVOImpl)findViewObject("Xxdp00OrgDescriptionsVO1");
      }
    
      /**
       * 
       * Sample main for debugging Business Components code using the tester.
       */
      public static void main(String[] args)
      {
        launchTester("oracle.apps.cust.xxdpOrgDesc.server", "xxdpOrgDescAMLocal");
      }
    /*
     *  Beginning of Delete Method - DeleteOrgDescRow
     */          
    public void DeleteOrgDescRow( String pAction, String pRowID )
    {
    System.out.println("xxDebug inside deleteOrgDescRow()") ;
    //  Xxdp00OrgDescriptionsVOImpl orgvo = getXxdp00OrgDescriptionsVO() ;   /* orig */
        Xxdp00OrgDescriptionsVOImpl orgvo = getXxdp00OrgDescriptionsVO1() ;  /* test */
    System.out.println("pAction IS: "+pAction) ;
    System.out.println("ROW_ID IS: "+pRowID) ;
    Row row[]=orgvo.getAllRowsInRange();
    
    
    for ( int i=0;i<row.length;i++)
    {
    System.out.println("i IS: "+i) ;
    System.out.println("i end IS: "+row.length) ;
    //Xxdp00OrgDescriptionsVORowImpl rowi = (Xxdp00OrgDescriptionsVORowImpl)row[i];
    Xxdp00OrgDescriptionsVORowImpl rowi = (Xxdp00OrgDescriptionsVORowImpl)row[i];
    System.out.println("xxDebug Checking to delete RowID => " + rowi.getRowID());
    if (rowi.getRowID().toString().equals(pRowID))
    {
    	rowi.remove();
    	getOADBTransaction().commit();
    	return ;
    }
    }
    /*
     * End of Delete Method
     */
     
    }
    }
    Thanks for your help.

  5. #5
    danielstoner's Avatar
    danielstoner is offline Senior Member
    Join Date
    Apr 2008
    Location
    Canada
    Posts
    191
    Rep Power
    7

    Default

    What is the signature for this method: orgvo.getAllRowsInRange(); ?
    Daniel @ [www.littletutorials.com]
    Language is froth on the surface of thought

Similar Threads

  1. Replies: 2
    Last Post: 09-18-2008, 07:30 AM
  2. ClassCastException in TreeSet
    By pHew in forum New To Java
    Replies: 2
    Last Post: 01-16-2008, 12:20 AM
  3. Replies: 1
    Last Post: 07-16-2007, 04:31 PM
  4. ClassCastException
    By Ed in forum New To Java
    Replies: 2
    Last Post: 07-04-2007, 05:26 AM
  5. ClassCastException
    By Felissa in forum New To Java
    Replies: 2
    Last Post: 07-04-2007, 05:06 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •