Arquillian Inject: test.war_WeldBootstrapBean" (should be in state "Create", but is actually in state "**ERROR**")
dandii Dec 27, 2010 8:27 AMHi,
I would like to test an entity AppInstitute and my AppInstituteHome. Due to the reason, that these are my first steps using Arquillian I started with a small test case using JUnit. Both tests are working fine!
btw: I am using JBoss 6.0.0.20101110-CR1.
@RunWith(Arquillian.class) public class AppInstituteTest { @Deployment public static JavaArchive createTestArchive() { return ShrinkWrap.create(JavaArchive.class, "test.jar") .addPackages(true, AppInstitute.class.getPackage(), BaseEntity.class.getPackage()) .addManifestResource(EmptyAsset.INSTANCE, ArchivePaths.create("beans.xml")); } private String name = "name"; @Inject AppInstitute institute; @Test public void simpleTest() { AppInstitute i = new AppInstitute(); i.setName(name); assertEquals(name, i.getName()); } @Test public void injectionTest() { institute.setName(name); assertEquals(name, institute.getName()); } }
By testing the AppInstituteHome class the simpleTest() works pretty fine, but in the method injectionTest() produces the following stack:
1 [main] ERROR org.jboss.jbossas.servermanager.Server - MbeanException org.jboss.deployment.DeploymentException: Failed to deploy: file:/../myproject/test.war at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:393) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:157) at org.jboss.mx.server.Invocation.dispatch(Invocation.java:96) at org.jboss.mx.server.Invocation.invoke(Invocation.java:88) at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:271) at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:670) at org.jboss.system.server.jmx.MBeanServerWrapper.invoke(MBeanServerWrapper.java:138) at javax.management.remote.rmi.RMIConnectionImpl.doOperation(RMIConnectionImpl.java:1427) at javax.management.remote.rmi.RMIConnectionImpl.access$200(RMIConnectionImpl.java:72) at javax.management.remote.rmi.RMIConnectionImpl$PrivilegedOperation.run(RMIConnectionImpl.java:1265) at javax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation(RMIConnectionImpl.java:1360) at javax.management.remote.rmi.RMIConnectionImpl.invoke(RMIConnectionImpl.java:788) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:305) at sun.rmi.transport.Transport$1.run(Transport.java:159) at java.security.AccessController.doPrivileged(Native Method) at sun.rmi.transport.Transport.serviceCall(Transport.java:155) at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:535) at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:790) at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:649) 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) Caused by: org.jboss.deployers.client.spi.IncompleteDeploymentException: Summary of incomplete deployments (SEE PREVIOUS ERRORS FOR DETAILS): DEPLOYMENTS MISSING DEPENDENCIES: Deployment "jboss.web.deployment:war=/test" is missing the following dependencies: Dependency "vfs:///../myproject/test.war_WeldBootstrapBean" (should be in state "Create", but is actually in state "**ERROR**") Deployment "vfs:///../myproject/test.war_WBInjector" is missing the following dependencies: Dependency "vfs:///../myproject/test.war_WeldBootstrapBean" (should be in state "Installed", but is actually in state "**ERROR**") DEPLOYMENTS IN ERROR: Deployment "vfs:///../myproject/test.war_WeldBootstrapBean" is in error due to the following reason(s): java.lang.ClassNotFoundException: org.jboss.seam.security.Identity from BaseClassLoader@9be2c6f {vfs:///../myproject/test.war}, **ERROR** at org.jboss.deployers.plugins.deployers.DeployersImpl.checkComplete(DeployersImpl.java:1370) at org.jboss.deployers.plugins.deployers.DeployersImpl.checkComplete(DeployersImpl.java:1316) at org.jboss.deployers.plugins.main.MainDeployerImpl.checkComplete(MainDeployerImpl.java:968) at org.jboss.deployers.plugins.main.MainDeployerImpl.checkComplete(MainDeployerImpl.java:957) at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:383) ... 29 more
You see that Arquillian is missing the class org.jboss.seam.security.Identiy or the dependency "vfs:///../myproject/test.war_WeldBootstrapBean" is in **ERROR**.
Here my testing class:
@RunWith(Arquillian.class) public class AppInstituteHomeTest { @Deployment public static JavaArchive createTestArchive() { return ShrinkWrap.create(JavaArchive.class, "test.jar") .addPackages(true, AppInstitute.class.getPackage(), BaseEntity.class.getPackage()) .addPackages(true, AppInstituteHome.class.getPackage(), EntityHome.class.getPackage(), MutableController.class.getPackage()) .addPackages(true, EntityNotFoundException.class.getPackage()) .addPackages(true, ConversationManager.class.getPackage()) .addPackages(true, AppInstituteList.class.getPackage(), EntityList.class.getPackage()) .addManifestResource(EmptyAsset.INSTANCE, ArchivePaths.create("beans.xml")); } private String name = "name"; private String location = "location"; private String adr_street = "Street"; private Integer adr_postcode = new Integer(1234); private String url = "http://www.jboss.org"; private Long id = new Long(13); @Inject AppInstituteHome instituteHome; @Test public void simpleTest() { AppInstitute inst = new AppInstitute(name, location, adr_street, adr_postcode, url); assertEquals(name, inst.getName()); } @Test public void injectionTest() { instituteHome.setId(id); assertEquals(id, instituteHome.getId()); } }
How can I test my AppInstituteHome??