Community
Participate
Working Groups
Adding a reference to the model with the following URI, leads to an NPE: fragment = ecore.EcoreGeneratorFragment { referencedGenModels="platform:/resource/com.netxforge.netxstudio.models/models/emf/13042011/netxstudio.genmodel" } It can always be reproduced. (Using build from IndigoRC1). java.lang.NullPointerException at org.eclipse.emf.codegen.ecore.genmodel.impl.GenModelImpl.setImportManager(GenModelImpl.java:2136) at org.eclipse.emf.codegen.ecore.genmodel.impl.GenModelImpl.setImportManager(GenModelImpl.java:2136) at org.eclipse.emf.codegen.ecore.genmodel.generator.GenBaseGeneratorAdapter.updateImportManager(GenBaseGeneratorAdapter.java:327) at org.eclipse.emf.codegen.ecore.genmodel.generator.GenBaseGeneratorAdapter.clearImportManager(GenBaseGeneratorAdapter.java:320) at org.eclipse.emf.codegen.ecore.generator.AbstractGeneratorAdapter.generateJava(AbstractGeneratorAdapter.java:1124) at org.eclipse.emf.codegen.ecore.genmodel.generator.GenClassGeneratorAdapter.generateInterface(GenClassGeneratorAdapter.java:123) at org.eclipse.emf.codegen.ecore.genmodel.generator.GenClassGeneratorAdapter.generateModel(GenClassGeneratorAdapter.java:106) at org.eclipse.emf.codegen.ecore.genmodel.generator.GenBaseGeneratorAdapter.doGenerate(GenBaseGeneratorAdapter.java:221) at org.eclipse.emf.codegen.ecore.generator.AbstractGeneratorAdapter.generate(AbstractGeneratorAdapter.java:290) at org.eclipse.emf.codegen.ecore.generator.Generator.generate(Generator.java:617) at org.eclipse.emf.codegen.ecore.generator.Generator.generate(Generator.java:528) at org.eclipse.xtext.generator.ecore.EcoreGeneratorFragment.doGenerate(EcoreGeneratorFragment.java:134) at org.eclipse.xtext.generator.ecore.EcoreGeneratorFragment.generate(EcoreGeneratorFragment.java:175) at org.eclipse.xtext.generator.CompositeGeneratorFragment.generate(CompositeGeneratorFragment.java:81) at org.eclipse.xtext.generator.LanguageConfig.generate(LanguageConfig.java:69) at org.eclipse.xtext.generator.Generator.generate(Generator.java:351) at org.eclipse.xtext.generator.Generator.invokeInternal(Generator.java:125) at org.eclipse.emf.mwe.core.lib.AbstractWorkflowComponent.invoke(AbstractWorkflowComponent.java:126) at org.eclipse.emf.mwe.core.lib.Mwe2Bridge.invoke(Mwe2Bridge.java:34) at org.eclipse.emf.mwe.core.lib.AbstractWorkflowComponent.invoke(AbstractWorkflowComponent.java:201) at org.eclipse.emf.mwe2.runtime.workflow.AbstractCompositeWorkflowComponent.invoke(AbstractCompositeWorkflowComponent.java:35) at org.eclipse.emf.mwe2.runtime.workflow.Workflow.run(Workflow.java:19) at org.eclipse.emf.mwe2.launch.runtime.Mwe2Runner.run(Mwe2Runner.java:97) at org.eclipse.emf.mwe2.launch.runtime.Mwe2Runner.run(Mwe2Runner.java:73) at org.eclipse.emf.mwe2.launch.runtime.Mwe2Runner.run(Mwe2Runner.java:64) at org.eclipse.emf.mwe2.launch.runtime.Mwe2Runner.run(Mwe2Runner.java:55) at org.eclipse.emf.mwe2.launch.runtime.Mwe2Launcher.run(Mwe2Launcher.java:74) at org.eclipse.emf.mwe2.launch.runtime.Mwe2Launcher.main(Mwe2Launcher.java:35)
could you please try the following steps: 1. open the genmodel in EMF's genmodel-editor and run "reload" from the context menu. Walk through all of the wizards steps. 2. In the context menu of the genmodel's root-node, run "validate". Make sure no errors are found. If you still get the error, can you please attach your *.mwe file, the grammar, and all invoved *.genmodels and *.ecore models. Furthermore, could you use org.eclipse.emf.mwe.utils.StandaloneSetup.addRegisterGenModelFile(String) instead of EcoreGeneratorFragment.referencedGenModels? I assume this error is cause by unresolved proxies. Maybe we should validate for this before the GenModel is registered. I've been running in similar NPEs myself before and they're not very helpful at all to find the error's cause.
> 1. open the genmodel in EMF's genmodel-editor and run "reload" from the context > menu. Walk through all of the wizards steps. reload occurs without errors or warnings. The model is valid and in use for som time, I should mention is based on .xsd, so many of the primitive types are XML types. It consists of many different .xsd files which are referenced and imported. I also use a CDO version of the model which loads without problems in the CDO repository. > 2. In the context menu of the genmodel's root-node, run "validate". Make sure > no errors are found. mmh, I am frequent user of EMF, but I notice now the validate action is not available in the popup menu. > > If you still get the error, can you please attach your *.mwe file, the grammar, > and all invoved *.genmodels and *.ecore models. > The error is easily reproducable. I will attach the models to this bug and the mwe2 file. > Furthermore, could you use > org.eclipse.emf.mwe.utils.StandaloneSetup.addRegisterGenModelFile(String) > instead of EcoreGeneratorFragment.referencedGenModels? > Ok, will try. > I assume this error is cause by unresolved proxies. Maybe we should validate > for this before the GenModel is registered. I've been running in similar NPEs > myself before and they're not very helpful at all to find the error's cause. yep, not usefull NPE.
Created attachment 197084 [details] zip file with model. zip file with complete model.
Created attachment 197085 [details] workflow file.
Hi Moritz, I still get this problem, with the attached model. I have now referenced the .genmodel as this in .mwe2 bean = StandaloneSetup { scanClassPath = true platformUri = "${runtimeProject}/.." registerGenModelFile = "platform:/resource/com.netxforge.netxstudio.models/models/emf/13042011/netxstudio.genmodel" } It could this be a problem, in which the .genmodel is processed, as I have many EPackage definitions? So the order in which the EPackages appear in the .genmodel? Christophe
Mortiz, I also need to mention this model is based on .xsd, and there for some types are XML types like this one in generics.ecore: "ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//DateTime" Can xtext deal with these types of models? Can you reproduce on your end? <eStructuralFeatures xsi:type="ecore:EAttribute" name="begin" eType="ecore:EDataType http://www.eclipse.org/emf/2003/XMLType#//DateTime"> <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel"> <details key="documentation" value="The Begin attribute holds the starting date time of the range."/> </eAnnotations> <eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData"> <details key="kind" value="attribute"/> <details key="name" value="Begin"/> </eAnnotations> </eStructuralFeatures>
Hi, I debugged the problem, and tracked it down to a proxy URI reference to the ecore EPackage (Which wasn't really needed). The method (GenModelHelper), genModel.getUsedGenPackages. returns a GenPackage with an empty ecorePackage field, with method EPackage getEcorePackage() returning null. Further on in registerGenModel() line 64 String nsURI = pkg.getEcorePackage().getNsURI(); causes the null exception. I worked around this, by removing the ecore EPackage which appeared in my .genmodel as: usedGenPackages="platform:/plugin/org.eclipse.emf.ecore/model/Ecore.genmodel#//ecore"
I am hitting this error too... :(
Possible Workaround: register an uri mapping from platfrom:/resource/.../model/Ecore.ecore to its http URI in the standalone setup of the workflow
I had to replace 'platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore#' with 'http://www.eclipse.org/emf/2002/Ecore#' in all my .ecore files to work around the NPE.
Will investigate for 2.1.1
(In reply to comment #10) > I had to replace 'platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore#' > with 'http://www.eclipse.org/emf/2002/Ecore#' in all my .ecore files to work > around the NPE. If you want to refer to something from ecore which is not an EDataType and not EObject itself, you have to use platform:/resource or platform:/plugin in the ecore files. Otherwise you'll end up with inconsistencies. I'll update the docs to make this more clear.
Updated docs as well as quickfixes for inconsistent imported packages are available with 2.1.1 Marked as resolved.
Sorry to re-up that bug which seems burried for years. But I'm facing that problem, exactly. I'm using Mars.2 Release (4.5.2).
Requested via bug 522520. -M.