Java Eclipse RCP应用程序中的NoClassDefFoundError
在我们的应用程序中,当我们试图实例化一个类时,有时(大约10次中有1次)会得到一个错误。当一个项目在没有我们的应用程序的情况下从中打开时,就会发生这种情况 完整堆栈跟踪如下所示:Java Eclipse RCP应用程序中的NoClassDefFoundError,java,eclipse,eclipse-rcp,Java,Eclipse,Eclipse Rcp,在我们的应用程序中,当我们试图实例化一个类时,有时(大约10次中有1次)会得到一个错误。当一个项目在没有我们的应用程序的情况下从中打开时,就会发生这种情况 完整堆栈跟踪如下所示: !ENTRY org.eclipse.jface 4 2 2011-11-18 12:45:33.941 !MESSAGE Problems occurred when invoking code from plug-in: "org.eclipse.jface". !STACK 0 java.lang.NoClass
!ENTRY org.eclipse.jface 4 2 2011-11-18 12:45:33.941
!MESSAGE Problems occurred when invoking code from plug-in: "org.eclipse.jface".
!STACK 0
java.lang.NoClassDefFoundError: com.mycompany.products.myapp.gui.model.provider.EMyAppObjectItemProvider
at com.mycompany.products.myapp.gui.model.provider.MyappguimodelItemProviderAdapterFactory.createMyAppGuiPortAdapter(MyappguimodelItemProviderAdapterFactory.java:159)
at com.mycompany.products.myapp.gui.model.util.MyappguimodelAdapterFactory$1.caseMyAppGuiPort(MyappguimodelAdapterFactory.java:185)
at com.mycompany.products.myapp.gui.model.util.MyappguimodelAdapterFactory$1.caseMyAppGuiPort(MyappguimodelAdapterFactory.java:1)
at com.mycompany.products.myapp.gui.model.util.MyappguimodelSwitch.doSwitch(MyappguimodelSwitch.java:226)
at org.eclipse.emf.ecore.util.Switch.doSwitch(Switch.java:59)
at org.eclipse.emf.ecore.util.Switch.doSwitch(Switch.java:75)
at com.mycompany.products.myapp.gui.model.util.MyappguimodelAdapterFactory.createAdapter(MyappguimodelAdapterFactory.java:462)
at org.eclipse.emf.common.notify.impl.AdapterFactoryImpl.createAdapter(AdapterFactoryImpl.java:133)
at org.eclipse.emf.common.notify.impl.AdapterFactoryImpl.adaptNew(AdapterFactoryImpl.java:107)
at org.eclipse.emf.common.notify.impl.AdapterFactoryImpl.adapt(AdapterFactoryImpl.java:93)
at com.mycompany.products.myapp.gui.model.provider.MyappguimodelItemProviderAdapterFactory.adapt(MyappguimodelItemProviderAdapterFactory.java:1127)
at org.eclipse.emf.edit.provider.ComposedAdapterFactory.adapt(ComposedAdapterFactory.java:300)
at org.eclipse.emf.edit.provider.ComposedAdapterFactory.adapt(ComposedAdapterFactory.java:277)
at org.eclipse.emf.edit.provider.ComposedAdapterFactory.adapt(ComposedAdapterFactory.java:264)
at org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider.getColumnText(AdapterFactoryLabelProvider.java:496)
at org.eclipse.jface.viewers.TableColumnViewerLabelProvider.update(TableColumnViewerLabelProvider.java:70)
at org.eclipse.jface.viewers.ViewerColumn.refresh(ViewerColumn.java:152)
at org.eclipse.jface.viewers.AbstractTableViewer.doUpdateItem(AbstractTableViewer.java:399)
at org.eclipse.jface.viewers.StructuredViewer$UpdateItemSafeRunnable.run(StructuredViewer.java:485)
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.updateItem(StructuredViewer.java:2167)
at org.eclipse.jface.viewers.AbstractTableViewer.createItem(AbstractTableViewer.java:277)
at org.eclipse.jface.viewers.AbstractTableViewer.internalRefreshAll(AbstractTableViewer.java:757)
at org.eclipse.jface.viewers.AbstractTableViewer.internalRefresh(AbstractTableViewer.java:649)
at org.eclipse.jface.viewers.AbstractTableViewer.internalRefresh(AbstractTableViewer.java:636)
at org.eclipse.jface.viewers.AbstractTableViewer$2.run(AbstractTableViewer.java:592)
at org.eclipse.jface.viewers.StructuredViewer.preservingSelection(StructuredViewer.java:1443)
at org.eclipse.jface.viewers.StructuredViewer.preservingSelection(StructuredViewer.java:1404)
at org.eclipse.jface.viewers.AbstractTableViewer.inputChanged(AbstractTableViewer.java:590)
at org.eclipse.jface.viewers.ContentViewer.setInput(ContentViewer.java:280)
at org.eclipse.jface.viewers.StructuredViewer.setInput(StructuredViewer.java:1690)
at com.mycompany.products.myapp.gui.views.port.composites.Ipv4PortComposite.projectOpenedOrClosed(Ipv4PortComposite.java:732)
at com.mycompany.products.myapp.gui.project.MyAppResourceController.tellOpenCloseListeners(MyAppResourceController.java:186)
at com.mycompany.products.myapp.gui.actions.project.MyAppGuiResourceController.openProject(MyAppGuiResourceController.java:266)
at com.mycompany.products.myapp.gui.project.MyAppResourceController.open(MyAppResourceController.java:592)
at com.mycompany.products.myapp.gui.project.MyAppResourceController.openWithoutUpdating(MyAppResourceController.java:612)
at com.mycompany.products.myapp.gui.actions.file.MyAppRecentProjectAction.run(MyAppRecentProjectAction.java:55)
at org.eclipse.jface.action.Action.runWithEvent(Action.java:498)
at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:584)
at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:501)
at org.eclipse.jface.action.ActionContributionItem$5.handleEvent(ActionContributionItem.java:411)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1258)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3588)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3209)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2696)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2660)
at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2494)
at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:674)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:667)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
at com.mycompany.products.myapp.gui.MyAppApplication.start(MyAppApplication.java:175)
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:344)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
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:616)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:622)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:577)
at org.eclipse.equinox.launcher.Main.run(Main.java:1410)
at org.eclipse.equinox.launcher.M
这些相关问题没有回答我的问题:
有人能帮我解决这个问题吗?启动应用程序时,您收到了吗?这听起来像是一些捆绑包还没有初始化。OSGi将根据依赖项启动模块,但当您没有设置适当的依赖项时,会有一个随机元素。我建议你看看这个。如果需要更多信息,可以使用OSGi控制台检查您的环境:
希望这能有所帮助。启动应用程序时,您是否了解这一点?这听起来像是一些捆绑包还没有初始化。OSGi将根据依赖项启动模块,但当您没有设置适当的依赖项时,会有一个随机元素。我建议你看看这个。如果需要更多信息,可以使用OSGi控制台检查您的环境:
希望这有帮助。尝试在启用OSGi控制台的调试器中运行应用程序(
-console
)。为NoClassDefFoundError
添加类断点,或者在有问题的代码行(MyappguimodelItemProviderAdapterFactory.java:159
)上添加类断点
并且,当遇到断点时:
- 使用
查找捆绑包的捆绑包ID,例如使用MyappguimodelItemProviderAdapterFactory
OSGi命令ss
- 使用
OSGi命令查找bundle的完整状态bundle
- 检查有问题的包--
“导入的包”部分是否正确连接com.mycompany.products.myapp.gui.model.provider
- 已设置正确的软件包接线-可能使用
OSGi命令查找所有提供程序packages com.mycompany.products.myapp.gui.model.provider
- 带有
的捆绑包实际上包含了这个类-您可以通过EMyAppObjectItemProvider
OSGi命令找到OSGi使用的jar(不要假设您知道:-)status
-console
)。为NoClassDefFoundError
添加类断点,或者在有问题的代码行(MyappguimodelItemProviderAdapterFactory.java:159
)上添加类断点
并且,当遇到断点时:
- 使用
查找捆绑包的捆绑包ID,例如使用MyappguimodelItemProviderAdapterFactory
OSGi命令ss
- 使用
OSGi命令查找bundle的完整状态bundle
- 检查有问题的包--
“导入的包”部分是否正确连接com.mycompany.products.myapp.gui.model.provider
- 已设置正确的软件包接线-可能使用
OSGi命令查找所有提供程序packages com.mycompany.products.myapp.gui.model.provider
- 带有
的捆绑包实际上包含了这个类-您可以通过EMyAppObjectItemProvider
OSGi命令找到OSGi使用的jar(不要假设您知道:-)status
- 对于类加载问题,Java提供了一些工具。看幻灯片。我曾经在集成到RCP产品中的Eclipse帮助系统中遇到过类似的问题。在IDE中启动时,一切正常,但在启动导出的产品时,帮助系统无法启动。对于类加载问题,Java提供了一些工具。看幻灯片。我曾经在集成到RCP产品中的Eclipse帮助系统中遇到过类似的问题。在IDE中启动时,一切正常,但在启动导出的产品时,帮助系统不会出现。它发生在程序启动后不久,通常是在第一次用户操作时。我还认为它与依赖关系管理有关,但还没有发现任何错误。我来看看你的链接。EmyappObjectTemprovider类和MyAppApplication类在同一个包中吗?这是否总是发生在同一个班级?类在同一个捆绑包中?EmyappObjectTemprovider和MyAppApplication在不同的捆绑包中。是的,它总是发生在同一个类、同一行代码中。它发生在程序启动后不久,通常是在第一次用户操作时。我还认为它与依赖关系管理有关,但还没有发现任何错误。我来看看你的链接。EmyappObjectTemprovider类和MyAppApplication类在同一个包中吗?这是否总是发生在同一个班级?类在同一个捆绑包中?EmyappObjectTemprovider和MyAppApplication在不同的捆绑包中。是的,它总是发生在同一个类、同一行代码中。