java - 由 : org. apache.maven.surefire.booter.SurefireBooterForkException 引起: fork 进程中出现错误 [错误] 无法实例化类

标签 java spring maven testng

我正在将我的项目迁移到 Java 15 版本。我们已经完成了所有必需的更改并开始构建 Maven 全新安装。

我收到以下错误。从 google 和 Github 其他论坛尝试了很多,但没有任何效果。

TestNG 版本发生了变化,一些插件也发生了变化,但没有运气。

请找出下面的错误。有人可以帮忙吗...

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M5:test (default-test) on project quarterback: There are test failures.
[ERROR] 
[ERROR] Please refer to surefire-reports for the individual test results.
[ERROR] Please refer to dump files (if any exist) [date].dump, [date]-jvmRun[N].dump and [date].dumpstream.
[ERROR] ExecutionException There was an error in the forked process
[ERROR] 
[ERROR] Cannot instantiate class com....ABCTest
[ERROR] ExecutionException There was an error in the forked process
[ERROR] 
[ERROR] Cannot instantiate class com...DEFTest
[ERROR] ExecutionException There was an error in the forked process
[ERROR] 
[ERROR] Cannot instantiate class com...GHITest
[ERROR] org.apache.maven.surefire.booter.SurefireBooterForkException: ExecutionException There was an error in the forked process
[ERROR] 
[ERROR] Cannot instantiate class com...JKLTest
[ERROR] ExecutionException There was an error in the forked process
[ERROR] 
[ERROR] Cannot instantiate class com...MNOTest
[ERROR] ExecutionException There was an error in the forked process
[ERROR] 
[ERROR] Cannot instantiate class com...ABCTest
[ERROR]     at org.apache.maven.plugin.surefire.booterclient.ForkStarter.awaitResultsDone(ForkStarter.java:532)
[ERROR]     at org.apache.maven.plugin.surefire.booterclient.ForkStarter.runSuitesForkOnceMultiple(ForkStarter.java:405)
[ERROR]     at org.apache.maven.plugin.surefire.booterclient.ForkStarter.run(ForkStarter.java:321)
[ERROR]     at org.apache.maven.plugin.surefire.booterclient.ForkStarter.run(ForkStarter.java:266)
[ERROR]     at org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeProvider(AbstractSurefireMojo.java:1314)
[ERROR]     at org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeAfterPreconditionsChecked(AbstractSurefireMojo.java:1159)
[ERROR]     at org.apache.maven.plugin.surefire.AbstractSurefireMojo.execute(AbstractSurefireMojo.java:932)
[ERROR]     at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:137)
[ERROR]     at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:210)
[ERROR]     at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:156)
[ERROR]     at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:148)
[ERROR]     at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:117)
[ERROR]     at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:81)
[ERROR]     at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:56)
[ERROR]     at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
[ERROR]     at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:305)
[ERROR]     at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:192)
[ERROR]     at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:105)
[ERROR]     at org.apache.maven.cli.MavenCli.execute(MavenCli.java:956)
[ERROR]     at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
[ERROR]     at org.apache.maven.cli.MavenCli.main(MavenCli.java:192)
[ERROR]     at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[ERROR]     at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:64)
[ERROR]     at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[ERROR]     at java.base/java.lang.reflect.Method.invoke(Method.java:564)
[ERROR]     at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:282)
[ERROR]     at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:225)
[ERROR]     at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:406)
[ERROR]     at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:347)
[ERROR] Caused by: org.apache.maven.surefire.booter.SurefireBooterForkException: There was an error in the forked process
[ERROR] 
[ERROR] Cannot instantiate class com....DEFTest
[ERROR]     at org.apache.maven.plugin.surefire.booterclient.ForkStarter.fork(ForkStarter.java:733)
[ERROR]     at org.apache.maven.plugin.surefire.booterclient.ForkStarter.access$700(ForkStarter.java:121)
[ERROR]     at org.apache.maven.plugin.surefire.booterclient.ForkStarter$1.call(ForkStarter.java:393)
[ERROR]     at org.apache.maven.plugin.surefire.booterclient.ForkStarter$1.call(ForkStarter.java:370)
[ERROR]     at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
[ERROR]     at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130)
[ERROR]     at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:630)
[ERROR]     at java.base/java.lang.Thread.run(Thread.java:832)

最佳答案

您在堆栈跟踪中看到的内容并不一定意味着插件中存在错误。

我认为带有 Cannot instantiate class com...ABCTest 的日志是由您的框架 TestNG 打印的。 TestNG 在 JDK 15 中可靠吗? 您可以在转储文件中查看更多信息,其中包含位于 target/surefire-reports 中的详细错误。

我在https://sqa.stackexchange.com/questions/14680/cannot-instantiate-class-error-selenium-webdriver中发现了类似的问题根本原因看起来像是他们调用司机

driver.findElement(...)

在测试类的构造函数中。

关于java - 由 : org. apache.maven.surefire.booter.SurefireBooterForkException 引起: fork 进程中出现错误 [错误] 无法实例化类,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64633244/

相关文章:

java - 检查字符串是否包含子字符串,不使用 java 预定义方法

java - Runtime.exec 被 System.exit 杀死?

xml - Spring XML 绑定(bind)

java - JAX-RS (Resteasy 3.5.0.Final) + Wildfly 12 + Java 9 + maven = 404 未找到,但 JAX-RS (Resteasy 3.5.0.Final) + Wildfly 12 + Java 8 + maven 有效

java - 使用java代码进行Saml断言解密

maven - 在父 pom 中使用子模块属性

java - 方法上的 @Valid 注释 (Java EE 6)

java - java中的锁和并发

java - Postman - 所需的 MultipartFile 参数不存在 - Spring,Java

Spring 幕后日志记录