java 在PartServiceImpl.internalFixContext中的Eclipse中的NullPointerException

ctrmrzij  于 2023-05-27  发布在  Java
关注(0)|答案(7)|浏览(111)

我有一个关于eclipse IDE的问题,我不能打开我的工作空间中的任何文件;如果我尝试打开文件,eclipse将警告下面的错误对话框

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

我在workspace的. 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$22(WorkbenchPage.java:2969)
    at org.eclipse.ui.internal.WorkbenchPage$8.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$4.open(PackageExplorerPart.java:538)
    at org.eclipse.ui.OpenAndLinkWithEditorHelper$InternalListener.open(OpenAndLinkWithEditorHelper.java:48)
    at org.eclipse.jface.viewers.StructuredViewer$2.run(StructuredViewer.java:866)
    at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
    at org.eclipse.ui.internal.JFaceUtil$1.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$6.handleOpen(StructuredViewer.java:1256)
    at org.eclipse.jface.util.OpenStrategy.fireOpenEvent(OpenStrategy.java:275)
    at org.eclipse.jface.util.OpenStrategy.access$2(OpenStrategy.java:269)
    at org.eclipse.jface.util.OpenStrategy$1.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$9.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$5.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)

我该怎么解决这个问题-有什么办法吗?

vjrehmav

vjrehmav1#

Eclipse有一个bug:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=385680
您可以尝试重新启动Eclipse,它帮助了问题的原始海报。

c7rzv4ha

c7rzv4ha2#

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

f2uvfpb9

f2uvfpb93#

我也遇到了这个错误。刚才我打开了新窗口,即窗口->新窗口在eclipse。然后,我关闭了我的旧窗口。这解决了我的问题。

a8jjtwal

a8jjtwal4#

嗨,那可能是项目的问题
选择项目并设置eclipse:

project -> clean...
gopyfrb3

gopyfrb35#

退出eclipse后,我将.eclipse(在用户的主目录中)移到. eclipse.old(以防我可能必须撤消)。这个错误不再出现了,我的项目在重新启动eclipse后工作正常。
注意:我有一个简单的设置,这可能不是最好的环境与高级设置。
我张贴这作为一个单独的答案,因为以前列出的方法不适合我。

62lalag4

62lalag46#

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

ee7vknir

ee7vknir7#

**这个解决方案也很好用!!**我在eclipse中也遇到了这个问题,只是在一些文件中,而不是在所有文件中。

当以下解决方案不起作用时

  1. eclipse重启后
    1.清洗后
    1.打开新窗口后

解决方案:-

1.请从Eclipse工作区备份您的文件
1.从工作区中删除文件
1.创建具有相同名称的文件并保存备份文件中的代码
1.然后它开始正常工作!!
这是工作的罚款!!。你也可以试试这个。

相关问题