gpt4 book ai didi

java - 错误 : Eclipse 4. 5 MARS NullPointerException(JUnit 测试)

转载 作者:行者123 更新时间:2023-12-02 09:32:22 24 4
gpt4 key购买 nike

在构建 JUnit 测试类时,我确实在 Eclipse 4.5 上遇到了问题。我可以在 ant 存储库的帮助下构建所有测试。我认为这是Eclipse中的配置问题。

我已经在这个论坛上关注了很多解决方案:

  • 清理eclipse本身的路径
  • 重新启动 Eclipse
  • 尝试使用 JUnit3 进行编译
  • 尝试使用 JUnit4 进行编译
  • 尝试另一个 JRE
  • 在不同的工作区启动项目

我没有更新Eclipse的原因是因为我的公司只使用Eclipse 4.5。所以我不能接受更新它的答案。

错误日志:

!ENTRY org.eclipse.core.jobs 4 2 2019-09-09 17:55:58.495
!MESSAGE An internal error occurred during: "Launching JUnitEntityDBUtility".
!STACK 0
java.lang.NullPointerException
at org.eclipse.jdt.junit.launcher.JUnitLaunchConfigurationDelegate$ClasspathLocalizer.localURL(JUnitLaunchConfigurationDelegate.java:429)
at org.eclipse.jdt.junit.launcher.JUnitLaunchConfigurationDelegate$ClasspathLocalizer.entryString(JUnitLaunchConfigurationDelegate.java:418)
at org.eclipse.jdt.junit.launcher.JUnitLaunchConfigurationDelegate$ClasspathLocalizer.addEntry(JUnitLaunchConfigurationDelegate.java:405)
at org.eclipse.jdt.junit.launcher.JUnitLaunchConfigurationDelegate$ClasspathLocalizer.localizeClasspath(JUnitLaunchConfigurationDelegate.java:396)
at org.eclipse.jdt.junit.launcher.JUnitLaunchConfigurationDelegate.getClasspath(JUnitLaunchConfigurationDelegate.java:373)
at org.eclipse.jdt.junit.launcher.JUnitLaunchConfigurationDelegate.launch(JUnitLaunchConfigurationDelegate.java:147)
at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:885)
at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:739)
at org.eclipse.debug.internal.ui.DebugUIPlugin.buildAndLaunch(DebugUIPlugin.java:1039)
at org.eclipse.debug.internal.ui.DebugUIPlugin$8.run(DebugUIPlugin.java:1256)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)

最佳答案

删除并重新创建您的 JUnitEntityDBUtility 启动配置

可以找到堆栈跟踪 herehere 。在第二个发现中,您会发现 the explanation and a workaround by Moritz Eysholdt对于您的问题如下(我突出显示):

That NPE occurs if you execute a test's launch config in an Eclipse that does not have the plugin org.eclipse.jdt.junit4.runtime.patch installed when the launch config was created by an Eclipse that did actually have org.eclipse.jdt.junit4.runtime.patch installed.

Workaround: Install org.eclipse.jdt.junit4.runtime.patch via the Xpect update site or delete+recreate your launch configuration.

[...]

关于java - 错误 : Eclipse 4. 5 MARS NullPointerException(JUnit 测试),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57857964/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com