0
votes

I install JBoss Tools plugin at my Eclipse IDE and create project as New > JBoss Central > Java EE EAR Project. I used Wildfly 8.2.0.Final server. EJB module of my project template is as below

enter image description here

Dependencies of Arquillian for my project are created by project template and I didn't modify anythings. And then I created my first test class as

@RunWith(Arquillian.class)
public class CustomerServiceTest {
    @Inject
    private CustomerDao customerDao;

    @Deployment
    public static Archive<?> createDeployment() {

    JavaArchive archive = ShrinkWrap.create(JavaArchive.class, "test.jar")
        .addAsResource("META-INF/test-persistence.xml","META-INF/persistence.xml")
        .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml");
    archive.addClass(CustomerDto.class);
    archive.addClass(Customer.class);
    archive.addClass(CustomerDao.class);
    archive.addClass(Dao.class);

    System.out.println(archive.toString(true));
    return archive;
    }

    @Test
    public void getCustomers() {
    // customerDao Always Null
    System.out.println("############# Testing Success ##################"+ customerDao);
    }
}

Here is console log

10:39:19,578 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-7) MSC000001: Failed to start service jboss.deployment.unit."test.war".WeldStartService: org.jboss.msc.service.StartException in service jboss.deployment.unit."test.war".WeldStartService: Failed to start service
    at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1904) [jboss-msc-1.2.2.Final.jar:1.2.2.Final]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [rt.jar:1.8.0_40]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [rt.jar:1.8.0_40]
    at java.lang.Thread.run(Thread.java:745) [rt.jar:1.8.0_40]
Caused by: org.jboss.weld.exceptions.DeploymentException: WELD-001408: Unsatisfied dependencies for type CustomerDao with qualifiers @Default
  at injection point [BackedAnnotatedField] @Inject private com.solt.hms.customer.CustomerServiceTest.customerDao
  at com.solt.hms.customer.CustomerServiceTest.customerDao(CustomerServiceTest.java:0)

    at org.jboss.weld.bootstrap.Validator.validateInjectionPointForDeploymentProblems(Validator.java:372)
    at org.jboss.weld.bootstrap.Validator.validateInjectionPoint(Validator.java:293)
    at org.jboss.weld.bootstrap.Validator.validateGeneralBean(Validator.java:134)
    at org.jboss.weld.bootstrap.Validator.validateRIBean(Validator.java:167)
    at org.jboss.weld.bootstrap.Validator.validateBean(Validator.java:531)
    at org.jboss.weld.bootstrap.ConcurrentValidator$1.doWork(ConcurrentValidator.java:68)
    at org.jboss.weld.bootstrap.ConcurrentValidator$1.doWork(ConcurrentValidator.java:66)
    at org.jboss.weld.executor.IterativeWorkerTaskFactory$1.call(IterativeWorkerTaskFactory.java:60)
    at org.jboss.weld.executor.IterativeWorkerTaskFactory$1.call(IterativeWorkerTaskFactory.java:53)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266) [rt.jar:1.8.0_40]
    ... 3 more

10:39:19,578 ERROR [org.jboss.as.controller.management-operation] (management-handler-thread - 1) JBAS014613: Operation ("deploy") failed - address: ([("deployment" => "test.war")]) - failure description: {"JBAS014671: Failed services" => {"jboss.deployment.unit.\"test.war\".WeldStartService" => "org.jboss.msc.service.StartException in service jboss.deployment.unit.\"test.war\".WeldStartService: Failed to start service
    Caused by: org.jboss.weld.exceptions.DeploymentException: WELD-001408: Unsatisfied dependencies for type CustomerDao with qualifiers @Default
  at injection point [BackedAnnotatedField] @Inject private com.solt.hms.customer.CustomerServiceTest.customerDao
  at com.solt.hms.customer.CustomerServiceTest.customerDao(CustomerServiceTest.java:0)
"}}
10:39:19,578 ERROR [org.jboss.as.server] (management-handler-thread - 1) JBAS015870: Deploy of deployment "test.war" was rolled back with the following failure message: 
{"JBAS014671: Failed services" => {"jboss.deployment.unit.\"test.war\".WeldStartService" => "org.jboss.msc.service.StartException in service jboss.deployment.unit.\"test.war\".WeldStartService: Failed to start service
    Caused by: org.jboss.weld.exceptions.DeploymentException: WELD-001408: Unsatisfied dependencies for type CustomerDao with qualifiers @Default
  at injection point [BackedAnnotatedField] @Inject private com.mycom.project.customer.CustomerServiceTest.customerDao
  at com.mycom.project.customer.CustomerServiceTest.customerDao(CustomerServiceTest.java:0)
"}}

I am totally a newbie in testing with Arquillian. I find and study many examples for Arquillian testing examples. These seems fine but what's wrong with mine ? Thanks for reading my question . Be happy with helping a newbie.

1
The error message suggests that JBoss was unable to create an instance of CustomerDao. The most likely reason for this is one or more missing dependencies. Does this class do any logging? If so then you need to add the logging library that you use (unless it's java.util.logging based). - Steve C
@SteveC Thanks you for your comment sir. My class CustomerDaois just simple interface and it's implementation CustomerDaoImpl does DAO management activities. Both classes do not have any logging sir. - Cataclysm
Where is your archive.addClass(CustomerDaoImpl.class);? - Steve C
Arrrr.... Thank you sir ! I forgot it. After insert it ,my program works fine sir. Thank you for your valuable times. - Cataclysm

1 Answers

1
votes

The error message suggests that JBoss was unable to create an instance of CustomerDao. The most likely reason for this is one or more missing dependencies.

Perhaps you need to add:

archive.addClass(CustomerDaoImpl.class);