我正在从3.7(Indigo)将RCP应用程序升级到4.4(Luna)框架。该应用程序在3.7中正常工作但在4.4中使用org.eclipse.swt.SWTException失败:无效的线程访问。
有动态服务(DS)启动应用程序服务以提供对数据库的访问。当我从清单中删除DS引用时,应用程序启动,但在没有DS的情况下无法完全运行。
到目前为止,我已尝试更改创建和使用DS的捆绑包的开始顺序/优先级,但这并未解决问题。
有关如何进行故障排除和解决此问题的任何建议?
更新
跟踪错误,在Display.checkDevice()方法中创建E4工作台时失败。
完整堆栈跟踪
org.eclipse.swt.SWTException: Invalid thread access
at org.eclipse.swt.SWT.error(SWT.java:4441)
at org.eclipse.swt.SWT.error(SWT.java:4356)
at org.eclipse.swt.SWT.error(SWT.java:4327)
at org.eclipse.swt.widgets.Display.error(Display.java:1258)
at org.eclipse.swt.widgets.Display.checkDevice(Display.java:764)
at org.eclipse.swt.widgets.Display.getHighContrast(Display.java:1864)
at org.eclipse.e4.ui.internal.workbench.swt.E4Application.setCSSContextVariables(E4Application.java:327)
at org.eclipse.e4.ui.internal.workbench.swt.E4Application.createE4Workbench(E4Application.java:305)
at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:601)
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 com.easa.acmotor.base.Application.start(Application.java:24)
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:380)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:235)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
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)
答案 0 :(得分:0)
该问题与动态服务无关。
经过几次长调试会话后,通过在Display对象的构造函数中放置一个中断来确定根本原因。这使我们能够在其中一个执行Display.getDefault()的插件的Activator中找到一些非常旧的代码。在3.7中,在初始化Display之后调用了Activator,在4.4中,这个时间发生了变化,因此在应用程序初始化Display之前调用了Activator。