5 Replies Latest reply on Oct 21, 2016 12:45 PM by Laird Nelson

    WELD-001456: Argument resolvedBean must not be null?

    Laird Nelson Apprentice

      Hello; I'm using Weld 3.0.0 Alpha17 (using it in a unit test, so Weld SE, if it matters).

       

      I have a @Produces method annotated like this:

       

      @Produces

      @Dependent

      @Foo

      public String getFoo(final InjectionPoint ip) {

         // go get a relevant foo, or not

        return null; // this is permitted if the producer method is annotated with @Dependent, right?

      }

       

      When I do something like this:

       

      public class Frob {

         @Inject

         public Frob(@Foo("argle") final String foo) {

           // note: @Foo is a qualifier; its value() element is annotated with @Nonbinding

           super();

         }

      }

       

      ...the injection fails with the following partial stack:

       

      org.jboss.weld.exceptions.IllegalArgumentException: WELD-001456: Argument resolvedBean must not be null

        at org.jboss.weld.util.Preconditions.checkArgumentNotNull(Preconditions.java:40)

        at org.jboss.weld.manager.BeanManagerImpl.getInjectableReference(BeanManagerImpl.java:744)

        at org.jboss.weld.injection.ParameterInjectionPointImpl.getValueToInject(ParameterInjectionPointImpl.java:76)

        at org.jboss.weld.injection.ConstructorInjectionPoint.getParameterValues(ConstructorInjectionPoint.java:150)

        at org.jboss.weld.injection.ConstructorInjectionPoint.newInstance(ConstructorInjectionPoint.java:75)

        at org.jboss.weld.injection.producer.AbstractInstantiator.newInstance(AbstractInstantiator.java:28)

        at org.jboss.weld.injection.producer.BasicInjectionTarget.produce(BasicInjectionTarget.java:112)

        at org.jboss.weld.injection.producer.BeanInjectionTarget.produce(BeanInjectionTarget.java:180)

       

      I'm sure I have missed something obvious.  What?