Arquillian configuration with Glassfish v3 remote
wamouk Nov 9, 2010 6:07 AMAs in the arquillian documentation described I have created an eclipse project and configured maven to write tests for a j2ee project.
In the test project:
src/test/resources -> jndi.properties:
java.naming.factory.initial=com.sun.enterprise.naming.SerialInitContextFactory
java.naming.factory.url.pkgs=com.sun.enterprise.naming
java.naming.factory.state=com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl
org.omg.CORBA.ORBInitialHost=localhost
org.omg.CORBA.ORBInitialPort=3700
in root arquillian.xml:
<?xml version="1.0" encoding="UTF-8"?>
<arquillian xmlns="http://jboss.com/arquillian"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:glassfish="urn:arq:org.jboss.arquillian.container.glassfish.remote_3">
<glassfish:container>
<glassfish:remoteServerAddress>192.168.1.99</glassfish:remoteServerAddress>
<glassfish:remoteServerHttpPort>8080</glassfish:remoteServerHttpPort>
<glassfish:deploymentUri>deployer:Sun:AppServer::localhost:4848</glassfish:deploymentUri>
<glassfish:deploymentUsername>user</glassfish:deploymentUsername>
<glassfish:deploymentPassword>password</glassfish:deploymentPassword>
</glassfish:container>
</arquillian>
included into the projects pom-file:
<properties>
<arquillian.version>1.0.0.Alpha4</arquillian.version>
</properties>
<dependency>
<groupId>org.glassfish</groupId>
<artifactId>javax.ejb</artifactId>
<version>3.1-b21</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.8.1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>javax.enterprise</groupId>
<artifactId>cdi-api</artifactId>
<version>1.0-SP1</version>
</dependency>
<dependency>
<groupId>org.jboss.arquillian</groupId>
<artifactId>arquillian-junit</artifactId>
<version>${arquillian.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.arquillian.container</groupId>
<artifactId>arquillian-glassfish-remote-3</artifactId>
<version>${arquillian.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.glassfish.deployment</groupId>
<artifactId>deployment-client</artifactId>
<version>3.0.1-b19</version>
<scope>test</scope>
</dependency>
I am executing the following test:
@RunWith(Arquillian.class)
public class Test_PatientDao_arquillian {
@EJB
private PatientDao patientDao;
@Deployment
public static JavaArchive createTestArchive() {
return ShrinkWrap.create(JavaArchive.class, "test.jar")
.addClasses(Patient.class);
}
@Before
public void setUp() {
Test_Util.setProperties(this.properties);
Test_Util.startImporterTest(this.properties);
}
@After
public void shutDown() {
Test_Util.cleanTables(this.properties);
}
@Test
public void test_findPatient() {
Patient patient = this.patientDao.findPatient();
Assert.assertNotNull(patientDao);
Assert.assertNotNull(patient);
}
}
The problem is that I keep getting the following error message:
org.jboss.arquillian.impl.event.FiredEventException: org.jboss.arquillian.spi.DeploymentException: Could not deploy archive
at org.jboss.arquillian.impl.event.MapEventManager.fire(MapEventManager.java:68)
at org.jboss.arquillian.impl.context.AbstractEventContext.fire(AbstractEventContext.java:115)
at org.jboss.arquillian.impl.EventTestRunnerAdaptor.beforeClass(EventTestRunnerAdaptor.java:96)
at org.jboss.arquillian.junit.Arquillian$2.evaluate(Arquillian.java:162)
at org.jboss.arquillian.junit.Arquillian$3$1.evaluate(Arquillian.java:186)
at org.jboss.arquillian.junit.Arquillian$MultiStatementExecutor.execute(Arquillian.java:297)
at org.jboss.arquillian.junit.Arquillian$3.evaluate(Arquillian.java:182)
at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
at org.jboss.arquillian.junit.Arquillian.run(Arquillian.java:127)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:49)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Caused by: org.jboss.arquillian.spi.DeploymentException: Could not deploy archive
at org.jboss.arquillian.container.jsr88.remote_1_2.JSR88RemoteContainer.deploy(JSR88RemoteContainer.java:146)
at org.jboss.arquillian.container.glassfish.remote_3.GlassFishJSR88RemoteContainer.deploy(GlassFishJSR88RemoteContainer.java:63)
at org.jboss.arquillian.impl.handler.ContainerDeployer.callback(ContainerDeployer.java:62)
at org.jboss.arquillian.impl.handler.ContainerDeployer.callback(ContainerDeployer.java:50)
at org.jboss.arquillian.impl.event.MapEventManager.fire(MapEventManager.java:63)
... 14 more
Caused by: java.lang.IllegalStateException: error submitting remote command
at org.glassfish.deployapi.SunDeploymentManager.getTargets(SunDeploymentManager.java:166)
at org.jboss.arquillian.container.jsr88.remote_1_2.JSR88RemoteContainer.deploy(JSR88RemoteContainer.java:135)
... 18 more
Caused by: java.lang.RuntimeException: error submitting remote command
at org.glassfish.deployment.client.AbstractDeploymentFacility.listTargets(AbstractDeploymentFacility.java:637)
at org.glassfish.deployapi.SunDeploymentManager.getTargets(SunDeploymentManager.java:164)
... 19 more
Caused by: java.lang.RuntimeException: com.sun.enterprise.admin.cli.AuthenticationException: Authentication failed for user: admin
(Usually, this means invalid user name and/or password)
at org.glassfish.deployment.client.RemoteDeploymentFacility$RemoteCommandRunner.run(RemoteDeploymentFacility.java:117)
at org.glassfish.deployment.client.AbstractDeploymentFacility.listTargets(AbstractDeploymentFacility.java:604)
... 20 more
Caused by: com.sun.enterprise.admin.cli.AuthenticationException: Authentication failed for user: admin
(Usually, this means invalid user name and/or password)
at com.sun.enterprise.admin.cli.remote.RemoteCommand.doHttpCommand(RemoteCommand.java:558)
at com.sun.enterprise.admin.cli.remote.RemoteCommand.fetchCommandMetadata(RemoteCommand.java:790)
at com.sun.enterprise.admin.cli.remote.RemoteCommand.prepare(RemoteCommand.java:209)
at com.sun.enterprise.admin.cli.CLICommand.execute(CLICommand.java:244)
at org.glassfish.deployment.client.RemoteDeploymentFacility$RemoteCommandRunner.run(RemoteDeploymentFacility.java:113)
... 21 more
Any help would be appreciated!