问题描述
我一直在与内部Eclipse错误战斗两天。我正在运行Eclipse的最新Spring Tool Suite版本,并且我试图导入一系列现有的Maven项目。每当我这样做时,Eclipse都会抛出NullPointerException,但错误日志视图中没有可用的堆栈跟踪。如果我指示Eclipse更新Maven项目(Maven> Update Project),我会再次获得NullPointerException。这次,错误日志视图报告以下堆栈跟踪:
I've been fighting an internal Eclipse error for two days. I'm running the latest Spring Tool Suite edition of Eclipse, and I've attempting to import a collection of existing Maven projects. Whenever I do so, Eclipse throws a NullPointerException, but no stack trace is available from the Error Log view. If I instruct Eclipse to update the Maven project (Maven > Update Project), I get a NullPointerException again. This time, the Error Log view reports the following stack trace:
java.lang.NullPointerException
at org.eclipse.wst.common.componentcore.internal.resources.VirtualResource.getProjectRelativePaths(VirtualResource.java:119)
at org.eclipse.wst.common.componentcore.internal.resources.VirtualFile.getUnderlyingFiles(VirtualFile.java:104)
at org.eclipse.wst.common.componentcore.internal.resources.VirtualFile.getUnderlyingResources(VirtualFile.java:93)
at org.eclipse.wst.common.componentcore.internal.resources.VirtualResource.exists(VirtualResource.java:88)
at org.eclipse.jst.common.internal.modulecore.util.ManifestUtilities.getNonBinaryComponentManifest(ManifestUtilities.java:124)
at org.eclipse.jst.common.internal.modulecore.util.ManifestUtilities.getManifest(ManifestUtilities.java:81)
at org.eclipse.jst.common.internal.modulecore.util.ManifestUtilities.getManifestClasspath(ManifestUtilities.java:147)
at org.eclipse.jst.j2ee.componentcore.J2EEModuleVirtualComponent.getManifestClasspath(J2EEModuleVirtualComponent.java:248)
at org.eclipse.jst.j2ee.componentcore.J2EEModuleVirtualComponent.calculateManifestReferences(J2EEModuleVirtualComponent.java:368)
at org.eclipse.jst.j2ee.componentcore.J2EEModuleVirtualComponent.cacheManifestReferences(J2EEModuleVirtualComponent.java:360)
at org.eclipse.jst.j2ee.componentcore.J2EEModuleVirtualComponent.getReferences(J2EEModuleVirtualComponent.java:176)
at org.eclipse.jst.j2ee.componentcore.J2EEModuleVirtualComponent.getReferences(J2EEModuleVirtualComponent.java:214)
at org.eclipse.jst.j2ee.componentcore.J2EEModuleVirtualComponent.getReferences(J2EEModuleVirtualComponent.java:207)
at org.eclipse.m2e.wtp.WebProjectConfiguratorDelegate.configureClasspath(WebProjectConfiguratorDelegate.java:386)
at org.eclipse.m2e.wtp.WTPProjectConfigurator.configureClasspath(WTPProjectConfigurator.java:107)
at org.eclipse.m2e.jdt.internal.DefaultClasspathManagerDelegate.populateClasspath(DefaultClasspathManagerDelegate.java:61)
at org.eclipse.m2e.jdt.internal.BuildPathManager.getClasspath(BuildPathManager.java:253)
at org.eclipse.m2e.jdt.internal.BuildPathManager.getClasspath(BuildPathManager.java:363)
at org.eclipse.m2e.jdt.internal.BuildPathManager.getClasspath(BuildPathManager.java:343)
at org.eclipse.m2e.jdt.internal.BuildPathManager.getClasspath(BuildPathManager.java:371)
at org.eclipse.m2e.jdt.internal.BuildPathManager.updateClasspath(BuildPathManager.java:191)
at org.eclipse.m2e.jdt.internal.BuildPathManager.mavenProjectChanged(BuildPathManager.java:180)
at org.eclipse.m2e.core.internal.project.registry.ProjectRegistryManager.notifyProjectChangeListeners(ProjectRegistryManager.java:746)
at org.eclipse.m2e.core.internal.project.registry.ProjectRegistryManager.applyMutableProjectRegistry(ProjectRegistryManager.java:865)
at org.eclipse.m2e.core.internal.project.registry.ProjectRegistryManager.refresh(ProjectRegistryManager.java:289)
at org.eclipse.m2e.core.internal.project.ProjectConfigurationManager.updateProjectConfiguration0(ProjectConfigurationManager.java:369)
at org.eclipse.m2e.core.internal.project.ProjectConfigurationManager$2.call(ProjectConfigurationManager.java:316)
at org.eclipse.m2e.core.internal.project.ProjectConfigurationManager$2.call(ProjectConfigurationManager.java:1)
at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.executeBare(MavenExecutionContext.java:161)
at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:137)
at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:89)
at org.eclipse.m2e.core.internal.embedder.MavenImpl.execute(MavenImpl.java:1301)
at org.eclipse.m2e.core.internal.project.ProjectConfigurationManager.updateProjectConfiguration(ProjectConfigurationManager.java:313)
at org.eclipse.m2e.core.ui.internal.UpdateMavenProjectJob.runInWorkspace(UpdateMavenProjectJob.java:77)
at org.eclipse.core.internal.resources.InternalWorkspaceJob.run(InternalWorkspaceJob.java:38)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:53)
这是我尝试过的:
- 我已经吹走了我的工作区并创建了一个新工作区。多次。
- 我已经吹走了我的Maven存储库,以便重新创建它。
- 我重新安装了Spring Tool Suite。
- 我已经尝试过要求Eclipse更新Maven存储库。
- 我在本地SVN存储库中检查了合并冲突。 (没有;这是一个新的分支,来自主干,刚刚检查出来。)
- 我已经检查了Eclipse中的Synchronize视图,看它是否注意到任何差异。 (Eclipse无法识别任何可用于同步的项目。)
- 我在Google上搜索了VirtualResource.getProjectRelativePaths()中发生的NullPointerExceptions。我在其他非常相似的地方找到了NullPointerExceptions,我已经尝试过针对它们的建议,只是为了它,但它们都没有用。
- I've blown away my workspace and created a new one. Multiple times.
- I've blown away my Maven repository so that it would be re-created.
- I've reinstalled Spring Tool Suite.
- I've tried asking Eclipse to update the Maven repositories.
- I've checked for merge conflicts in my local SVN repository. (There are none; this is a brand new branch from trunk that is freshly checked out.)
- I've checked the Synchronize view in Eclipse to see if it notes any differences. (Eclipse can't get far enough to recognize any projects available to synchronize.)
- I've searched Google for NullPointerExceptions occurring in VirtualResource.getProjectRelativePaths(). I've found NullPointerExceptions in other very similar places, and I've tried the recommendations for them, just for the heck of it, but none of them work.
这个问题让我的智慧结束了。帮助我,Obi-Wan Kenobi,你是我唯一的希望。
I'm at my wits' end with this problem. Help me, Obi-Wan Kenobi, you are my only hope.
推荐答案
正如echinelli指出的那样,这确实是一个Eclipse(或STS)错误,但安装最新版本不是修复,因为我已经安装了该版本。我已经安装了基于Eclipse 4.x的STS;当我卸载它并转到3.x版本时,问题就消失了。
As echinelli indicated, this did turn out to be an Eclipse (or STS) bug, but installing the latest version isn't the fix, as I already had that version installed. I had installed STS based on Eclipse 4.x; when I uninstalled that and went to the 3.x version, the problem went away.
这篇关于Eclipse在Maven更新期间抛出NullPointerException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!