Discussions

EJB programming & troubleshooting: Problem with remove( ) method

  1. Problem with remove( ) method (3 messages)

    Platform:
    WINDOWS NT4.0
    WEBLOGIC SERVER 6.1(eval)
    DB2 UDB 6
    I am using an entity bean (cmp) to simulate a customer. Everything is working fine except the remove( ) method.
    In a client. I first applied findByPrimaryKey(..) to get the remot object. Then I applied the remove() method on it. This fails with following error...
    ============= Error Msg copied ===========================
    Remove failed java.rmi.RemoteException: Exception during remove.; nested exception is:
            java.lang.IllegalStateException: Illegal call to EJBContext method. The EJB specification (See Section 9.6.5, for example.) places restrictions on the m
    ethods that may be invoked during certain phases of a bean's lifecycle. One of these restrictions has been violated.
    ==========================================================
    Rest all - Create, Modify and Search are working great
    Anybody out there! please help me with some suggestions
    any attempt to help me will be rewarded with my appreciation and gratitude..
    take care
    rc



    Threaded Messages (3)

  2. Problem with remove( ) method[ Go to top ]

    before remove() method, just call any other method in the entity bean(for example, some getXXX() method).
  3. Problem with remove( ) method[ Go to top ]

    public void doWhatYouWant(TimeStamp dob)throws CreateException, RemoteException, FinderException
    {
    Insured insured = (Insured) PortableRemoteObject.narrow(home.create("INS333","BobDylan",dob,"M","6th Avenue,Paris","","INS28837722","Uni","Single","Rock star","Sony","Guitar","NIL","Y","Active"),Insured.class);
     if(insured != null){
     System.out.println("Going to remove record for "+insured.getInsInsuredName());
    try{
    insured.remove();
    }
    catch(Exception ex){
    System.out.println("Remove failed "+ex);
    }
            }
            else{
    System.out.println("Not Found for deletion");
    }
    }
  4. Problem with remove( ) method[ Go to top ]

    Hi there!
    Thanks for the reply
    but.. still the same error i am getting... attaching the main code below.. please tell me if anything can be done?
    for demo purpose it creates one Insured and removes it...

    ===========================================================

    public void doWhatYouWant(Timestamp dob)throws CreateException,RemoteException, FinderException{
      Insured insured = (Insured) PortableRemoteObject.narrow(home.create("INS333","BobDylan",dob,"M","6th Avenue,Paris","","INS28837722","xzy","Single","Rock satr","Sony","Guitar","NIL","Y","Active"),Insured.class);
      if(insured != null){
    System.out.println("Going to remove record for "+insured.getInsInsuredName());
    try{
    insured.remove();
    }
    catch(Exception ex){
                System.out.println("Remove failed "+ex);
    }
        }
        else{
           System.out.println("Create Failed");
       }
     }
    ==================================================
    thankx
    rc