0 Replies Latest reply on Feb 1, 2013 1:14 PM by kelly goedert

    missing dependency

    kelly goedert Apprentice

      Hi,

       

      I successfully went through the arquillian.org guides. Now, while trying to write my first test for a real application that uses seam 3 + cdi I get the following error:

       

       

      {code}

      org.jboss.weld.exceptions.DeploymentException: WELD-001408 Unsatisfied dependencies for type [EntityManager] with qualifiers [@Default] at injection point [[field] @Inject protected com.sample.business.AbstractManagerBean.em]

           at org.jboss.weld.bootstrap.Validator.validateInjectionPoint(Validator.java:275)

           at org.jboss.weld.bootstrap.Validator.validateInjectionPoint(Validator.java:244)

           at org.jboss.weld.bootstrap.Validator.validateBean(Validator.java:107)

           at org.jboss.weld.bootstrap.Validator.validateRIBean(Validator.java:127)

           at org.jboss.weld.bootstrap.Validator.validateBeans(Validator.java:346)

           at org.jboss.weld.bootstrap.Validator.validateDeployment(Validator.java:331)

           at org.jboss.weld.bootstrap.WeldBootstrap.validateBeans(WeldBootstrap.java:366)

           at org.jboss.as.weld.WeldContainer.start(WeldContainer.java:83)

           at org.jboss.as.weld.services.WeldService.start(WeldService.java:76)

           at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811)

           at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746)

           at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)

           at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)

           at java.lang.Thread.run(Thread.java:662)

       

      {code}

       

      The class in the error:

       

       

      {code}

      public abstract class AbstractManagerBean<T extends AbstractEntity> implements Serializable, AbstractManagerBeanLocal<T>, AbstractManagerBeanRemote<T> {

       

       

                private static final long serialVersionUID = 1L;

       

                @Inject

                protected EntityManager em;

       

      {code}

       

      In my test class de deployment method is:

       

       

      @CreateSchema({ "create_database.sql" })

      @RunWith(Arquillian.class)

      public class UserManagerBeanTest {

       

       

                @Deployment

                public static Archive<?> createDeploymentPackage() {

                          MavenDependencyResolver resolver = DependencyResolvers.use(MavenDependencyResolver.class).loadMetadataFromPom("pom.xml");

       

       

                          return ShrinkWrap.create(WebArchive.class, "ejb.war").addPackage(User.class.getPackage()).addPackage(UserManagerBean.class.getPackage())

                                              .addPackage(Status.class.getPackage()).addPackage(CompanyDepartment.class.getPackage()).addPackage(RoleManagerBean.class.getPackage())

                                              .addPackage(RoleManagerBeanLocal.class.getPackage()).addPackage(LazyTimesheetDataModel.class.getPackage())

                                              .addAsLibraries(resolver.artifact("joda-time:joda-time").resolveAsFiles())

                                              .addAsLibraries(resolver.artifact("joda-time:joda-time-hibernate").resolveAsFiles())

                                              .addAsLibraries(resolver.artifact("org.glassfish:javax.faces").resolveAsFiles())

                                              .addAsLibraries(resolver.artifact("org.primefaces:primefaces").resolveAsFiles())

                                              .addAsLibraries(resolver.artifact("org.jboss.seam.security:seam-security").resolveAsFiles())

                                              .addAsLibraries(resolver.artifact("org.jboss.seam.faces:seam-faces").resolveAsFiles())

                                              .addAsLibraries(resolver.artifact("org.jboss.seam.persistence:seam-persistence").resolveAsFiles())

                                              .addAsLibraries(resolver.artifact("org.jboss.solder:solder-impl").resolveAsFiles())

                                              .addAsLibraries(resolver.artifact("org.jadira.usertype:usertype.core").resolveAsFiles()).addAsWebInfResource("test-beans.xml", "beans.xml")

                                              .addAsWebInfResource("jbossas-ds.xml").addAsResource("test-persistence.xml", "/META-INF/persistence.xml");

                }

       

       

                @Test

                public void findById() {

                          System.out.println("test");

                }

      }

       

       

      I am using arquillian 1.0.3.Final and a remote jbossas 7.1.1. If I comment out the @Inject annotation in my AbstractManagerBean the war is correctly deployed. Which depency am I missing on my test war?