2 Replies Latest reply on Feb 13, 2004 11:21 AM by Kabir Khan

    Can't delpoy simple EJB

    Christopher Davies Newbie

      I think I'm going nuts, but for the life of me I cannot see why my bean won't deploy. It always complains with the error:

      [ObjectName: jboss.j2ee:jndiName=CatSess,service=EJB
      state: FAILED
      I Depend On:
      Depends On Me: java.lang.NoSuchMethodException: org.jboss.ejb.StatelessSessionC
      ontainer.addItemHome(java.lang.String, java.lang.Object)]

      But there is no method defined called addItemHome, it is called addItem. Can anyone see what is wrong? Here is my code:

      import javax.ejb.EJBObject;
      import java.rmi.RemoteException;

      public interface CatSess extends EJBObject {

      public void addItem(String supplierId, Object e) throws java.rmi.RemoteException;

      public void deleteItem(String supplierId, Object e) throws java.rmi.RemoteException;

      }

      -----

      import javax.ejb.*;


      public class CatSessBean implements SessionBean {

      protected SessionContext ctx;

      public void ejbCreate(){
      }

      public void addItemHome(String supplierId, Object e){

      System.out.println("Add Supplier Item: " + supplierId);
      }

      public void deleteItemHome(String supplierId, Object e){

      System.out.println("Delete Supplier Item: " + supplierId);
      }

      public void addItem(String supplierId, Object e){

      System.out.println("Add Supplier Item: " + supplierId);
      }

      public void deleteItem(String supplierId, Object e){

      System.out.println("Delete Supplier Item: " + supplierId);
      }

      public void ejbActivate() {
      System.out.println("Called Catalog Session ejbActivate");
      }

      public void ejbPassivate() {
      System.out.println("Called Catalog Session ejbPassivate");
      }

      public void ejbRemove() {
      System.out.println("Called Catalog Session ejbRemove");
      }

      public void setSessionContext(SessionContext parm1) {
      System.out.println("Called Catalog Session setSessionContext");
      this.ctx = parm1;
      }

      public void unsetSessionContext() {
      System.out.println("Called Catalog Session unsetSessionContext");
      this.ctx = null;
      }

      ----

      import javax.ejb.*;

      import java.rmi.*;

      public interface CatSessHome extends EJBHome {

      public CatSess create () throws CreateException, RemoteException;

      public void addItem(String supplierId, Object e) throws java.rmi.RemoteException;

      public void deleteItem(String supplierId, Object e) throws java.rmi.RemoteException;
      }