1 Reply Latest reply on Mar 15, 2006 12:40 PM by Joan Horta Tosas

    Strange: the exceptions in the Bean class isn`t the same as

    Shun zi Chen Newbie

      Hello! everyone !
      I`m new to EJB and encountered the problem when i was deploying my first BMP.
      I`m using JBoss 4.0.3 and JBoss IDE 1.5 with eclispe 3.1. When I try to deploy my ear file, JBoss kept saying the following:
      12:18:21,343 WARN [verifier] EJB spec violation:
      Bean : Account
      Method : public abstract void deposit(double) throws AccountException, RemoteException
      Section: 9.2.7
      Warning: All the exceptions defined in the throws clause of a matching method in the entity bean's class must be defined in the throws clause of the method of the remote interface.

      12:18:21,343 WARN [verifier] EJB spec violation:
      Bean : Account
      Method : public abstract void withdraw(double) throws AccountException, RemoteException
      Section: 9.2.7
      Warning: All the exceptions defined in the throws clause of a matching method in the entity bean's class must be defined in the throws clause of the method of the remote interface.

      12:18:21,343 ERROR [MainDeployer] Could not create deployment: file:/E:/jboss-4.0.3/server/all/tmp/deploy/tmp55218AccountApp.ear-contents/AccountEJB.jar


      But the exceptions threw by the corresponding methods are just the same, see in AccountBean.java:

      /**
      * Business method
      * @ejb.interface-method view-type = "both"
      */
      public void deposit(double amt) throws AccountException {
      // TODO Auto-generated method stub
      System.out.println("deposite (" + amt + ") called.");
      balance += amt;
      }
      /**
      * Business method
      * @ejb.interface-method view-type = "both"
      */
      public void withdraw(double amt) throws AccountException {
      // TODO Auto-generated method stub
      System.out.println("withdraw (" + amt + ") called.");
      if (amt > balance) {
      throw new AccountException("Your balance is ("
      + balance
      + "). You can`t with draw ("
      + amt
      + ").");
      }
      balance -= amt;
      }


      and in Account.java:
      public void deposit( double amt )
      throws account.ejb.AccountException, java.rmi.RemoteException;

      /**
      * Business method
      */
      public void withdraw( double amt )
      throws account.ejb.AccountException, java.rmi.RemoteException;


      Anyone can tell me why JBoss kept saying that ? I`m going crazy about this problem!