3 Replies Latest reply on Feb 10, 2016 4:50 AM by Martin Kouba

    Injection of EJB's implementing an abstract class

    Christopher Finerty Newbie

      Hi all,

       

      I have run into an odd behavior moving between jboss-as 7.1.1 and wildfly 10.0.0.0. This involved a weld update 1.1.32->2.3.2 and an ejb update 3.1->3.2 . If i have interface A, abstract class B implements A and class C extends B and B is annotated @Stateless. As below.

      scenario 1:

      public interface A{
          void foo();
      }
      
      public abstract class B implements A{
          public void foo(){}
      }
      
      @Stateless
      public class C extends B{
      }
      

       

      When i inject A

      @Inject
      A a;
      

      I expect to get a proxy of the stateless bean C. This worked previously but now causes a WELD-001408: Unsatisfied dependencies for type A with qualifiers @Default.

      Without the abstract class, with the local annotation specifying the interface or with an explicit inheritance of the interface the injection works fine (scenarios 2,3,4 respectively).

      scenario 2:

      @Stateless
      public class C implements A{
          void foo(){}
      }
      

      scenario 3:

      @Stateless
      @Local(value = A.class)
      public class C extends B{
      }
      

      scenario 4:

      @Stateless
      public class C extends B implements A{
      }
      

      The error message is interesting, I would have expected an exception mentioning incorrect local EJB interface if the defaulting of EJB local interfaces had changed but the unsatisfied dependency implies an interplay between weld and the EJB provider (scenario 1 works when C is not an EJB) that I don't know about. Perhaps an issue in the EJB interface discovery where it doesn't traverse abstract classes. Could anyone explain this behavior before i make a bug report encase this is an intended change that i can't find a record of without understanding the cause.

       

      Thank you for any help or redirection to a more appropriate forum.