0 Replies Latest reply on Nov 9, 2015 5:18 PM by cfillot

    EJB injection problem with Wildfly 9.0.x and Arquillian

    cfillot

      Hello,

       

      I use Arquillian for Integration Tests, and I intermittently get this kind of stacktrace:

       

      exportDatabase(fr.utc.dsi.evote.tests.VoteITCase)  Time elapsed: 0.023 sec  <<< ERROR!

      java.lang.RuntimeException: Could not inject members

          at org.jboss.arquillian.testenricher.cdi.CDIInjectionEnricher.injectClass(CDIInjectionEnricher.java:135)

          at org.jboss.arquillian.testenricher.cdi.CDIInjectionEnricher.enrich(CDIInjectionEnricher.java:78)

          at org.jboss.arquillian.test.impl.TestInstanceEnricher.enrich(TestInstanceEnricher.java:52)

          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

          at java.lang.reflect.Method.invoke(Method.java:497)

          at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94)

          at org.jboss.arquillian.core.impl.EventContextImpl.invokeObservers(EventContextImpl.java:99)

          at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:81)

          at org.jboss.arquillian.test.impl.TestContextHandler.createTestContext(TestContextHandler.java:130)

          at sun.reflect.GeneratedMethodAccessor85.invoke(Unknown Source)

          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

          at java.lang.reflect.Method.invoke(Method.java:497)

          at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94)

          at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88)

          at org.jboss.arquillian.test.impl.TestContextHandler.createClassContext(TestContextHandler.java:92)

          at sun.reflect.GeneratedMethodAccessor84.invoke(Unknown Source)

          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

          at java.lang.reflect.Method.invoke(Method.java:497)

          at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94)

      [...]

      Caused by: java.lang.IllegalArgumentException: Can not set fr.utc.dsi.evote.export.JarExportBean field fr.utc.dsi.evote.tests.AbstractITCase.exportBean to fr.utc.dsi.evote.tests.VoteITCase

          at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:167)

          at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:171)

          at sun.reflect.UnsafeFieldAccessorImpl.ensureObj(UnsafeFieldAccessorImpl.java:58)

          at sun.reflect.UnsafeObjectFieldAccessorImpl.set(UnsafeObjectFieldAccessorImpl.java:75)

          at java.lang.reflect.Field.set(Field.java:764)

          at org.jboss.weld.injection.FieldResourceInjection.injectMember(FieldResourceInjection.java:62)

          at org.jboss.weld.injection.AbstractResourceInjection.injectResourceReference(AbstractResourceInjection.java:53)

          at org.jboss.weld.util.Beans.injectEEFields(Beans.java:348)

          at org.jboss.weld.injection.producer.ResourceInjector$1.proceed(ResourceInjector.java:69)

          at org.jboss.weld.injection.InjectionContextImpl.run(InjectionContextImpl.java:48)

          at org.jboss.weld.injection.producer.ResourceInjector.inject(ResourceInjector.java:72)

       

      The EJB is declared like this in VoteITCase: @EJB JarExportBean exportBean;

      This error does not occur systematically - when the injection works the test runs fine.

      Before I try to make a reproducible simple testcase, has someone already seen this problem or has an idea on how to solve it ?

       

      Environment:

           - Wildfly 9.0.2 (also occurs with 9.0.1.Final)

           - Arquillian BOM 1.1.10.Final (also occurs with versions between 1.1.6.Final and 1.1.10.Finall)

           - org.wildfly.arquillian wildfly-arquillian-container-managed 1.0.1.Final

       

      I'm sorry if this is the wrong forum, I'm unable to determine if this is caused by Arquillian or the application server itself.

       

      Thanks,

       

      Christophe