So I recently upgraded one of my repos to Java 11 and updated the versions of some of the other dependencies. After going through several of the dependencies and resolving all of the errors, I finally got the application to pass all unit and integration tests and it was running normally again. However, when I push the project it also automatically performs mutation tests through Pitest.
This is done in a completely clean environment: a docker container is spun up with the necessary Java and Maven versions (Java 11 and Maven 3.6.3).
The mutation tests fail to compile now, and the following stack trace is given:
18-Aug-2021 15:57:19 [WARNING] Error injecting: org.pitest.maven.PitMojo 18-Aug-2021 15:57:19 com.google.inject.ProvisionException: Unable to provision, see the following errors: 18-Aug-2021 15:57:19 18-Aug-2021 15:57:19 1) Error injecting constructor, java.lang.NoSuchMethodError: 'void org.pitest.functional.FCollection.mapTo(java.lang.Iterable, java.util.function.Function, java.util.Collection)' 18-Aug-2021 15:57:19 at org.pitest.maven.PitMojo.<init>(Unknown Source) 18-Aug-2021 15:57:19 while locating org.pitest.maven.PitMojo 18-Aug-2021 15:57:19 18-Aug-2021 15:57:19 1 error 18-Aug-2021 15:57:19 at com.google.inject.internal.InternalProvisionException.toProvisionException (InternalProvisionException.java:226) 18-Aug-2021 15:57:19 at com.google.inject.internal.InjectorImpl$1.get (InjectorImpl.java:1053) 18-Aug-2021 15:57:19 at com.google.inject.internal.InjectorImpl.getInstance (InjectorImpl.java:1086) 18-Aug-2021 15:57:19 at org.eclipse.sisu.space.AbstractDeferredClass.get (AbstractDeferredClass.java:48) 18-Aug-2021 15:57:19 at com.google.inject.internal.ProviderInternalFactory.provision (ProviderInternalFactory.java:85) 18-Aug-2021 15:57:19 at com.google.inject.internal.InternalFactoryToInitializableAdapter.provision (InternalFactoryToInitializableAdapter.java:57) 18-Aug-2021 15:57:19 at com.google.inject.internal.ProviderInternalFactory$1.call (ProviderInternalFactory.java:66) 18-Aug-2021 15:57:19 at com.google.inject.internal.ProvisionListenerStackCallback$Provision.provision (ProvisionListenerStackCallback.java:112) 18-Aug-2021 15:57:19 at com.google.inject.internal.ProvisionListenerStackCallback$Provision.provision (ProvisionListenerStackCallback.java:127) 18-Aug-2021 15:57:19 at com.google.inject.internal.ProvisionListenerStackCallback.provision (ProvisionListenerStackCallback.java:66) 18-Aug-2021 15:57:19 at com.google.inject.internal.ProviderInternalFactory.circularGet (ProviderInternalFactory.java:61) 18-Aug-2021 15:57:19 at com.google.inject.internal.InternalFactoryToInitializableAdapter.get (InternalFactoryToInitializableAdapter.java:47) 18-Aug-2021 15:57:19 at com.google.inject.internal.InjectorImpl$1.get (InjectorImpl.java:1050) 18-Aug-2021 15:57:19 at org.eclipse.sisu.inject.Guice4$1.get (Guice4.java:162) 18-Aug-2021 15:57:19 at org.eclipse.sisu.inject.LazyBeanEntry.getValue (LazyBeanEntry.java:81) 18-Aug-2021 15:57:19 at org.eclipse.sisu.plexus.LazyPlexusBean.getValue (LazyPlexusBean.java:51) 18-Aug-2021 15:57:19 at org.codehaus.plexus.DefaultPlexusContainer.lookup (DefaultPlexusContainer.java:263) 18-Aug-2021 15:57:19 at org.codehaus.plexus.DefaultPlexusContainer.lookup (DefaultPlexusContainer.java:255) 18-Aug-2021 15:57:19 at org.apache.maven.plugin.internal.DefaultMavenPluginManager.getConfiguredMojo (DefaultMavenPluginManager.java:520) 18-Aug-2021 15:57:19 at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:124) 18-Aug-2021 15:57:19 at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210) 18-Aug-2021 15:57:19 at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156) 18-Aug-2021 15:57:19 at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148) 18-Aug-2021 15:57:19 at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117) 18-Aug-2021 15:57:19 at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81) 18-Aug-2021 15:57:19 at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56) 18-Aug-2021 15:57:19 at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128) 18-Aug-2021 15:57:19 at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305) 18-Aug-2021 15:57:19 at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192) 18-Aug-2021 15:57:19 at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105) 18-Aug-2021 15:57:19 at org.apache.maven.cli.MavenCli.execute (MavenCli.java:957) 18-Aug-2021 15:57:19 at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:289) 18-Aug-2021 15:57:19 at org.apache.maven.cli.MavenCli.main (MavenCli.java:193) 18-Aug-2021 15:57:19 at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method) 18-Aug-2021 15:57:19 at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62) 18-Aug-2021 15:57:19 at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43) 18-Aug-2021 15:57:19 at java.lang.reflect.Method.invoke (Method.java:566) 18-Aug-2021 15:57:19 at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282) 18-Aug-2021 15:57:19 at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225) 18-Aug-2021 15:57:19 at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406) 18-Aug-2021 15:57:19 at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347) 18-Aug-2021 15:57:19 Caused by: java.lang.NoSuchMethodError: 'void org.pitest.functional.FCollection.mapTo(java.lang.Iterable, java.util.function.Function, java.util.Collection)' 18-Aug-2021 15:57:19 at org.pitest.maven.DependencyFilter.<init> (DependencyFilter.java:42) 18-Aug-2021 15:57:19 at org.pitest.maven.AbstractPitMojo.<init> (AbstractPitMojo.java:365) 18-Aug-2021 15:57:19 at org.pitest.maven.PitMojo.<init> (PitMojo.java:14) 18-Aug-2021 15:57:19 at jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0 (Native Method) 18-Aug-2021 15:57:19 at jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance (NativeConstructorAccessorImpl.java:62) 18-Aug-2021 15:57:19 at jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance (DelegatingConstructorAccessorImpl.java:45) 18-Aug-2021 15:57:19 at java.lang.reflect.Constructor.newInstance (Constructor.java:490) 18-Aug-2021 15:57:19 at com.google.inject.internal.DefaultConstructionProxyFactory$ReflectiveProxy.newInstance (DefaultConstructionProxyFactory.java:126) 18-Aug-2021 15:57:19 at com.google.inject.internal.ConstructorInjector.provision (ConstructorInjector.java:114) 18-Aug-2021 15:57:19 at com.google.inject.internal.ConstructorInjector.access$000 (ConstructorInjector.java:32) 18-Aug-2021 15:57:19 at com.google.inject.internal.ConstructorInjector$1.call (ConstructorInjector.java:98) 18-Aug-2021 15:57:19 at com.google.inject.internal.ProvisionListenerStackCallback$Provision.provision (ProvisionListenerStackCallback.java:112) 18-Aug-2021 15:57:19 at com.google.inject.internal.ProvisionListenerStackCallback$Provision.provision (ProvisionListenerStackCallback.java:127) 18-Aug-2021 15:57:19 at com.google.inject.internal.ProvisionListenerStackCallback.provision (ProvisionListenerStackCallback.java:66) 18-Aug-2021 15:57:19 at com.google.inject.internal.ConstructorInjector.construct (ConstructorInjector.java:93) 18-Aug-2021 15:57:19 at com.google.inject.internal.ConstructorBindingImpl$Factory.get (ConstructorBindingImpl.java:306) 18-Aug-2021 15:57:19 at com.google.inject.internal.InjectorImpl$1.get (InjectorImpl.java:1050) 18-Aug-2021 15:57:19 at com.google.inject.internal.InjectorImpl.getInstance (InjectorImpl.java:1086) 18-Aug-2021 15:57:19 at org.eclipse.sisu.space.AbstractDeferredClass.get (AbstractDeferredClass.java:48) 18-Aug-2021 15:57:19 at com.google.inject.internal.ProviderInternalFactory.provision (ProviderInternalFactory.java:85) 18-Aug-2021 15:57:19 at com.google.inject.internal.InternalFactoryToInitializableAdapter.provision (InternalFactoryToInitializableAdapter.java:57) 18-Aug-2021 15:57:19 at com.google.inject.internal.ProviderInternalFactory$1.call (ProviderInternalFactory.java:66) 18-Aug-2021 15:57:19 at com.google.inject.internal.ProvisionListenerStackCallback$Provision.provision (ProvisionListenerStackCallback.java:112) 18-Aug-2021 15:57:19 at com.google.inject.internal.ProvisionListenerStackCallback$Provision.provision (ProvisionListenerStackCallback.java:127) 18-Aug-2021 15:57:19 at com.google.inject.internal.ProvisionListenerStackCallback.provision (ProvisionListenerStackCallback.java:66) 18-Aug-2021 15:57:19 at com.google.inject.internal.ProviderInternalFactory.circularGet (ProviderInternalFactory.java:61) 18-Aug-2021 15:57:19 at com.google.inject.internal.InternalFactoryToInitializableAdapter.get (InternalFactoryToInitializableAdapter.java:47) 18-Aug-2021 15:57:19 at com.google.inject.internal.InjectorImpl$1.get (InjectorImpl.java:1050) 18-Aug-2021 15:57:19 at org.eclipse.sisu.inject.Guice4$1.get (Guice4.java:162) 18-Aug-2021 15:57:19 at org.eclipse.sisu.inject.LazyBeanEntry.getValue (LazyBeanEntry.java:81) 18-Aug-2021 15:57:19 at org.eclipse.sisu.plexus.LazyPlexusBean.getValue (LazyPlexusBean.java:51) 18-Aug-2021 15:57:19 at org.codehaus.plexus.DefaultPlexusContainer.lookup (DefaultPlexusContainer.java:263) 18-Aug-2021 15:57:19 at org.codehaus.plexus.DefaultPlexusContainer.lookup (DefaultPlexusContainer.java:255) 18-Aug-2021 15:57:19 at org.apache.maven.plugin.internal.DefaultMavenPluginManager.getConfiguredMojo (DefaultMavenPluginManager.java:520) 18-Aug-2021 15:57:19 at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:124) 18-Aug-2021 15:57:19 at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210) 18-Aug-2021 15:57:19 at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156) 18-Aug-2021 15:57:19 at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148) 18-Aug-2021 15:57:19 at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117) 18-Aug-2021 15:57:19 at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81) 18-Aug-2021 15:57:19 at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56) 18-Aug-2021 15:57:19 at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128) 18-Aug-2021 15:57:19 at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305) 18-Aug-2021 15:57:19 at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192) 18-Aug-2021 15:57:19 at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105) 18-Aug-2021 15:57:19 at org.apache.maven.cli.MavenCli.execute (MavenCli.java:957) 18-Aug-2021 15:57:19 at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:289) 18-Aug-2021 15:57:19 at org.apache.maven.cli.MavenCli.main (MavenCli.java:193) 18-Aug-2021 15:57:19 at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method) 18-Aug-2021 15:57:19 at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62) 18-Aug-2021 15:57:19 at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43) 18-Aug-2021 15:57:19 at java.lang.reflect.Method.invoke (Method.java:566) 18-Aug-2021 15:57:19 at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282) 18-Aug-2021 15:57:19 at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225) 18-Aug-2021 15:57:19 at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406) 18-Aug-2021 15:57:19 at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
This is only a part of the stack trace, but I believe it is the relevant part, I can grab more of the stack trace if necessary/requested.
I have not been able to find much information about this issue. Any similar topics/posts I have found on StackOverflow/GitHub just suggest to either perform a mvn clean
or to upgrade to a newer version (the most common I’ve noticed mentioned is Pitest 1.4.3). However, as I said the mutation tests (in fact all of the tests) are run in a completely new and clean environment and we upgraded Pitest from 1.1.11 to 1.5.2.
In fact, I was originally going to leave Pitest at version 1.1.11, but was getting an IllegalArgumentException
instead, and assumed it was just because it needed to be upgraded.
Why is this exception being thrown? Is Pitest missing a dependency that I need to add? Where can I find more information on errors like this, and what debugging might I be able to do to find the cause and form a solution?
Thank you
Advertisement
Answer
Turns out our remote environment was running the tests a slightly different way and was using a plugin for pitest that was not explicitly defined in our POM. The plugin was Alex Victoor’s pitest-cucumber-plugin which includes a compatibility matrix that I was able to use to resolve the issue.