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

    Can't delpoy simple EJB

      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;
      }

        • 1. Re: Can't delpoy simple EJB

          I forgot to add my deployment descriptor, here it is:


          <ejb-name>CatSess</ejb-name>
          com.shub.ejb.session.catalog.CatSessHome
          com.shub.ejb.session.catalog.CatSess
          <ejb-class>com.shub.ejb.session.catalog.CatSessBean</ejb-class>
          <session-type>Stateless</session-type>
          <transaction-type>Container</transaction-type>

          • 2. Re: Can't delpoy simple EJB
            kabirkhan

            Get rid of addItem() and deleteItem() from the Home i/f. Home methods only exist for entity beans.