5 Replies Latest reply on Dec 14, 2006 1:54 AM by jrosskopf

    Problem with Stateful SessionBean

    jrosskopf

      Hello,

      I have a stateful SessionBean which should be a facade to my Entities, etc.
      It is declared as following:

      @Stateful
      
      @Name("currentUser")
      @Scope(ScopeType.CONVERSATION)
      public class UserFacadeBean implements UserFacade {
       public static final String LOGIN_SUCCESS = "login_success";
       public static final String LOGIN_FAILED = "login_failed";
      
       @Logger
       Log log;
      
       String username = new String("");
       String password = new String ("");
      
       public String getPassword() {
       return password;
       }
       public void setPassword(String password) {
       this.password = password;
       }
       public String getUsername() {
       return username;
       }
       public void setUsername(String username) {
       this.username = username;
       }
      
       public String login() {
       log.info("Trying to log in \"" + username + "\" with password \"" + password + "\";");
      
       return LOGIN_SUCCESS;
       }
      
       @Destroy @Remove
       public void destroy() {
       log.info("Destroying ...");
       }
      }
      


      I tried to deploy the application (faclets and ICEFaces), but the component was´t recognized by seam.

      So I tried to declare the component in components.xml. Now I get the confusing error:
      20:10:50,062 INFO [Component] Component: currentUser, scope: SESSION, type: STATEFUL_SESSION_BEAN, class: de.yourule.facade.UserFacadeBean,
       JNDI: yourule/UserFacadeBean/local
      20:10:50,062 ERROR [[/yourule]] Exception sending context initialized event to listener instance of class org.jboss.seam.servlet.SeamListene
      r
      java.lang.IllegalArgumentException: Stateful session bean component should have a method marked @Remove @Destroy: currentUser
       at org.jboss.seam.Component.checkDestroyMethod(Component.java:322)
       at org.jboss.seam.Component.<init>(Component.java:254)
      .
      .
      .
      


      And I really don´t understand, whats going wrong.
      Any help appreciated! Thank you in advance.

      Regards
      ---
      Joachim