2 Replies Latest reply on Aug 27, 2014 9:08 PM by meetoblivion

    Injection of Validator in AS7 vs WildFly 8.1

    meetoblivion

      Recently, I ported an application from AS7.1.1 to WildFly 8.1.  Everything worked fine except for Bean Validation injection.  For some reason, in AS7, this worked fine:

       

      @Inject

      private Validator validator;

       

      In WildFly this didn't work.  Based on docs, this should have worked:

       

      @Resource

      private Validator validator;

       

      with a failure saying that there was no such name  com.mycompany.MyBean/validator.  Overriding to @Resource(lookup="java:comp/Validator") worked fine.

       

      Is @Inject supposed to work for Validators in WildFly 8.1?

        • 1. Re: Injection of Validator in AS7 vs WildFly 8.1
          jaikiran

          I'm not sure what's failing. Are you saying @Resource injection of Validator is failing or @Inject of the Validator? Also can you please post the relevant class and the exception/error logs?

          • 2. Re: Injection of Validator in AS7 vs WildFly 8.1
            meetoblivion

            I think it might be even simpler than I originally stated.

             

            Take a look at ValidatorTest in this git repo: https://github.com/johnament/hornetq-jms-issue

             

            The expected result is that the validator interceptor is wrapped around ValidatingSLSB because the method is annotated @NotNull for the input argument.  What happens in WildFly 8.1 is that I get

             

            Caused by: org.jboss.arquillian.test.spi.ArquillianProxyException: org.jboss.weld.exceptions.IllegalArgumentException : WELD-001456: Argument bean must not be null [Proxied because : Original exception caused: class java.lang.ClassNotFoundException: org.jboss.weld.exceptions.IllegalArgumentException]