Skip to main content

Notice: This Wiki is now read only and edits are no longer possible. Please see: for the plan.

Jump to: navigation, search


< Texo
Revision as of 14:49, 15 December 2012 by Unnamed Poltroon (Talk) (Using maven, getting NPE or ecore file not found exception at runtime)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Using maven, getting NPE or ecore file not found exception at runtime

When generating code through Texo an ecore file is copied to the src folder and should also be present in the output folder (bin or build) and in the packaged jar file. In Eclipse java project this often works out-of-the-box, for a plugin project sometimes the ecore file in the source folder has to be added to the

For maven you need to explicitly specify/tell maven to copy the ecore file. See these links for more information:

Prevent/handle SQL reserved words in db schema names

Texo will generate column and other annotations using the java property name. The java property name can be a reserved word in SQL resulting in errors.

To prevent the error set an ORM specific runtime options to do global escaping of keywords:

  • hibernate: hibernate.globally_quoted_identifiers=true
  • eclipse link: currently not possible but a feature request has been entered: feature request

Note: escaping of sql names means that the casing is preserved, so multi-case words will result in multi-case db schema names.

Exception while generating, when changing a type from interface to class or back

In the properties of an eclass you can specify if the eclass should be represented by an interface or java class (the 'interface' attribute). When changing this attribute from true to false then it is possible that Texo will not be able to generate a correct source. This happens because of an error in the merging of the generated and existing source code. A work around for this issue is to manually remove the source and then regenerate. This issue will be solved when the merging logic is revisited (a very long term topic...).

java.lang.IllegalStateException: Exception while generating
	at org.eclipse.ui.internal.PluginAction.runWithEvent(
	at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(
	at org.eclipse.jface.action.ActionContributionItem.access$2(
	at org.eclipse.jface.action.ActionContributionItem$5.handleEvent(
	at org.eclipse.swt.widgets.EventTable.sendEvent(
	at org.eclipse.swt.widgets.Widget.sendEvent(
	at org.eclipse.swt.widgets.Display.runDeferredEvents(
	at org.eclipse.swt.widgets.Display.readAndDispatch(
	at org.eclipse.ui.internal.Workbench.runEventLoop(
	at org.eclipse.ui.internal.Workbench.runUI(
	at org.eclipse.ui.internal.Workbench.access$4(
	at org.eclipse.ui.internal.Workbench$
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(

Class not managed by this ModelResolver

You encounter an issue like this when making use of Texo runtime functionality:

org.eclipse.emf.texo.Library is not managed by this ModelResolver
    at org.eclipse.emf.texo.utils.Check.isNotNull(
    at org.eclipse.emf.texo.xml.ModelXMLSaver.write(

To solve this: when you make use of certain parts of Texo at runtime you need to be sure that you have 'touched' the generated ModelPackage classes in your code somewhere. A generated ModelPackage automatically initializes itself when you refer to it in your code (see the generated INSTANCE static member).

NPE when de-serializing/reading from XML/XMI

When reading XML/XMI when you get the NPE below then you probably miss a namespace declaration in your XML schema.

Caused by: org.eclipse.emf.ecore.xmi.PackageNotFoundException: Package with uri 'null' not found. (, 2, 150)
	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.createObjectByType(
	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.createTopObject(
	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.processElement(
	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.startElement(
	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.startElement(
	at javax.xml.parsers.SAXParser.parse(
	at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.load(
	... 5 more

A namespace can be defined in your XML Schema like this:


Where the URI should be a fully qualified URI, that gives the best results. For this namespace the code will generated in the java package.

Back to the top