When I try to load an EMF file I get the following error:
Exception thrown: org.eclipse.emf.ecore.resource.Resource$IOWrappedException: Package with uri 'blah/blah' not found. (file:/C:/Temp/OPDiag1/blah1.opmeta, 2, 124)
The code I am using to try and load:
opmetaFactory.eINSTANCE.eClass();
Resource opmmResource = resourceSet.createResource(URI.createURI(uri));
try {
opmmResource.load(null);
opd = (OPMetaModelDiagram) opmmResource.getContents().get(0);
} catch(final IOException e) {
// log
}
Does anyone have any ideas why I get this error?
You need to register the package of the metamodel in the package registry first:
resourceSet.getPackageRegistry().put(BlahPackage.eNS_URI, BlahPackage.eINSTANCE);
For an UML model for example it would be "UMLPackage.eNS_URI" etc. In your case, I suppose it must something like "OpmetaPackage.eNS_URI" and "OpmetaPackage.eINSTANCE".