5 Replies Latest reply on Nov 10, 2008 5:01 AM by Tom Iten

    EJB2 Client calling EJB3 Bean

    Tom Iten Newbie

      Hello everybody

      I'm trying to run an EJB2 Client against an EJB3 SLSB, delivering the client
      an EJB2 Home interface with the usage of the @RemoteHome annotation.

      With JBoss 4.2.2.GA the sample is working fine, with JBoss 5.0.0.CR2 i'm
      getting the following Message during the deploy:

      java.lang.IllegalStateException: EJB 3.0 Core Specification Violation (4.6.7):
      The session bean remote interface interface ... must extend the javax.ejb.EJBObject interface.


      Remote Interface:

      @Remote
      public interface EJB3Remote {
      
       public String echo(String message);
      
      }
      



      Home Interface:
      public interface EJB3Home extends EJBHome {
      
       public EJB3Remote create() throws CreateException, RemoteException;
      
      }
      



      Bean:
      @Stateless
      @RemoteHome(EJB3Home.class)
      public class EJB3Bean implements EJB3Remote {
      
       public String echo(String message) {
      
       return "echo from EJB3 Bean <" + message + ">";
       }
      }
      


      Thanks for any help.
      Tom


        • 1. Re: EJB2 Client calling EJB3 Bean
          jaikiran pai Master

           

          "tom.iten@gmx.net" wrote:

          java.lang.IllegalStateException: EJB 3.0 Core Specification Violation (4.6.7):The session bean remote interface interface ... must extend the javax.ejb.EJBObject interface.


          As noted in the error message, the 4.6.7 section of the spec mentions that the EJB2.x remote interface should extend from javax.ejb.EJBObject. So you will have to change it to:

          Remote Interface:
          @Remote
          public interface EJB3Remote extends javax.ejb.EJBObject {
          
           public String echo(String message);
          
          }
          




          • 2. Re: EJB2 Client calling EJB3 Bean
            Tom Iten Newbie

            Hi jaikiran

            - I changed the remote interface according the Error Message

            - Removed the "implements EJB3Remote" clause from the Bean
            (so i do not have to implement all the callbacks in EJB2.x manner)

            After this changes i got a Exception during the deploy:

            13:13:33,564 ERROR [AbstractKernelController] Error installing to Start: name=jboss.j2ee:ear=ejb2clienttoejb3.ear,jar=ejb2clienttoejb3-ejb.jar,name=EJB3Bean,ser
            vice=EJB3 state=Create
            java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
            at java.util.ArrayList.RangeCheck(ArrayList.java:546)
            at java.util.ArrayList.get(ArrayList.java:321)
            at org.jboss.ejb3.proxy.jndiregistrar.JndiSessionRegistrarBase.createJndiReferenceBindingSet(JndiSessionRegistrarBase.java:222)
            at org.jboss.ejb3.proxy.jndiregistrar.JndiSessionRegistrarBase.bindEjb(JndiSessionRegistrarBase.java:162)


            By delivering a jboss.xml descriptor file with the jndi home interface name
            i could run the sample. Thanks!

            best regards
            Tom

            • 3. Re: EJB2 Client calling EJB3 Bean
              Andrew Rubinger Master

              Because @Remote denotes a "Business Remote" interface, ie. an EJB3 view.

              This is confusing because the XML element "remote" is a "Remote Component" interface ie. an EJB2.x view.

              So while using annotations, you don't specify the remote component interface at all; we'll read it in from the return types of "create" methods in EJB2.x Home.

              S,
              ALR

              • 4. Re: EJB2 Client calling EJB3 Bean
                Andrew Rubinger Master

                Actually, in this case you could use some help with the error message.

                If you provide the failing case in a JIRA for JBMETA project and assign to me, I'll make sure you get back a clear indication of what's wrong via the new ValidationChain we've put in place.

                S,
                ALR

                • 5. Re: EJB2 Client calling EJB3 Bean
                  Tom Iten Newbie


                  Hello Andrew

                  The case is provided as JIRA : EJBTHREE-1574

                  Best Regards
                  Tom