Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Texo/Troubleshooting

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 build.properties.

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.emf.texo.eclipse.popup.actions.BaseGenerateAction.run(BaseGenerateAction.java:76)
	at org.eclipse.ui.internal.PluginAction.runWithEvent(PluginAction.java:251)
	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:3540)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3161)
	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2640)
	at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2604)
	at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2438)
	at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:671)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:664)

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(Check.java:66)
    at
org.eclipse.emf.texo.model.ModelResolver.getModelDescriptor(ModelResolver.java:263)
    at
org.eclipse.emf.texo.model.ModelResolver.getModelObject(ModelResolver.java:208)
    at
org.eclipse.emf.texo.xml.ModelEMFConverter.createTarget(ModelEMFConverter.java:134)
    at
org.eclipse.emf.texo.xml.ModelEMFConverter.convert(ModelEMFConverter.java:86)
    at org.eclipse.emf.texo.xml.ModelXMLSaver.write(ModelXMLSaver.java:72)

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(XMLHandler.java:1307)
	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.createTopObject(XMLHandler.java:1468)
	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.processElement(XMLHandler.java:1019)
	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.startElement(XMLHandler.java:1001)
	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.startElement(XMLHandler.java:712)
	at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:501)
	at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.startElement(XMLDTDValidator.java:767)
	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanStartElement(XMLDocumentFragmentScannerImpl.java:1363)
	at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$ContentDriver.scanRootElementHook(XMLDocumentScannerImpl.java:1318)
	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:3103)
	at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(XMLDocumentScannerImpl.java:922)
	at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:648)
	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:511)
	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:808)
	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737)
	at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:119)
	at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1205)
	at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:522)
	at javax.xml.parsers.SAXParser.parse(SAXParser.java:395)
	at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.load(XMLLoadImpl.java:264)
	... 5 more

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

xmlns="http://my.model"
targetNamespace="http://my.model"

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

Back to the top