Java NullPointerException 在 Eclipse 本身在 PartServiceImpl.internalFixContext

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/22953084/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-13 19:35:10  来源:igfitidea点击:

NullPointerException in eclipse in Eclipse itself at PartServiceImpl.internalFixContext

javaeclipsenullpointerexception

提问by King_Dark

I have a problem about eclipse IDE, I can't open any file in my work space; if I try to open file, eclipse will alert the following error dialog

我有一个关于 Eclipse IDE 的问题,我无法在我的工作空间中打开任何文件;如果我尝试打开文件,eclipse 会提示以下错误对话框

"An error has occurred. See error log for more details. java.lang.NullPointerException"

I go to see .log file in .meta at workspace and I see a paragraph in the file like this:

我去工作区的 .meta 中查看 .log 文件,我在文件中看到这样的一段:

!ENTRY org.eclipse.jface 4 2 2557-04-09 11:40:49.422
!MESSAGE Problems occurred when invoking code from plug-in: "org.eclipse.jface".
!STACK 0
java.lang.NullPointerException
    at org.eclipse.e4.ui.internal.workbench.PartServiceImpl.internalFixContext(PartServiceImpl.java:380)
    at org.eclipse.e4.ui.internal.workbench.PartServiceImpl.bringToTop(PartServiceImpl.java:341)
    at org.eclipse.e4.ui.internal.workbench.PartServiceImpl.showPart(PartServiceImpl.java:1029)
    at org.eclipse.ui.internal.WorkbenchPage.busyOpenEditor(WorkbenchPage.java:3047)
    at org.eclipse.ui.internal.WorkbenchPage.access(WorkbenchPage.java:2969)
    at org.eclipse.ui.internal.WorkbenchPage.run(WorkbenchPage.java:2951)
    at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)
    at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2947)
    at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2911)
    at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2902)
    at org.eclipse.ui.ide.IDE.openEditor(IDE.java:655)
    at org.eclipse.ui.ide.IDE.openEditor(IDE.java:614)
    at org.eclipse.jdt.internal.ui.javaeditor.EditorUtility.openInEditor(EditorUtility.java:360)
    at org.eclipse.jdt.internal.ui.javaeditor.EditorUtility.openInEditor(EditorUtility.java:167)
    at org.eclipse.jdt.ui.actions.OpenAction.run(OpenAction.java:249)
    at org.eclipse.jdt.ui.actions.OpenAction.run(OpenAction.java:228)
    at org.eclipse.jdt.ui.actions.SelectionDispatchAction.dispatchRun(SelectionDispatchAction.java:275)
    at org.eclipse.jdt.ui.actions.SelectionDispatchAction.run(SelectionDispatchAction.java:251)
    at org.eclipse.jdt.internal.ui.packageview.PackageExplorerActionGroup.handleOpen(PackageExplorerActionGroup.java:376)
    at org.eclipse.jdt.internal.ui.packageview.PackageExplorerPart.open(PackageExplorerPart.java:538)
    at org.eclipse.ui.OpenAndLinkWithEditorHelper$InternalListener.open(OpenAndLinkWithEditorHelper.java:48)
    at org.eclipse.jface.viewers.StructuredViewer.run(StructuredViewer.java:866)
    at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
    at org.eclipse.ui.internal.JFaceUtil.run(JFaceUtil.java:49)
    at org.eclipse.jface.util.SafeRunnable.run(SafeRunnable.java:175)
    at org.eclipse.jface.viewers.StructuredViewer.fireOpen(StructuredViewer.java:864)
    at org.eclipse.jface.viewers.StructuredViewer.handleOpen(StructuredViewer.java:1152)
    at org.eclipse.jface.viewers.StructuredViewer.handleOpen(StructuredViewer.java:1256)
    at org.eclipse.jface.util.OpenStrategy.fireOpenEvent(OpenStrategy.java:275)
    at org.eclipse.jface.util.OpenStrategy.access(OpenStrategy.java:269)
    at org.eclipse.jface.util.OpenStrategy.handleEvent(OpenStrategy.java:309)
    at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053)
    at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4169)
    at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3758)
    at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1053)
    at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
    at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:942)
    at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:86)
    at org.eclipse.ui.internal.Workbench.run(Workbench.java:588)
    at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
    at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:543)
    at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
    at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:124)
    at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:353)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:180)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:629)
    at org.eclipse.equinox.launcher.Main.basicRun(Main.java:584)
    at org.eclipse.equinox.launcher.Main.run(Main.java:1438)
    at org.eclipse.equinox.launcher.Main.main(Main.java:1414)

How can I solve this problem - any idea?

我该如何解决这个问题 - 有什么想法吗?

采纳答案by Niko

There is a bug filed for Eclipse:

有一个错误提交给Eclipse

https://bugs.eclipse.org/bugs/show_bug.cgi?id=385680

https://bugs.eclipse.org/bugs/show_bug.cgi?id=385680

You could try restarting Eclipse, it helped the original poster of the issue there.

你可以尝试重新启动Eclipse,它帮助了那里问题的原始海报。

回答by Jameer Mulani

Better you update your eclipse by clicking it on help >> check for updates, also you can start eclipse by entering command in command prompt eclipse -clean.
Hope this will help you.

最好通过单击help >> check for updates 来更新eclipse,也可以通过在命令提示符eclipse -clean 中输入命令来启动 eclipse 。
希望这会帮助你。

回答by chinacheng

hi,that maybe the project's problem,

你好,那可能是项目的问题,

chose the project and setting you eclipse:

选择项目并设置您的日食:

project -> clean... 

回答by arunprakashpj

I have also encountered this error . Just i opened the new window ie Window -> New Window in eclipse .Then , I closed my old window. This solved my problem.

我也遇到过这个错误。只是我打开了新窗口,即 Window -> eclipse 中的新窗口。然后,我关闭了旧窗口。这解决了我的问题。

回答by Amitabh

After exiting eclipse I moved .eclipse (found in the user's home directory) to .eclipse.old (just in case I may have had to undo). The error does not show up any more and my projects are working fine after restarting eclipse.

退出 eclipse 后,我将 .eclipse(在用户的主目录中找到)移动到 .eclipse.old(以防万一我可能不得不撤消)。该错误不再出现,并且我的项目在重新启动 eclipse 后工作正常。

Caution: I have a simple setup and this may not be the best for environments with advanced settings.

注意:我有一个简单的设置,这对于具有高级设置的环境来说可能不是最好的。

I am posting this as a separate answer as previously listed methods did not work for me.

我将此作为单独的答案发布,因为之前列出的方法对我不起作用。

回答by snipersap

I faced the same error, but only with files cloned from git that were assigned to a proprietary plugin. I realized that even after cloning the files from git, I needed to create a new project or import a project in eclipse and this resolved the error.

我遇到了同样的错误,但只有从分配给专有插件的 git 克隆的文件。我意识到即使从 git 克隆文件后,我也需要创建一个新项目或在 eclipse 中导入一个项目,这解决了错误。