更新:我通过删除和重新导入我的项目以及依赖项来解决它
我最近将eclipse从 neon3 建模版更新为 oxygen2 建模版。虽然我的代码与 neon3 完美配合,但在导入我的工作空间并更新类路径和依赖项后,在 oxygen2 中,在执行程序时,NoClassDefFoundError
发生在org/eclipse/emf/ecore/xmi/impl/EcoreResourceFactoryImpl
。
这里我提供了产生错误堆栈的代码以及堆栈的一部分
/*
* generated by Xtext 2.10.0
*/
public class MyAppDslStandaloneSetupGenerated implements ISetup {
@Override
public Injector createInjectorAndDoEMFRegistration() {
// register default ePackages
if (!Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().containsKey("ecore"))
Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put(
"ecore", new EcoreResourceFactoryImpl());
if (!Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().containsKey("xmi"))
Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put(
"xmi", new XMIResourceFactoryImpl());
Injector injector = createInjector();
register(injector);
return injector;
}
...
}
堆栈跟踪:
Exception in thread "AWT-EventQueue-0" java.lang.NoClassDefFoundError: org/eclipse/emf/ecore/xmi/impl/EcoreResourceFactoryImpl
at com.xtext.myapp.MyAppDslStandaloneSetupGenerated.createInjectorAndDoEMFRegistration(MyAppDslStandaloneSetupGenerated.java:27)
...
Caused by: java.lang.ClassNotFoundException: org.eclipse.emf.ecore.xmi.impl.EcoreResourceFactoryImpl
插件依赖项:
我在网上做了一些研究,但我无法弄清楚什么是错的。
答案 0 :(得分:0)
确保在插件
的依赖项上添加/可用org.eclipse.emf.ecore.xmi