4 Replies Latest reply on Aug 24, 2011 1:39 AM by Oliver Vesper

    Failure: @Resource injection into JSF-managed-bean

    Oliver Vesper Newbie



      I am trying to inject a ConnectionFactory via @Resource annotation into my JSF managed bean like the following:




      public class Foo implements Serializable {


        private ConnectionFactory connectionFactory; 



      Accessing an xhtml-page which is backed by above bean results in the following exception:


      Caused by: java.lang.IllegalArgumentException: No @Resource annotation found on injection point [field] @Resource private test.Foo.connectionFactory
      at org.jboss.weld.injection.spi.helpers.AbstractResourceServices.resolveResource(AbstractResourceServices.java:38)


      I debugged into this and actually do not understand what is going wrong as everything seems to look good (the attached screenshot from the eclipse-debugger should point out the issue). Inspecting the debug-variables I can see that my annotation is actually present BUT HashMap's getEntry-method does not find the one and only entry.


      Anybody got a clue what is going wrong here? The issue occurs with JBoss AS 6.0 and 6.1.


      One interesting point is the different "id" for the two class-objects (926 vs. 23818). Could this be the reason for the issue? Am I having a class-loading-problem or something releated?