简体   繁体   中英

Java Xtext/EMF Resource Factory Impl NoClassDefFoundError

UPDATE : I solved it by removing and reimporting my project as well the dependencies

I recently updated eclipse from neon3 modeling edition to oxygen2 modeling edition. While my code worked perfectly with neon3 , in oxygen2 after importing my workspace and updating the classpath and the dependencies, while on execution of the program, NoClassDefFoundError occurs on org/eclipse/emf/ecore/xmi/impl/EcoreResourceFactoryImpl .

Here i provide the code that produces the error stack as well a part of the stack

/*
 * 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;
    }


...

}

StackTrace:

    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

Plugin Dependencies:

插件依赖

I have done some research on the net but I couldn't figure out whats wrong. The

确保在插件的依赖项上添加/可用了org.eclipse.emf.ecore.xmi

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM