我正在尝试使用Arquillian和Wildfly(8.1.0.Final和8.2.0.Final测试)容器运行一个简单的JPA测试(持久化,读取,JSON序列化),但直到现在我还无法部署测试.war到嵌入式服务器。测试使用Jboss 7.1.1.Final容器运行。
您可以找到可下载的project package on google drive。您可以在该包中看到Maven和Arquillian配置。我尝试使用或不使用管理领域凭据。在配置文件 wildfy81-embedded-credentials (这是包中的默认设置)中,构建首先解压缩wildfly包,然后覆盖mgmt-users.properties和mgmt-groups.properties,其中admin用户凭据和角色被定义为。
例外是
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#define random(x) rand() % x
#define randomize srand((unsigned)time(NULL))
int i=0;
int j=0;
int x=0;
int y=0;
int main(void)
{
printf("insert number of loops:");
scanf("%d",&x);
randomize;
for(y=0;y<x;y++)
{
i = random(51);
j = random(51);
printf("%d\n",i);
printf("%d\n",j);
}
return 0;
}
你能帮我在这里找到问题吗?
提前致谢。
修改1
来自arquillian.xml
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]
部署代码:
<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
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");
}
修改2
在附加的项目(上面的google drive链接)中,您会看到pom.xml中有另一个配置文件 wildfy81-embedded ,其中包含不同的arquillian配置,其中我不提供管理地址或用户名和密码,只定义了jbossHome和modulePath文件夹。我得到相同的异常(同样的端口,9990)。
INFO Http management interface listening on http://127.0.0.1:9990/management
在我的上一次测试中,我注意到了另外一个异常原因(可能是因为我在家中使用的java版本或eclipse版本)。这是其他异常行底部的异常无法连接到http-remoting://127.0.0.1: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>
答案 0 :(得分:4)
由于Windows平台上的Nvidia驱动程序,我几次遇到此异常(无效响应部分)。 NVIDIA网络服务使用的是WildFly / JBoss AS使用的相同端口。如果您使用的是带有nvidia的Windows,请转到本地服务并停止此服务,然后检查测试是否有效:)。
答案 1 :(得分:2)
一些评论:
我已经尝试过嵌入了一百万次的jboss / wildfly并且从未让它工作过。它似乎将类路径与您的maven或IDE环境与Wildfly合并。因此,我总是必须恢复到托管部署。当我将其更改为托管时,您的示例项目在这个意义上适用于我。
我建议将Arquillian升级到最新版本:1.1.9.Final。发行版之间发生了很多错误修复
您的DeploymentFactory指的是/ target /目录中的jar文件,但这些文件不存在于正常的maven运行下。 (也许你的IDE把它们放在那里?)。获取所需jar文件的更好方法是使用shrinkwrap maven解析器。
<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");
答案 2 :(得分:1)
改变Wildfly的管理端口对我有用:
<ListView>
<ListView.ItemContainerStyle>
<Style TargetType="ListViewItem">
<Setter Property="Background" Value="White"/>
</Style>
</ListView.ItemContainerStyle>
</ListView>
请记住在arquillian.xml中为Arquillian配置管理端口:
<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>