Eclipse EMF-Xtext – how to fix “feature ‘xmi’ not found”

Sometimes strange problems occur out of nowhere when running the MWE2-workflow for an Xtext Grammar.

You are getting the exception “feature ‘xmi’ not found” for ecore.ecore, ecore.genmodel,… We got bitten by that quite a few times. But there was a simple workaround for it: Create a new workspace with only the DSL based on the grammar in question and run the workflow there, and most probably things will work fine again. However, this didn’t help in all cases.

Yesterday in particular, even the “new workspace” approach did not resolve the problem. So we had to start debugging the MWE2-workflow based on two Xtext grammars. Grammar 1 worked fine, but grammar 2 crashed with the exception above.

After some toil, we could figure out that the properly running MWE2-workflow uses the SAXParser from “com.sun.org.apache. xerces.internal.parsers.SAXParser”, whereas the buggy MWE2-workflow somehow uses the “org.apache.xerces.parsers.SAXParser”.

With this in mind, it seems that the simplest workaround for that problem is to add the following to the VM arguments in the launch configuration of the MWE2 workflow:

-Djavax.xml.parsers.SAXParserFactory=

com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl

This property ensures that the proper SaxParser is used, and the problem does not occur anymore.

Best regards,

Klemens and Florian

Advertisements

Tags: , , , , , , ,

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


%d bloggers like this: