Search code examples
ejbstateful-session-bean

javax.ejb.NoSuchEJBException: Could not find stateful bean: 3j011-udy7sm-hkt798pd-1-hkt7bobh-9


Many times whenever I try to access some pages or click buttons "Could not find stateful bean: 3j011-udy7sm-hkt798pd-1-hkt7bobh-9"error hits on the screen for the JSF project.Do anybody know the cause for this errpr


Solution

  • Possibly you ran into a timeout, and the stateful session been has been removed by the container.

    You can use @StatefulTimeout (EJB 3.1) to set this value. A quote from the Javadoc:

    Specifies the amount of time a stateful session bean can be idle (not receive any client invocations) before it is eligible for removal by the container.

    To verify if that is really the case, add a method with @PreDestroy, so you can see if the SFSB has been removed.

    Example:

    @Stateful(name = "xxx")
    @StatefulTimeout(value = 15, unit = TimeUnit.SECONDS)
    public class Sfsb {
      @PreDestroy
      public void preDestroy() {
        System.out.println("INFO: " + "@PreDestroy");
      }
    }