Other

eclipse/scala-ide 启动报错 NullPointerException at getResources(JFaceResources.java:209)

Eclipse / ScalaIDE 启动报错 NullPointerException at getResources(JFaceResources.java:209)

错误现象

  • 查看启动日志
cat ./scala-workspace/.metadata/.log
...
...
!ENTRY org.eclipse.e4.ui.workbench.swt 4 2 2022-07-29 13:53:49.010
!MESSAGE Problems occurred when invoking code from plug-in: "org.eclipse.e4.ui.workbench.swt".
!STACK 0
java.lang.AssertionError: assertion failed
    at scala.Predef$.assert(Predef.scala:204)
    at scala.tools.scalap.Classfile.<init>(Classfile.scala:17)
    at org.scalaide.core.internal.jdt.model.ScalaClassFileDescriber$.isScala(ScalaClassFileDescriber.scala:16)
...
!ENTRY org.eclipse.e4.ui.workbench 4 0 2022-07-29 13:53:49.309
!MESSAGE 
!STACK 0
java.lang.NullPointerException
    at org.eclipse.jface.resource.JFaceResources.getResources(JFaceResources.java:209)
    at org.eclipse.jface.resource.JFaceResources.getResources(JFaceResources.java:227)
    at org.eclipse.ui.part.WorkbenchPart.dispose(WorkbenchPart.java:100)
...
org.eclipse.osgi.internal.framework.EquinoxBundle$SystemBundle$EquinoxSystemModule$1.run(EquinoxBundle.java:165)
    at java.lang.Thread.run(Thread.java:748)
!SESSION 2022-07-29 13:54:44.671 -----------------------------------------------
eclipse.buildId=4.7.0-vfinal-2017-09-29T14:34:02Z-Typesafe
java.version=1.8.0_281
java.vendor=Oracle Corporation
BootLoader constants: OS=linux, ARCH=x86_64, WS=gtk, NL=en_US
Command-line arguments:  -os linux -ws gtk -arch x86_64

!ENTRY org.eclipse.jface 2 0 2022-07-29 13:54:56.170
!MESSAGE Keybinding conflicts occurred.  They may interfere with normal accelerator operation.
!SUBENTRY 1 org.eclipse.jface 2 0 2022-07-29 13:54:56.170
!MESSAGE A conflict occurred for CTRL+F4:
Binding(CTRL+F4,
    ParameterizedCommand(Command(org.eclipse.ui.file.close,Close,
        Close the active editor,
        Category(org.eclipse.ui.category.file,File,null,true),
        org.eclipse.ui.internal.WorkbenchHandlerServiceHandler@387a81e1,
        ,,true),null),
    org.eclipse.ui.defaultAcceleratorConfiguration,
    org.eclipse.ui.contexts.window,,,system)
Binding(CTRL+F4,
    ParameterizedCommand(Command(org.scala.tools.eclipse.search.commands.OpenTypeHierarchy,Open Type Hierarchy,
        Open Type Hierarchy,
        Category(org.scala.tools.eclipse.search.commands,Search - Scala,Search - Scala,true),
        org.eclipse.ui.internal.WorkbenchHandlerServiceHandler@71f925bf,
        ,,true),null),
    org.eclipse.ui.defaultAcceleratorConfiguration,
    org.eclipse.ui.contexts.window,,,system)
...

原因分析

  • 从日志可知报错空指针,这通常是由于配置损坏、或异常退出导致配置文件不一致错误,因此无法启动,只需删除 workbech 插件配置,然后重启即可。

解决方案

  • 删除旧工作空间配置
rm -rf ./scala-workspace/.metadata/.plugins/org.eclipse.e4.workbench
  • 重启

留言

您的电子邮箱地址不会被公开。