我想验证集成测试的代码覆盖率。我已经实现了一些REST服务并将它们部署在Wildly 9.0.2上。然后,我使用IDEA Coverage Runner在IntelliJ中配置了覆盖范围,以获得跟踪支持。当我现在以覆盖范围启动Wildfly时,战争的部署失败,并伴随着以下的痕迹:
16:20:53,103 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-7) MSC000001: Failed to start service jboss.deployment.unit."myservice-war-1.0.0-SNAPSHOT.war".INSTALL: org.jboss.msc.service.StartException in service jboss.deployment.unit."myservice-war-1.0.0-SNAPSHOT.war".INSTALL: WFLYSRV0153: Failed to process phase INSTALL of deployment "myservice-war-1.0.0-SNAPSHOT.war"
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:163)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1948)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1881)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.NoClassDefFoundError: com/intellij/rt/coverage/data/ProjectData
at de.akquinet.ats.myservice.rest.services.MyUpdateService.<clinit>(MyUpdateService.java)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:348)
at org.jboss.invocation.proxy.AbstractProxyFactory.afterClassLoad(AbstractProxyFactory.java:95)
at org.jboss.invocation.proxy.AbstractClassFactory.defineClass(AbstractClassFactory.java:166)
at org.jboss.invocation.proxy.AbstractProxyFactory.getCachedMethods(AbstractProxyFactory.java:150)
at org.jboss.as.ejb3.component.stateless.StatelessComponentDescription$3.configure(StatelessComponentDescription.java:150)
at org.jboss.as.ee.component.DefaultComponentViewConfigurator.configure(DefaultComponentViewConfigurator.java:67)
at org.jboss.as.ee.component.deployers.EEModuleConfigurationProcessor.deploy(EEModuleConfigurationProcessor.java:81)
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:156)
... 5 more
Caused by: java.lang.ClassNotFoundException: com.intellij.rt.coverage.data.ProjectData from [Module "deployment.myservice-war-1.0.0-SNAPSHOT.war:main" from Service Module Loader]
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:205)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:455)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:404)
at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:385)
at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:130)
... 15 more
16:20:53,106 ERROR [org.jboss.as.controller.management-operation] (management-handler-thread - 2) WFLYCTL0013: Operation ("deploy") failed - address: ([("deployment" => "myservice-war-1.0.0-SNAPSHOT.war")]) - failure description: {
"WFLYCTL0080: Failed services" => {"jboss.deployment.unit.\"myservice-war-1.0.0-SNAPSHOT.war\".INSTALL" => "org.jboss.msc.service.StartException in service jboss.deployment.unit.\"myservice-war-1.0.0-SNAPSHOT.war\".INSTALL: WFLYSRV0153: Failed to process phase INSTALL of deployment \"myservice-war-1.0.0-SNAPSHOT.war\"
Caused by: java.lang.NoClassDefFoundError: com/intellij/rt/coverage/data/ProjectData
Caused by: java.lang.ClassNotFoundException: com.intellij.rt.coverage.data.ProjectData from [Module \"deployment.myservice-war-1.0.0-SNAPSHOT.war:main\" from Service Module Loader]"},
"WFLYCTL0180: Services with missing/unavailable dependencies" => [
"jboss.deployment.unit.\"myservice-war-1.0.0-SNAPSHOT.war\".batch.environment is missing [jboss.deployment.unit.\"myservice-war-1.0.0-SNAPSHOT.war\".beanmanager]",
"jboss.deployment.unit.\"myservice-war-1.0.0-SNAPSHOT.war\".weld.weldClassIntrospector is missing [jboss.deployment.unit.\"myservice-war-1.0.0-SNAPSHOT.war\".beanmanager]"
]
}
16:20:53,107 ERROR [org.jboss.as.server] (management-handler-thread - 2) WFLYSRV0021: Deploy of deployment "myservice-war-1.0.0-SNAPSHOT.war" was rolled back with the following failure message:
{
"WFLYCTL0080: Failed services" => {"jboss.deployment.unit.\"myservice-war-1.0.0-SNAPSHOT.war\".INSTALL" => "org.jboss.msc.service.StartException in service jboss.deployment.unit.\"myservice-war-1.0.0-SNAPSHOT.war\".INSTALL: WFLYSRV0153: Failed to process phase INSTALL of deployment \"myservice-war-1.0.0-SNAPSHOT.war\"
Caused by: java.lang.NoClassDefFoundError: com/intellij/rt/coverage/data/ProjectData
Caused by: java.lang.ClassNotFoundException: com.intellij.rt.coverage.data.ProjectData from [Module \"deployment.myservice-war-1.0.0-SNAPSHOT.war:main\" from Service Module Loader]"},
"WFLYCTL0180: Services with missing/unavailable dependencies" => [
"jboss.deployment.unit.\"myservice-war-1.0.0-SNAPSHOT.war\".batch.environment is missing [jboss.deployment.unit.\"myservice-war-1.0.0-SNAPSHOT.war\".beanmanager]",
"jboss.deployment.unit.\"myservice-war-1.0.0-SNAPSHOT.war\".weld.weldClassIntrospector is missing [jboss.deployment.unit.\"myservice-war-1.0.0-SNAPSHOT.war\".beanmanager]"
]
}
我正在使用IntelliJ IDEA 2016.1.2 Build#IU-145.972,建于2016年5月14日 JRE:1.8.0_76-release-b162 x86_64 JVM:JetBrains s.r.o的OpenJDK 64位服务器VM
我完全知道ClassNotFoundException是什么,并且通常知道该怎么做,但在这里我被卡住了......
有人可以帮忙吗?
答案 0 :(得分:0)
目前,使用IntelliJ IDEA覆盖代理是不可能的,因为 org.wildfly.arquillian:wildfly-arquillian-container-embedded:2.0.0.Final 没有任何代理用于设置系统包的属性( jboss.modules.system.pkgs 系统属性)。
使用IntelliJ IDEA覆盖代理的唯一方法是修改 EmbeddedContainerConfiguration 和 EmbeddedDeployableContainer 类,然后,您必须使用这些自定义类。
我alredy做了一个拉取请求,我希望很快就会推出新版本。
public class EmbeddedContainerConfiguration extends CommonContainerConfiguration {
private String systemPackages = System.getProperty("jboss.modules.system.pkgs");
public String getSystemPackages() {
return systemPackages;
}
public void setSystemPackages(String systemPackages) {
this.systemPackages = systemPackages;
}
public String[] getSystemPackagesArray() {
return (systemPackages == null || systemPackages.isEmpty()) ? null : systemPackages.split(",");
}
}
public final class EmbeddedDeployableContainer extends CommonDeployableContainer<EmbeddedContainerConfiguration> {
@Override
public void setup(final EmbeddedContainerConfiguration config) {
super.setup(config);
if (config.getCleanServerBaseDir() != null) {
SecurityActions.setSystemProperty(EmbeddedStandaloneServerFactory.JBOSS_EMBEDDED_ROOT, config.getCleanServerBaseDir());
}
final String[] cmdArgs = getCommandArgs(config);
server = EmbeddedProcessFactory.createStandaloneServer(config.getJbossHome(), config.getModulePath(), config.getSystemPackagesArray(), cmdArgs);
}
}