0 Replies Latest reply on Oct 4, 2004 12:24 PM by francesco vivoli

    Relating stateless session beans

    francesco vivoli Newbie

      Hi everyone!
      After some time spent without problems now I am in a dead end. Googling and previous posts didn't help, so here i am seeking for an hint.

      I have a stateless session bean name it UserManagerPB that uses OJB to persist customers' data, with following deploy descriptor entry

      --->ejb-jar.xml
      <ejb-name>UserManagerPB</ejb-name>

      com.wapa.interprj.storage.UserManagerPBHome
      com.wapa.interprj.storage.UserManagerPB
      <local-home>com.wapa.interprj.storage.UserManagerPBLocalHome</local-home>
      com.wapa.interprj.storage.UserManagerPBLocal
      <ejb-class>com.wapa.interprj.storage.UserManagerPBSession</ejb-class>
      <session-type>Stateless</session-type>
      <transaction-type>Container</transaction-type>
      -----------

      ---->jboss.xml


      <ejb-name>UserManagerPB</ejb-name>
      <jndi-name>com.wapa.interprj.storage.UserManagerPB</jndi-name>
      <local-jndi-name>UserManagerPBLocal</local-jndi-name>

      -----------


      The business methods have @ejb:interface-method attribute as for example:

      ------>UserManagerPB.getUser()
      /**
      * @ejb:interface-method
      *
      *
      */
      public PersistentUser getUser(String username)
      -----

      I can work with a remote client accessing this bean smoothly but what i really need to do is calling methods as the one above from another bean.

      I have created another stateless bean called UserAccess, with the following attributes:

      * @ejb.bean name="UserAccess"
      * jndi-name="UserAccess"
      * type="Stateless"
      * transaction-type="Container"
      *
      *
      * *
      * @ejb.ejb-ref ejb-name="UserManagerPB"
      * view-type="remote"
      *
      * @jboss.ejb-ref-jndi ref-name="UserManagerPB"
      jndi-name="UserManagerPB"
      *

      that generate these entries

      ------>ejb-jar.xml

      <ejb-name>UserAccess</ejb-name>

      com.wapa.interprj.storage.UserAccessHome
      com.wapa.interprj.storage.UserAccess
      <local-home>com.wapa.interprj.storage.UserAccessLocalHome</local-home>
      com.wapa.interprj.storage.UserAccessLocal
      <ejb-class>com.wapa.interprj.storage.UserAccessSession</ejb-class>
      <session-type>Stateless</session-type>
      <transaction-type>Container</transaction-type>

      <ejb-ref >
      <ejb-ref-name>ejb/UserManagerPB</ejb-ref-name>
      <ejb-ref-type>Session</ejb-ref-type>
      com.wapa.interprj.storage.UserManagerPBHome
      com.wapa.interprj.storage.UserManagerPB
      <ejb-link>UserManagerPB</ejb-link>
      </ejb-ref>
      -----------

      ----->jboss.xml

      <ejb-name>UserAccess</ejb-name>
      <jndi-name>UserAccess</jndi-name>
      <local-jndi-name>UserAccessLocal</local-jndi-name>
      <ejb-local-ref>
      <ejb-ref-name>ejb/UserManagerPB</ejb-ref-name>
      <jndi-name>UserManagerPB</jndi-name>
      </ejb-local-ref>


      -----------

      What i'm trying to do actually is accessing methods from UserManagerPB
      within UserAccess, doing something like

      UserManagerPB userManager = UserManagerPBUtil.getHome().create();
      PersistentUser p = userManager.getUser(username);


      The problem is that i can't deploy the modules since i get this exception

      ---------->
      16:10:46,708 ERROR [StatelessSessionContainer] Initialization failed jboss.j2ee:jndiName=com.wapa.interprj.storage.UserManagerPBBean,service=EJB
      java.lang.NoSuchMethodException: org.jboss.ejb.StatelessSessionContainer.getUserHome(java.lang.String)
      at java.lang.Class.getMethod(Class.java:978)
      ...
      ...
      ...
      MBeans waiting for other MBeans:
      ObjectName: jboss.j2ee:jndiName=com.wapa.interprj.storage.UserManagerPBBean,service=EJB
      state: FAILED
      I Depend On:
      Depends On Me: MBeanException: java.lang.NoSuchMethodException: org.jboss.ejb.StatelessSessionContainer.getUserHome(java.lang.String)
      Cause: java.lang.NoSuchMethodException: org.jboss.ejb.StatelessSessionContainer.getUserHome(java.lang.String)

      MBEANS THAT ARE THE ROOT CAUSE OF THE PROBLEM:
      ObjectName: jboss.j2ee:jndiName=com.wapa.interprj.storage.UserManagerPBBean,service=EJB
      state: FAILED
      I Depend On:
      Depends On Me: MBeanException: java.lang.NoSuchMethodException: org.jboss.ejb.StatelessSessionContainer.getUserHome(java.lang.String)
      Cause: java.lang.NoSuchMethodException: org.jboss.ejb.StatelessSessionContainer.getUserHome(java.lang.String)

      at org.jboss.ejb.StatelessSessionContainer.setupHomeMapping(StatelessSessionContainer.java:488)
      -----------

      My original plan was to use the @home-method attribute for the methods of UserManagerPB to be accessed by UserAccess. Since i was getting the very same error I thought i was wrong with something there so i moved to the remote interface since I had used this before successfully but now i'm pretty stuck.
      Any help would be pretty appreciated guys...
      Thanks everyone,
      villo