glassfish
  1. glassfish
  2. GLASSFISH-20969

@Stateful bean does not throw NoSuchEJBException

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Cannot Reproduce
    • Affects Version/s: 4.0
    • Fix Version/s: None
    • Component/s: ejb_container
    • Labels:
      None
    • Environment:

      Windows 8 x64

      Description

      According to the EJB 3.2 specification (see below), a stateful session bean is supposed to throw a NoSuchEJBException if the client tries to use a stateful session bean that has timed out or had his @Remove annotated business method called.

      This is true if the method invoked after the bean has timed out or been explicitly removed, is declared on the session bean class. However, if the method invoked was a method declared on a superclass (annotation free) that the stateful bean extended, the exception is not thrown. Instead, subsequent calls to the bean is honored.

      Section "4.9.2.1 Session Bean Superclasses" does not explain whether or not an inherited method is a business method of the inheriting class. It does say that superclasses "represents a conventient use of implementation inheritance".

      My testing that showed this error has used the no-interface view of a stateful bean. And that's it, i'm done with the problem description. Quotes from the specification follows.

      EJB 3.2 specification, page 85:
      "When the client calls a business method of the bean that has been designated as a Remove method on the bean class or a remove method on the home or component interface, the container invokes PreDestroy lifecycle callback interceptor methods, if any, for the bean instance after the Remove method completes.[25] This ends the life of the session bean instance and the associated session object. If a client subsequently attempts to invoke a method on the bean's business interface, the container will throw the javax.ejb.NoSuchEJBException."

      EJB 3.2 specification, page 43:
      "If a stateful session bean has been removed, attempted invocations on the stateful session bean business interface result in the javax.ejb.NoSuchEJBException."

      EJB 3.2 specification, page 57:
      "It is invalid to reference a session object that does not exist. Attempted invocations on a stateful session object that does not exist result in javax.ejb.NoSuchObjectLocalException."

        Activity

        Hide
        jclingan added a comment -

        If the issue does indeed break the EJB 3.2 specification, then this issue is a mustfix.

        Show
        jclingan added a comment - If the issue does indeed break the EJB 3.2 specification, then this issue is a mustfix.
        Hide
        amy.yang added a comment -

        Hi,
        I've made a simple test case based on current ejb detests https://svn.java.net/svn/glassfish~svn/trunk/v2/appserv-tests/devtests/ejb/ejb32/sfsb. please refer to the enclosed patch.

        SFSB extends SuperSFSB and SuperSFSB has a method foo(). SLSB invokes SFSB.foo() after SFSB is removed, and an exception is thrown as expected (the exception can be seen in server.log) and the test passed.

        Please let me know if this test case can't represent the issue and attach your test case. Thanks.

        Show
        amy.yang added a comment - Hi, I've made a simple test case based on current ejb detests https://svn.java.net/svn/glassfish~svn/trunk/v2/appserv-tests/devtests/ejb/ejb32/sfsb . please refer to the enclosed patch. SFSB extends SuperSFSB and SuperSFSB has a method foo(). SLSB invokes SFSB.foo() after SFSB is removed, and an exception is thrown as expected (the exception can be seen in server.log) and the test passed. Please let me know if this test case can't represent the issue and attach your test case. Thanks.
        Hide
        amy.yang added a comment -

        As my previous comment my test case catches the expected exception when the method of super class is invoked after removing the SFSB.
        I've checked in the test case at r63389 under ejb detests.

        Please reopen the issue if you think the issue still exists and please provide the test case to repro.

        Thanks,
        Amy

        Show
        amy.yang added a comment - As my previous comment my test case catches the expected exception when the method of super class is invoked after removing the SFSB. I've checked in the test case at r63389 under ejb detests. Please reopen the issue if you think the issue still exists and please provide the test case to repro. Thanks, Amy

          People

          • Assignee:
            amy.yang
            Reporter:
            martinandersson.com
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: