5

I am trying to run a simple JPA test (persist, read, JSON serialize) with Arquillian and Wildfly (8.1.0.Final and 8.2.0.Final tested) container, but until now I was not able to deploy test.war to the embedded server. The test runs with Jboss 7.1.1.Final container.

  • I have used arquillian-tutorial package given on Arquillian Getting Started Guide and Arquillian Example Project (google: github arquillian tutorial)
  • I have used Arquillian - Wildfly configuration given here

You can find a downloadable project package on google drive. You can see Maven and Arquillian configurations in that package. I have tried with or without Management realm credentials. On profile wildfy81-embedded-credentials (which is the default in the package), the build first unpacks wildfly package and then overwrites mgmt-users.properties and mgmt-groups.properties where admin user credentials and role is defined.

The exception is

INFO  [org.jboss.ws.common.management] JBWS022052: Starting JBoss Web Services - Stack CXF Server 4.2.4.Final
INFO  [org.jboss.as] JBAS015961: Http management interface listening on http://127.0.0.1:9990/management
INFO  [org.jboss.as] JBAS015951: Admin console listening on http://127.0.0.1:9990
INFO  [org.jboss.as] JBAS015874: WildFly 8.1.0.Final "Kenny" started in 3401ms - Started 184 of 233 services (81 services are lazy, passive or on-demand)
INFO  [org.xnio] XNIO version 3.2.0.Beta4
INFO  [org.xnio.nio] XNIO NIO Implementation Version 3.2.0.Beta4
INFO  [org.jboss.remoting] JBoss Remoting version 4.0.3.Final
ERROR [org.jboss.remoting.remote.connection] JBREM000200: Remote connection failed: java.io.IOException: JBREM000202: Abrupt close on Remoting connection 0a93e136 to /127.0.0.1:9990
ERROR [org.jboss.remoting.remote.connection] JBREM000200: Remote connection failed: java.io.IOException: An existing connection was forcibly closed by the remote host
ERROR [org.jboss.remoting.remote.connection] JBREM000200: Remote connection failed: java.io.IOException: JBREM000202: Abrupt close on Remoting connection 084cf5d6 to /127.0.0.1:9990
ERROR [org.jboss.remoting.remote.connection] JBREM000200: Remote connection failed: java.io.IOException: An existing connection was forcibly closed by the remote host
WARN  [org.jboss.as.arquillian.container.ArchiveDeployer] Cannot undeploy: test.war: org.jboss.as.controller.client.helpers.standalone.ServerDeploymentHelper$ServerDeploymentException: java.lang.RuntimeException: java.net.ConnectException: JBAS012174: Could not connect to http-remoting://127.0.0.1:9990. The connection failed
    at org.jboss.as.controller.client.helpers.standalone.ServerDeploymentHelper.undeploy(ServerDeploymentHelper.java:109) [wildfly-controller-client-8.1.0.Final.jar:8.1.0.Final]
    at org.jboss.as.arquillian.container.ArchiveDeployer.undeploy(ArchiveDeployer.java:55) [wildfly-arquillian-common-8.1.0.Final.jar:8.1.0.Final]
    at org.jboss.as.arquillian.container.CommonDeployableContainer.undeploy(CommonDeployableContainer.java:152) [wildfly-arquillian-common-8.1.0.Final.jar:8.1.0.Final]
Caused by: java.lang.RuntimeException: java.net.ConnectException: JBAS012174: Could not connect to http-remoting://127.0.0.1:9990. The connection failed
at org.jboss.as.controller.client.impl.AbstractModelControllerClient.executeAsync(AbstractModelControllerClient.java:103) [wildfly-controller-client-8.1.0.Final.jar:8.1.0.Final]
at org.jboss.as.controller.client.helpers.standalone.impl.ModelControllerClientServerDeploymentManager.executeOperation(ModelControllerClientServerDeploymentManager.java:50) [wildfly-controller-client-8.1.0.Final.jar:8.1.0.Final]
at org.jboss.as.controller.client.helpers.standalone.impl.AbstractServerDeploymentManager.execute(AbstractServerDeploymentManager.java:79) [wildfly-controller-client-8.1.0.Final.jar:8.1.0.Final]
at org.jboss.as.controller.client.helpers.standalone.ServerDeploymentHelper.undeploy(ServerDeploymentHelper.java:106) [wildfly-controller-client-8.1.0.Final.jar:8.1.0.Final]
... 82 more
Caused by: java.net.ConnectException: JBAS012174: Could not connect to http-remoting://127.0.0.1:9990. The connection failed
    at org.jboss.as.protocol.ProtocolConnectionUtils.connectSync(ProtocolConnectionUtils.java:117) [wildfly-protocol-8.1.0.Final.jar:8.1.0.Final]
    at org.jboss.as.protocol.ProtocolConnectionManager$EstablishingConnection.connect(ProtocolConnectionManager.java:256) [wildfly-protocol-8.1.0.Final.jar:8.1.0.Final]

Could you please help me to find the issue here?

Thanks in advance.

Edit 1

From arquillian.xml

<container qualifier="wildfly-embedded-credentials">
        <configuration>
            <property name="jbossHome">target/wildfly-8.1.0.Final</property>
            <property name="modulePath">target/wildfly-8.1.0.Final/modules</property>
            <property name="managementAddress">127.0.0.1</property>
            <property name="managementPort">9990</property>
            <property name="username">admin</property>
            <property name="password">admin</property>
            <property name="outputToConsole">true</property>
        </configuration>
    </container>

Deployment code:

@Deployment
public static WebArchive createDeployment() {
    return ShrinkWrap.create(WebArchive.class, "test.war")
        .addPackage(MyBean.class.getPackage())
        .addAsLibraries(new File("target/test-libs/commons-collections.jar"), 
                        new File("target/test-libs/flexjson.jar"))
        .addAsResource("test-persistence.xml", "META-INF/persistence.xml")
        .addAsWebInfResource("jboss-ds.xml")
        .addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml");
}

I wonder if this is because of URL

INFO Http management interface listening on http://127.0.0.1:9990/management

Edit 2

In the attached project (google drive link above), you will see there is another profile wildfy81-embedded in pom.xml with different arquillian configuration where I do not supply management address or username and password, only jbossHome and modulePath folders are defined. I get same exception (same port as well, 9990).

<container qualifier="wildfly-embedded">
    <configuration>
        <property name="jbossHome">target/wildfly-8.1.0.Final</property>
        <property name="modulePath">target/wildfly-8.1.0.Final/modules</property>
        <property name="outputToConsole">true</property>
    </configuration>
</container>

On my last test, I have noticed one more exception cause (maybe because of java version or eclipse version that I am using at home). This was the exception at the bottom of other exception lines Could not connect to http-remoting://127.0.0.1:9990. The connection failed

Caused by: java.io.IOException: Invalid response
at org.xnio.http.HttpUpgradeParser.parseVersion(HttpUpgradeParser.java:150) [xnio-api-3.2.0.Beta4.jar:3.2.0.Beta4]
at org.xnio.http.HttpUpgradeParser.parse(HttpUpgradeParser.java:53) [xnio-api-3.2.0.Beta4.jar:3.2.0.Beta4]
at org.xnio.http.HttpUpgrade$HttpUpgradeState$UpgradeResultListener.handleEvent(HttpUpgrade.java:299) [xnio-api-3.2.0.Beta4.jar:3.2.0.Beta4]
at org.xnio.http.HttpUpgrade$HttpUpgradeState$UpgradeResultListener.handleEvent(HttpUpgrade.java:279) [xnio-api-3.2.0.Beta4.jar:3.2.0.Beta4]
at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92) [xnio-api-3.2.0.Beta4.jar:3.2.0.Beta4]
at org.xnio.conduits.ReadReadyHandler$ChannelListenerHandler.readReady(ReadReadyHandler.java:66) [xnio-api-3.2.0.Beta4.jar:3.2.0.Beta4]
at org.xnio.nio.NioSocketConduit.handleReady(NioSocketConduit.java:87) [xnio-nio-3.2.0.Beta4.jar:3.2.0.Beta4]
at org.xnio.nio.WorkerThread.run(WorkerThread.java:531) [xnio-nio-3.2.0.Beta4.jar:3.2.0.Beta4]
at ...asynchronous invocation...(Unknown Source)
at org.jboss.remoting3.EndpointImpl.doConnect(EndpointImpl.java:272) [jboss-remoting-4.0.3.Final.jar:4.0.3.Final]
at org.jboss.remoting3.EndpointImpl.doConnect(EndpointImpl.java:253) [jboss-remoting-4.0.3.Final.jar:4.0.3.Final]
at org.jboss.remoting3.EndpointImpl.connect(EndpointImpl.java:351) [jboss-remoting-4.0.3.Final.jar:4.0.3.Final]
at org.jboss.remoting3.EndpointImpl.connect(EndpointImpl.java:339) [jboss-remoting-4.0.3.Final.jar:4.0.3.Final]
at org.jboss.as.protocol.ProtocolConnectionUtils.connect(ProtocolConnectionUtils.java:78) [wildfly-protocol-8.1.0.Final.jar:8.1.0.Final]
at org.jboss.as.protocol.ProtocolConnectionUtils.connectSync(ProtocolConnectionUtils.java:109) [wildfly-protocol-8.1.0.Final.jar:8.1.0.Final]
... 95 more
srex
  • 121
  • 1
  • 7
  • Unless you explicitly add the `admin` user try removing the username and password. Neither should be required. – James R. Perkins Aug 24 '15 at 17:06
  • Thanks @JamesR.Perkins for your comment, but I started testing without username and password, with defaults as much as possible. On my Edit 2 section, you can see arquilian configuration. You can also see full configurations in the [attached project](https://drive.google.com/file/d/0B8OuC9flXLeoSEY0VnJxZjVWdlU/view?usp=sharing) – srex Aug 24 '15 at 18:50
  • It looks like in your example project you're using `jboss-as-7.1.1.Final`, but the WildFly 8 Arquillian. You'll want to use the same version of WildFly. – James R. Perkins Aug 25 '15 at 21:38
  • @JamesR.Perkins, `jboss-as-7.1.1.Final` is activated with Maven profile `arquillian-jbossas-managed`. You can run `mvn -Pwildfy81-embedded clean package` which will activate `wildfy81-embedded` profile and that will use wildfly 8.1.0.Final. Wildfly related profiles are using `arquillian.launch` system property to use wildfly folders. – srex Aug 26 '15 at 09:15
  • Really late response, but while the test failed I didn't have any issues with it attempting to connect to the wrong port. – James R. Perkins Sep 17 '15 at 22:28
  • "Connection failed" - that clearly states the expected and current outcome of the situation and provides a sufficient amount of measures and reasons for further investgation - like anyone who is in touch with advanced software programming learned in the first weeks of their SE training. I don't see the problem... – Kalle Richter Oct 13 '17 at 08:50

3 Answers3

4

I have encountered this exception (invalid response part) a few times because of Nvidia drivers on windows platform. NVIDIA Network Service is using the same port WildFly/JBoss AS is using. If you are using windows with nvidia, then please go to local services and stop this service, then check if the tests work :).

mmatloka
  • 1,986
  • 1
  • 20
  • 46
  • This is the correct answer! NVidia Network Service agent which runs on 9990 port - the same port is used by WildFly HTTP Management. – jilt3d Nov 22 '15 at 08:41
2

A few comments:

  1. I have tried jboss/wildfly embedded a million times and never gotten it to work. It seems to merge the classpath with your maven or IDE environment with Wildfly. As a result I always have to revert to -managed deployment. Your example project works for me in this sense when I change it to managed.

  2. I would recommend upgrading Arquillian to the latest version: 1.1.9.Final. A lot of bug fixes happen between releases

  3. Your DeploymentFactory is referring to jar files in the /target/ directory but those don't exist under a normal maven run. (maybe your IDE is putting them there?). A better way to get the jar files you need is to use the shrinkwrap maven resolver.

<dependency>
    <groupId>org.jboss.shrinkwrap.resolver</groupId>
    <artifactId>shrinkwrap-resolver-depchain</artifactId>
    <version>2.1.0</version>
    <scope>test</scope>
    <type>pom</type>
</dependency>
ConfigurableMavenResolverSystem mvnResolver = Maven.configureResolver();
PomEquippedResolveStage pers = mvnResolver.loadPomFromFile("pom.xml");

return ShrinkWrap.create(WebArchive.class, "test.war")
    .addPackage(MyBean.class.getPackage())
    .addAsLibraries(pers.resolve("commons-collections:commons-collections").withTransitivity().asFile())
    .addAsLibraries(pers.resolve("net.sf.flexjson:flexjson").withTransitivity().asFile())
    .addAsResource("test-persistence.xml", "META-INF/persistence.xml")
    .addAsWebInfResource("jboss-ds.xml")
    .addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml");
Tea Curran
  • 2,923
  • 2
  • 18
  • 22
1

Changing management port in Wildfly worked for me:

<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-failsafe-plugin</artifactId>
  <version>2.18.1</version>
  <configuration>
    <forkCount>1</forkCount>
    <systemPropertyVariables>
      <java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager>
      <jboss.home>${project.basedir}/container/wildfly-8.1.0.Final</jboss.home>
      <module.path>${project.basedir}/container/wildfly-8.1.0.Final/modules</module.path>
      <jboss.http.port>8181</jboss.http.port>
      <jboss.management.http.port>9090</jboss.management.http.port>
    </systemPropertyVariables>
    <redirectTestOutputToFile>false</redirectTestOutputToFile>
  </configuration>
  <executions>
    <execution>
      <goals>
        <goal>integration-test</goal>
        <goal>verify</goal>
      </goals>
    </execution>
  </executions>
</plugin>

Remember to configure management port for Arquillian in arquillian.xml:

<container qualifier="wildfly-embedded" default="true">
    <configuration>
        <property name="managementPort">9090</property>
    </configuration>
</container>
Mac
  • 11
  • 2