Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Coverage Integration tests IntelliJ on Wildfly

I would like to verify the code coverage of my integration tests. I have implemented some REST-Services and deployed them on Wildly 9.0.2. Then I configured the coverage in IntelliJ with IDEA Coverage Runner for tracing support. When I now start Wildfly with coverage the deployment of the war fails with the following strack trace:

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]"
    ]
}

I am using IntelliJ IDEA 2016.1.2 Build #IU-145.972, built on May 14, 2016 JRE: 1.8.0_76-release-b162 x86_64 JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o

I am fully aware of what a ClassNotFoundException is and usually know what to do then, but here I am stuck...

Can anybody help please?

like image 202
Martin Avatar asked Oct 16 '25 14:10

Martin


1 Answers

Currently, it is not posible to use IntelliJ IDEA coverage agent, because org.wildfly.arquillian:wildfly-arquillian-container-embedded:2.0.0.Final doesn't have any property for setting System Packages (jboss.modules.system.pkgs system property).

The only way to use IntelliJ IDEA coverage agent is modifying EmbeddedContainerConfiguration and EmbeddedDeployableContainer classes, and then, you must use these customized classes.

I alredy made a pull request, i hope the new version will be available very soon.

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);
    }

}
like image 104
Santos Zatarain Vera Avatar answered Oct 18 '25 07:10

Santos Zatarain Vera