9 Replies Latest reply on Oct 15, 2007 8:22 PM by Andrew Rubinger

    When is there an EJBObject?

    Carlo de Wolf Master

      With the implementation of EJBTHREE-786 we've a clash on the usage of EJBObject. We had functionality that allowed each proxy to be an EJBObject.
      So now this test is failing: org.jboss.ejb3.test.stateful.unit.RemoteUnitTestCase.testEJBObject

      For terminology purposes I quote the spec:

      "EJB 3 3.1" wrote:
      Terminology note: This speci?cation uses the term remote business interface to refer to the business interface of an EJB 3.0 session bean that supports remote access. The term remote interface is used to refer to the remote component interface of the EJB 2.1 client view. The term local business interface refers to the local business interface of an EJB 3.0 session bean that supports local access. The term local interface is used to refer to the local component interface of the EJB 2.1 client view.

      It is important to note that 'remote interface != remote business interface'.

      I say what we had is a spec violation (you know me :-)).

      "EJB 3 4.3.3" wrote:
      The getEJBObject method returns the session bean?s remote interface. Only session beans with a remote EJBObject interface can call this method.

      "EJB 3 4.6.6" wrote:
      The [session bean's business] interface must not extend the javax.ejb.EJBObject or javax.ejb.EJBLocalObject interface.

      "EJB 3 4.6.7" wrote:
      The [session bean's remote] interface must extend the javax.ejb.EJBObject interface.

      Which leads to the question: for what scenario did we have this functionality?

        • 2. Re: When is there an EJBObject?
          Andrew Rubinger Master

          In reference to EJBTHREE-1058:

          Assuming:

          @Remote
          public interface MyBusiness extends EJBObject


          ...what is the difference between the Proxy obtained via a lookup to this remote interface and the one obtained via a home.create() call?

          They are currently handled differently; one implementation specific is that when invoking "remove" from the Proxy obtained via lookup directly to remote interface, "dynamicInvoke" of the Container (StatefulContainer, for instance) the method hash of the invocation is not found in the method interceptors, and a RuntimeException is thrown before the proper call to invokeEJBObjectMethod().


          • 3. Re: When is there an EJBObject?
            Carlo de Wolf Master

             

            "bdecoste" wrote:
            I'm wondering what the trigger should be for us to support a 2.1 view (EJBObject)? Maybe just the existence of a Home interface? Is that better than explicit extends EJBObject?

            Then the question is can a home interface return a non EJBObject from it's create method? (See failing unit test.)

            • 4. Re: When is there an EJBObject?
              William DeCoste Apprentice

              No, that is what I am suggesting - if there is a home interface, then we fully support 2.1 views. The trigger would be the home interface, not an explicit extends EJBOBject.

              • 5. Re: When is there an EJBObject?
                Andrew Rubinger Master

                Would you then consider 1058 to be an invalid case that we shouldn't support?

                I do have a fix for it in my local, ready to go once confirmed that it's what we'd like.

                S,
                ALR

                • 6. Re: When is there an EJBObject?
                  Carlo de Wolf Master

                  In the failing unit test a proxy to a bean with a remote business interface is cast to an EJBObject.
                  So we can agree that this is in fact an illegal construct?

                  We can still allow a home-less bean with a remote interface. It would result in a partially realized EJB 2.1 view, only usable by EJB 3 users. (EJBTHREE-1058)

                  I say for fully realized EJB 2.1 view you must have:
                  - a home interface (extending EJBHome or EJBLocalHome)
                  - a remote/local interface (extending EJBObject or EJBLocalObject)

                  A home interface without a remote/local interface would then be considered an illegal construct and should throw an exception at deployment time.
                  Same goes for returning some else that the defined remote/local interface from the home's create method(s).

                  In theory we could infer the remote/local interface from the home interface create method's return type. So an explicit remote/local interface definition is then optional.

                  • 7. Re: When is there an EJBObject?
                    Andrew Rubinger Master

                    I'm not sure the history of our goals in implementation, but taking from the perspective of an application developer:

                    Isn't the concept of "partially-realized" confusing? An EJB2.1 view that's only callable from a EJB3.0 client? Why?

                    An EJB should have the following possible views: EJB3.0, EJB2.1, or both, with nothing inbetween. Anything half-defined should throw a descriptive Exception to the bean provider on deploy.

                    Propose the following:

                    * Close 1058 as invalid/not a bug
                    * Fix RemoteUnitTestCase.testEJBObject() to pass by changing org.jboss.ejb3.test.stateful.Stateful to extend EJBObject.
                    * Open a new issue, redefining the case outlined in 1058 but stipulating that the container should throw an exception on deploy. Remote interface w/ no home is an incomplete 2.1 view.
                    * Open a new issue for the inverse: Home interface with no Remote interface is an incomplete 2.1 view.

                    Benefits here:

                    * We don't have to guess/infer what the intent of the bean provider was to expose
                    * We give clear failures on deployment as to why an EJB with partially-implemented 2.1 views to the bean provider.

                    Invite those with more experience w/ Spec interpretation to invalidate this argument.

                    S,
                    ALR

                    • 8. Re: When is there an EJBObject?
                      Andrew Rubinger Master

                      I'd like to come to a consensus here and close EJBTHREE-1058 out.

                      "EJB 3.0 4.6.6" wrote:
                      The (session bean's business) interface must not extend the javax.ejb.EJBObject or javax.ejb.EJBLocalObject interface.


                      I believe this makes:
                      public interface StatefulRemote extends EJBObject{...}
                      
                      ...and:
                      
                      @Stateful
                      @Remote(StatefulRemote.class)
                      @RemoteBinding(jndiBinding = StatefulRemote.JNDI_NAME_REMOTE)
                      public class StatefulRemoteBean


                      ...from 1058 an invalid construct. "StatefulRemote" is here marked as remote business interface, but it extends EJBObject.

                      RemoteUnitTestCase.testEJBObject() is now passing.

                      Would like to:

                      * Close 1058 as invalid
                      * Open new issue: Construct in 1058 should result in deployment failure, citing spec 4.6.6.

                      Y/N?

                      S,
                      ALR



                      • 9. Re: When is there an EJBObject?
                        Andrew Rubinger Master

                        I've done the following:

                        "ALRubinger" wrote:
                        * Close 1058 as invalid
                        * Open new issue: Construct in 1058 should result in deployment failure, citing spec 4.6.6.


                        New issue:

                        http://jira.jboss.com/jira/browse/EJBTHREE-1071

                        S,
                        ALR