1 Reply Latest reply on Nov 21, 2016 12:29 AM by jaikiran

    ejb3's not injected: how to debug?  (switching from ejb 2.1 to 3)

    milspec

      Hi all,

       

      I know this is a unfashionable topic ('circa 2006'), but we've just started switching our ejb 2.1 to ejb3's. File under "T" (or "D") for Technical Debt.

       

      Context

      The application runs fine on Wildfly 10.1 using ejb 2.1 infrastructure. I've used Intellij ejb 3 migrator and  info on this article

      Migrating EJB 2.1 Entity and Session Beans to EJB 3.0 • The Register  as well as a few jboss tutorials.

       

      The immediate problem:

      • annotation-declared EJB does not seem to deploy (or at least I don't see evidence the server.log)
      • EJB is not injected in the client class

       

      My Questions

      • How do I got about debugging 'null annotations'?
      • On what classes does jboss/wildfly process annotations?
      • I wanted to double check: if I define the ejb3 via annotation, i do not need an entry in jboss-ejb3.xml

       

      thanks

       

      Code: EJB

       

      @Stateless(name = "PostService")

      @Remote(IPostService.class)

      @TransactionManagement(TransactionManagementType.BEAN)

      public class PostServiceEJB

       

      Code: Client

      /**

      * Used to inject Post Service

      */

      private static class PostServiceHelper

      {

         @EJB  (name="PostService")

         PostServiceEJB fPostServiceEJB;

         {

         return fPostServiceEJB;

          }

      }

       

       

       

       

       

       

        • 1. Re: ejb3's not injected: how to debug?  (switching from ejb 2.1 to 3)
          jaikiran

          What does your application packaging look like? Do you have a ejb-jar.xml (it's not mandatory)? If yes, then what does the XSD declaration for it look like? What version of EJB does it say the application is?

           

          milspec wrote:

           

           

          Code: Client

          /**

          * Used to inject Post Service

          */

          private static class PostServiceHelper

          {

          @EJB (name="PostService")

          PostServiceEJB fPostServiceEJB;

          {

          return fPostServiceEJB;

          }

          }

           

           

           

           

           

           

          Injection is only supported in container managed component classes. This class doesn't look like one, so it won't be supported here.