1 Reply Latest reply on Sep 28, 2012 6:49 AM by atiyou

    WebArchive - cannot inject bean from the same project

    Michał Kapłon Newbie

      I'm trying to run a test that builds WAR and injects two beans: Identity from Seam Security and my fancy HelloWorld. It looks like this:

           public static WebArchive buildWAR() {
                return webArchive().addFestAssertDependencies().addMockitoDependencies()
           @Inject Identity identity;
           @Inject HelloWorld helloWorld;
           public void should_inject_identity_bean() {

      WAR is created with custom builder which invokes MavenDependencyResolver. No magic there. It works fine, *.war package in target dir is correct. And it contains HelloWorld class.

      Example above puts HelloWorld into a small jar that is packaged together with other jars.


      The issue is that HelloWorld cannot be resolved as a bean. I'm getting the following deployment error:

      Caused by: org.jboss.arquillian.test.spi.ArquillianProxyException: org.jboss.weld.exceptions.DeploymentException : WELD-001408 Unsatisfied dependencies for type [HelloWorld] with qualifiers [@Default] at injection point [[field] @Inject pl.com.siso.idmconsole.DescribeBeanInjection.helloWorld] [Proxied because : Original exception not deserilizable, ClassNotFoundException]

      It doesn't change anything if HelloWorld is just POJO, @Named or annotated as @Stereotype. Error occurs also when bean is packaged as plain class, not in its own jar. Bean Manager is unable to find it, even though it is located inside a WAR package.

      When I remove it, Identity bean gets injected correctly and test is green.


      Test is green also when deployment is built as JavaArchive, but it is very hard then to setup all dependencies for some "bigger" beans (like Identity, for example).


      Why BeanManager cannot inject bean defined in the same project where test case is located?


      I'm using JBoss AS 7.1.0.Final with Arquillian 1.0.0.Final-SNAPSHOT connected via servletProtocol.

        • 1. Re: WebArchive - cannot inject bean from the same project
          atiyou Newbie


          I have the same problem when i try to build WebArchive and inject to my test class a simple bean..


          i'm using ShrinkWrap resolver 2.0.0-Apha-4 so i built my archive like this :

          File[] libs = Maven.resolver()






          anyone can help ?