Problem instantiating model [message #636396] |
Mon, 01 November 2010 01:00 |
|
I generated some classes using EMF and now I want to instantiate them. I've created the xmi files associated with the model and metamodel. Now I want to load the model as an instance in my program, but it keeps throwing a NullPointerException.
My code is:
Map<String,Object> registry = EPackage.Registry.INSTANCE;
String workflowURI = ExcelEditorPackage.eNS_URI;
System.out.println(workflowURI);
ExcelEditorPackage wfPackage = (ExcelEditorPackage) registry.get(workflowURI); //throw NPE here
ExcelEditorFactory wfFactory = wfPackage.getExcelEditorFactory();
Page workflow = wfFactory.createPage();
It throws an at wfFactory because wfPackage is null. My NS URI is "http://www.sg/model" (this URL does not exist). I think something is wrong with the NS URI. SHould I point to some xmi file for the metamodel? All the examples I have seen just point to a random URL.
[Updated on: Mon, 01 November 2010 01:00] Report message to a moderator
|
|
|
|
Powered by
FUDForum. Page generated in 0.03094 seconds