Uploaded image for project: 'Application Server 3  4  5 and 6'
  1. Application Server 3 4 5 and 6
  2. JBAS-8868

Incorrect setter picked up for resource injection

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 6.1.0
    • 6.0.0.Final
    • Integration
    • None

      If a resource injection target contains the following piece of code:

      @Stateless
      public class BugResourceBean implements BugResourceLocal {
      
                @EJB
                private CreateLocal create;
      
                public String create() {
                          return "ok";
                }
      }
      

      during injection, instead of injecting into the field, jboss-injection tries to incorrectly inject in the method leading to an exception:

      Caused by: java.lang.IllegalArgumentException: failed to set value Proxy to jboss.j2ee:ear=alexandria-ear-0.3.4-SNAPSHOT.ear,jar=alexandria-ejb-0.3.4-SNAPSHOT.jar,name=CreateBean,service=EJB3 implementing [interface com.unifiedpost.alexandria.ejb.CreateLocal] with setter public java.lang.String com.unifiedpost.alexandria.rest.resource.service.BugResourceBean.create()
                at org.jboss.injection.injector.util.MethodInjectionPoint.set(MethodInjectionPoint.java:66) [:1.0.0-alpha-6]
                at org.jboss.injection.injector.EEInjector.inject(EEInjector.java:159) [:1.0.0-alpha-6]
                at org.jboss.injection.injector.EEInjector.inject(EEInjector.java:134) [:1.0.0-alpha-6]
                at org.jboss.injection.injector.EEInjector.inject(EEInjector.java:82) [:1.0.0-alpha-6]
      

      Please see the referenced forum thread for the complete details.

              jaikiran Jaikiran Pai (Inactive)
              jaikiran Jaikiran Pai (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: