Maven test

I am experiencing a weird issue executing unit tests with maven. I have a set of unit tests that work great if they work one by one. However, when I run them from maven (mvn test) it hangs (blocks forever).

It always hangs at the same point (same test class) in class A that is used by this test. I tried to remove log creation from A.class

and the test started to work successfully. This is the line:

private static final Logger log = LoggerFactory.getLogger(A.class);

      

Here's a stream dump:

"main" prio=6 tid=0x00446c00 nid=0x1278 runnable [0x00a2f000]
   java.lang.Thread.State: RUNNABLE
        at java.lang.ProcessImpl.waitFor(Native Method)
        at org.codehaus.plexus.util.cli.CommandLineUtils.executeCommandLine(CommandLineUtils.java:173)
        at org.codehaus.plexus.util.cli.CommandLineUtils.executeCommandLine(CommandLineUtils.java:114)
        at org.apache.maven.plugin.surefire.booterclient.ForkStarter.fork(ForkStarter.java:231)
        at org.apache.maven.plugin.surefire.booterclient.ForkStarter.runSuitesForkOnce(ForkStarter.java:125)
        at org.apache.maven.plugin.surefire.booterclient.ForkStarter.run(ForkStarter.java:109)
        at org.apache.maven.plugin.surefire.SurefirePlugin.execute(SurefirePlugin.java:619)
        at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
        at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
        at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:319)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
        at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
        at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
        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.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
        at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
        at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)

      

I don't know where to go from here. Any suggestions are greatly appreciated.

+3


source to share


1 answer


Possibly a dead resource lock? Considering the comment about creating another maven process, this might be indicative of where to go. You can try setting sync in your test somewhere (or across all methods) to see if it goes away. If so, it could be a deadlock.



0


source







All Articles