arquillian failed to test ejb invoking ra
eskuai Jun 8, 2012 10:07 AMHello,
I am trying to test using arquillian some trivial ejb that invoke an outbound jca resouce ( jca shows a text)
I've created jca using ironjacamar and codegenerator, and the jboss as 7 server is in remote container moder.
now, the stacktrace is ...
16:03:13,073 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-7) MSC00001: Failed to start service jboss.deployment.unit."dd90a848-46fd-4920-8d82-3847fb86cbb8.jar".POST_MODULE: org.jboss.msc.service.StartException in service jboss.deployment.unit."dd90a848-46fd-4920-8d82-3847fb86cbb8.jar".POST_MODULE: Failed to process phase POST_MODULE of deployment "dd90a848-46fd-4920-8d82-3847fb86cbb8.jar"
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:119) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
Caused by: java.lang.RuntimeException: Error getting reflective information for class out.msg.HelloUserBean with ClassLoader ModuleClassLoader for Module "deployment.dd90a848-46fd-4920-8d82-3847fb86cbb8.jar:main" from Service Module Loader
... 5 more
Caused by: java.lang.NoClassDefFoundError: Lout/msg/MsgConnectionFactory;
Caused by: java.lang.ClassNotFoundException: out.msg.MsgConnectionFactory from [Module "deployment.dd90a848-46fd-4920-8d82-3847fb86cbb8.jar:main" from Service Module Loader]
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:190) [jboss-modules.jar:1.1.1.GA]
16:03:13,091 INFO [org.jboss.as.deployment.connector] (MSC service thread 1-7) JBAS010410: Unbound JCA ConnectionFactory [java:/eis/MsgConnectionFactory]
16:03:13,091 ERROR [org.jboss.msc.service] (MSC service thread 1-3) MSC00002: Invocation of listener "org.jboss.as.connector.deployers.processors.ParsedRaDeploymentProcessor$1@6e61a2e3" failed: java.lang.IllegalStateException: JBAS014812: An override model registration is not allowed for non-wildcard model registrations. This registration is for the non-wildcard name 'hello.rar'.
16:03:13,094 INFO [org.jboss.as.server.deployment] (MSC service thread 1-8) JBAS015877: Stopped deployment hello.rar in 3ms
....
Ok, my test
@RunWith(Arquillian.class)
public class ConnectorTestCase {
private static Logger log = Logger.getLogger("ConnectorTestCase");
private static String deploymentName = "hello";
@Deployment(order = 1, name = "dep1")
public static JavaArchive createDeployment1() {
return ShrinkWrap.create(JavaArchive.class)
.addClasses(HelloUser.class, HelloUserBean.class)
.addClasses(MsgResourceAdapter.class,
MsgManagedConnectionFactory.class, MsgManagedConnection.class,
MsgConnectionFactory.class, MsgConnectionFactoryImpl.class,
MsgConnection.class, MsgConnectionImpl.class)
.addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml");
}
@EJB
HelloUser ref;
@Test
public void should_create_greeting() {
System.out.println("-->" + ref.sayHello("name"));
}
@Deployment(order = 2, name = "dep2")
public static ResourceAdapterArchive createDeployment2() {
ResourceAdapterArchive raa = ShrinkWrap.create(
ResourceAdapterArchive.class, deploymentName + ".rar");
JavaArchive ja = ShrinkWrap.create(JavaArchive.class, UUID.randomUUID()
.toString() + ".jar");
ja.addClasses(MsgResourceAdapter.class,
MsgManagedConnectionFactory.class, MsgManagedConnection.class,
MsgConnectionFactory.class, MsgConnectionFactoryImpl.class,
MsgConnection.class, MsgConnectionImpl.class);
raa.addAsLibrary(ja);
raa.addAsManifestResource("META-INF/ironjacamar.xml", "ironjacamar.xml");
return raa;
}
i got a questions ...
if i need deploy many elemets, which is the order to do it ? for example
if a ejb needs a resource adapter ... which deploy first? ejb o rar ?
do i need to include into the ejb jar the rar classes ?
thank you
,