2 Replies Latest reply: Jan 6, 2011 10:22 AM by Alphonse Bendt RSS

is it possible to use jboss managed 5.1 and the ServiceBindingManager?

Alphonse Bendt Newbie

Hi all,

 

we're trying to setup an arquillian project that uses the managed jboss AS 5.1 container to start the server. to avoid port conflicts with other integration tests that may run concurrently on the same machine we want to use the JBoss ServiceBindingManager (http://community.jboss.org/wiki/ServiceBindingManager) to change the default ports the AS uses.

 

This is how we setup arquillian.xml:

 

</arquill<arquillian xmlns="http://jboss.com/arquillian"
            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
            xmlns:jboss="urn:arq:org.jboss.arquillian.container.jbossas.managed_5_1">

    <engine>
        <deploymentExportPath>target/</deploymentExportPath>
    </engine>

    <!-- Konfiguration für JBossAS Managed Container -->
    <jboss:container>

        <jboss:jbossHome>target/GateIn-3.1.0-GA</jboss:jbossHome>
        <jboss:javaHome>${java.home}</jboss:javaHome>
        <jboss:profileName>sp</jboss:profileName>
        <jboss:bindAddress>127.0.0.1</jboss:bindAddress>
        <jboss:httpPort>8380</jboss:httpPort>
        <jboss:javaVmArguments>-Djboss.service.binding.set=ports-03 -Xmx1024M -XX:MaxPermSize=256M</jboss:javaVmArguments>
    </jboss:container>

</arquillian>

 

 

 

As described here http://docs.jboss.org/arquillian/reference/latest/en-US/html_single/#d0e525 we set up a file jndi.properties with the adapted jndi port:

 

 

 

jndi.properties

 

 

java.naming.provider.url=jnp://localhost:1399

...

 

 

 

 

 

Unfortunately the test execution fails. Arquillian is unable to deploy into the AS and/or shutdown the AS properly. Looking at the Error Message it looks like Arquillian is still trying to use the default JNDI port 1099:

 

 

 

org.jboss.arquillian.impl.event.FiredEventException: org.jboss.arquillian.spi.DeploymentException: Could not deploy test.ear
 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:78)
 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.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:59)
 at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(AbstractDirectoryTestSuite.java:120)
 at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(AbstractDirectoryTestSuite.java:103)
 at org.apache.maven.surefire.Surefire.run(Surefire.java:169)
 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.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:350)
 at org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:1021)
Caused by: org.jboss.arquillian.spi.DeploymentException: Could not deploy test.ear
 at org.jboss.arquillian.container.jbossas.managed_5_1.JBossASLocalContainer.deploy(JBossASLocalContainer.java:146)
 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)
 ... 18 more
Caused by: javax.naming.CommunicationException: Could not obtain connection to any of these urls: 127.0.0.1:1099 [Root exception is javax.naming.CommunicationException: Failed to connect to server /127.0.0.1:1099 [Root exception is javax.naming.ServiceUnavailableException: Failed to connect to server /127.0.0.1:1099 [Root exception is java.net.ConnectException: Connection refused: connect]]]
 at org.jnp.interfaces.NamingContext.checkRef(NamingContext.java:1772)
 at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:695)
 at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:688)
 at javax.naming.InitialContext.lookup(InitialContext.java:392)
 at org.jboss.jbossas.servermanager.Server.getServerConnection(Server.java:660)
 at org.jboss.jbossas.servermanager.Server.invoke(Server.java:900)
 at org.jboss.jbossas.servermanager.Server.deploy(Server.java:847)
 at org.jboss.arquillian.container.jbossas.managed_5_1.JBossASLocalContainer.deploy(JBossASLocalContainer.java:142)
 ... 21 more
Caused by: javax.naming.CommunicationException: Failed to connect to server /127.0.0.1:1099 [Root exception is javax.naming.ServiceUnavailableException: Failed to connect to server /127.0.0.1:1099 [Root exception is java.net.ConnectException: Connection refused: connect]]
 at org.jnp.interfaces.NamingContext.getServer(NamingContext.java:337)
 at org.jnp.interfaces.NamingContext.checkRef(NamingContext.java:1738)
 ... 28 more
Caused by: javax.naming.ServiceUnavailableException: Failed to connect to server /127.0.0.1:1099 [Root exception is java.net.ConnectException: Connection refused: connect]
 at org.jnp.interfaces.NamingContext.getServer(NamingContext.java:307)
 ... 29 more
Caused by: java.net.ConnectException: Connection refused: connect
 at java.net.PlainSocketImpl.socketConnect(Native Method)
 at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
 at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
 at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
 at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
 at java.net.Socket.connect(Socket.java:529)
 at org.jnp.interfaces.TimedSocketFactory.createSocket(TimedSocketFactory.java:97)
 at org.jnp.interfaces.TimedSocketFactory.createSocket(TimedSocketFactory.java:82)
 at org.jnp.interfaces.NamingContext.getServer(NamingContext.java:303)
 ... 29 more 

 

 

 

What's is the correct way to change the ports?

 

We are using arquillian 1.0.0-alpha-3

 

thanks for any Hints!

 

Alphonse