5 Replies Latest reply on Jan 21, 2009 12:36 PM by Andrew Rubinger

    Migrating EJB3 Code from 4.2 to 5.0 and encountering  [JBMET

    Jim Riley Newbie

      I have developed a working EJB3 application in 4.2.2. When I try the applciation in 5.0.0 GA I get a annotation validation exception when loading the Session bean.

      I have created a very simple example and get the same problem. Can anyone explain what I am doing wrong.

      The interfaces EchoServiceRemote and EchoServiceLocal extend the same EchoService interface where the one method is defined.

      package com.echo;
      
      import javax.ejb.Local;
      import javax.ejb.Remote;
      import javax.ejb.Stateless;
      
      
      @Stateless( name="ejb/Echo")
      @Remote( EchoServiceRemote.class )
      @Local( EchoServiceLocal.class )
      public class EchoServiceBean implements EchoService{
      
      
       public String echo( String msg ) {
       return msg;
       }
      }
      



        • 1. Re: Migrating EJB3 Code from 4.2 to 5.0 and encountering  [J
          Jim Riley Newbie

          Opps ... with two different interfaces it is working

          • 2. Re: Migrating EJB3 Code from 4.2 to 5.0 and encountering  [J
            Andrew Rubinger Master

            Looks like the forum software chopped off the JIRA issue from your topic.

            What was the error? There's nothing wrong with that construct assuming:

            * There's no @Local or @Remote annotation on EchoService
            * EchoServiceRemote does not also extend from EJBObject
            * EchoServiceLocal does not also extend from EJBLocalObject

            S,
            ALR

            • 3. Re: Migrating EJB3 Code from 4.2 to 5.0 and encountering  [J
              Jim Riley Newbie

              I actually found the problem. It was caused by my ejb-jar.xml entries

              My entries were something like this:

              <?xml version="1.0" encoding="UTF-8"?>
              <ejb-jar version="3.0">
               <enterprise-beans>
               <session>
               <ejb-name>PropertyService</ejb-name>
               <remote>com.emageon.properties.service.PropertyService</remote>
               <ejb-class>
               com.emageon.properties.service.ejb.PropertyServiceBean
               </ejb-class>
               <session-type>Stateless</session-type>
               <transaction-type>Container</transaction-type>
               </session>
               </enterprise-beans>
              </ejb-jar>


              The tags need to be changed to <business-remote>. Here is the corrected content.

              <?xml version="1.0" encoding="UTF-8"?>
              <ejb-jar version="3.0">
              
               <enterprise-beans>
               <session>
               <ejb-name>PropertyService</ejb-name>
               <business-remote>com.emageon.properties.service.PropertyService</business-remote>
               <ejb-class>
               com.emageon.properties.service.ejb.PropertyServiceBean
               </ejb-class>
               <session-type>Stateless</session-type>
               <transaction-type>Container</transaction-type>
               </session>
               </enterprise-beans>
              </ejb-jar>
              



              • 4. Re: Migrating EJB3 Code from 4.2 to 5.0 and encountering  [J
                Jim Riley Newbie

                Sorry. This post has ended up a little confusing.

                [JBMETA-130] Was the error I got when trying to get EJB3 Session beans migrated from 4.2.x to 5.0.0 GA. In my case I was NOT trying to be EJB2.x compliant.

                If you have this problem, check these items:

                1. Make sure @Local and @Remote use a different interface.

                2. Make sure any beans referenced in ebj-jar.xml file use the <business-remote> tag instead of the and use <business-local> instead of

                • 5. Re: Migrating EJB3 Code from 4.2 to 5.0 and encountering  [J
                  Andrew Rubinger Master

                  Yep.

                  * @Remote references a business interface (EJB 3.x View)
                  * is a Remote Component interface (extends EJBObject, an EJB 2.x View)
                  * <business-remote> is the XML equivalent to @Remote
                  * There is no annotation for , we read it in via the return types of @Home create methods.

                  S,
                  ALR