当调试命中断点时,Eclipse Luna会给出NullPointerException

时间:2015-07-28 13:22:02

标签: eclipse debugging nullpointerexception perspective

每当我在代码中遇到断点时,我都会看到一个令人讨厌的对话框,通知我“透视切换作业遇到了问题”,其中的详细信息只是说“NullPointerException”。错误日志显示此堆栈跟踪:

java.lang.NullPointerException
    at org.eclipse.ui.internal.WorkbenchPage.showPart(WorkbenchPage.java:1298)
    at org.eclipse.ui.internal.WorkbenchPage.busyShowView(WorkbenchPage.java:1269)
    at org.eclipse.ui.internal.WorkbenchPage$13.run(WorkbenchPage.java:4144)
    at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)
    at org.eclipse.ui.internal.WorkbenchPage.showView(WorkbenchPage.java:4140)
    at org.eclipse.debug.internal.ui.views.ViewContextService.showViewQuiet(ViewContextService.java:1168)
    at org.eclipse.debug.internal.ui.launchConfigurations.PerspectiveManager$4.runInUIThread(PerspectiveManager.java:528)
    at org.eclipse.debug.internal.ui.launchConfigurations.PerspectiveManager$MyUIJob$1.run(PerspectiveManager.java:229)
    at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
    at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:136)
    at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:4147)
    at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3764)
    at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.run(PartRenderingEngine.java:1151)
    at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
    at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1032)
    at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:148)
    at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:636)
    at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
    at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:579)
    at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:150)
    at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:135)
    at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:382)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:236)
    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:648)
    at org.eclipse.equinox.launcher.Main.basicRun(Main.java:603)
    at org.eclipse.equinox.launcher.Main.run(Main.java:1465)
    at org.eclipse.equinox.launcher.Main.main(Main.java:1438)

我已尝试通过Options / Run / Debug / Perspectives禁用透视切换(我不想要),方法是将“Debug”透视图设置为“None”,但它会不断重置为“Debug”,并且不会改变这种行为。

这非常烦人,使调试几乎无法使用。

我尝试将-clean添加到eclipse.ini中,如Myeclipse is throwing some error when i debug server所示......但这也没有影响。

想法?

2 个答案:

答案 0 :(得分:14)

我在Eclipse Mars中遇到了同样的问题(可能是一个bug)。到达的每个断点都会打开您描述的错误对话框。

我能够通过更新以下首选项(Luna中也存在)来防止错误:

  1. 转到窗口> 选择
  2. 在左侧,转到运行/调试> 透视
  3. 应用程序类型/启动器列表中,选择要调试的应用程序类型。
  4. Modes / Perspectives 下的右侧,确保为 Debug 下拉列表选择 None
  5. 注意:我无法找到任何完全禁用所有应用程序类型的透视切换的设置,因此您必须为调试的每种类型执行此操作。

答案 1 :(得分:0)

在窗口中执行此步骤>偏好> Android>皮棉错误检查;取消选中“保存文件时检查错误”。