Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMT (Generative Modeling Technologies) » MOFScript Java execution failing with PackageNotFoundException
MOFScript Java execution failing with PackageNotFoundException [message #555334] Thu, 26 August 2010 11:22 Go to next message
Ismar  is currently offline Ismar Friend
Messages: 2
Registered: August 2010
Junior Member
I try to execute the MOFScript transformation as described on the last pages in User Guide 0.8, but the execution fails with following error message:

Exception in thread "main" org.eclipse.emf.ecore.resource.impl.ResourceSetImpl$1Diagnos ticWrappedException: org.eclipse.emf.ecore.xmi.PackageNotFoundException: Package with uri 'http://www.eclipse.org/gmf/runtime/1.0.1/notation' not found. (file:/c:/MyUMLModell.emx, 96, 128)
at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.handleDe mandLoadException(ResourceSetImpl.java:315)
at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.demandLo adHelper(ResourceSetImpl.java:274)
at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.getResou rce(ResourceSetImpl.java:397)
at org.test.myproject.MOFScriptAPI.execute(MOFScriptAPI.java:10 6)
at org.test.myproject.MOFScriptAPI.parseAndExecuteUMLModel(MOFS criptAPI.java:152)
at org.test.myproject.MOFScriptAPI.main(MOFScriptAPI:54)
Caused by: org.eclipse.emf.ecore.xmi.PackageNotFoundException: Package with uri 'http://www.eclipse.org/gmf/runtime/1.0.1/notation' not found. (file:/c:/MyUMLModell.emx, 96, 128)
at org.eclipse.emf.ecore.xmi.impl.XMLHandler.getPackageForURI(X MLHandler.java:2576)
at org.eclipse.emf.ecore.xmi.impl.XMLHandler.getFactoryForPrefi x(XMLHandler.java:2407)
at org.eclipse.emf.ecore.xmi.impl.XMLHandler.createObjectFromTy peName(XMLHandler.java:2057)
at org.eclipse.emf.ecore.xmi.impl.XMLHandler.createObject(XMLHa ndler.java:2016)
at org.eclipse.emf.ecore.xmi.impl.XMIHandler.createObject(XMIHa ndler.java:131)
at org.eclipse.emf.ecore.xmi.impl.XMLHandler.handleFeature(XMLH andler.java:1825)
at org.eclipse.emf.ecore.xmi.impl.XMLHandler.processElement(XML Handler.java:1023)
at org.eclipse.emf.ecore.xmi.impl.XMIHandler.processElement(XMI Handler.java:87)
at org.eclipse.emf.ecore.xmi.impl.XMLHandler.startElement(XMLHa ndler.java:1001)
at org.eclipse.emf.ecore.xmi.impl.XMLHandler.startElement(XMLHa ndler.java:712)
at org.eclipse.emf.ecore.xmi.impl.XMIHandler.startElement(XMIHa ndler.java:167)
at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unk nown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanSt artElement(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$Fragme ntContentDispatcher.dispatch(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDo cument(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unk nown Source)
at org.apache.xerces.jaxp.SAXParserImpl.parse(Unknown Source)
at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.load(XMLLoadImpl. java:181)
at org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.doLoad(XMLRes ourceImpl.java:180)
at org.eclipse.emf.ecore.resource.impl.ResourceImpl.load(Resour ceImpl.java:1445)
at org.eclipse.emf.ecore.resource.impl.ResourceImpl.load(Resour ceImpl.java:1241)
at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.demandLo ad(ResourceSetImpl.java:255)
at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.demandLo adHelper(ResourceSetImpl.java:270)


The code looks like this and the last line is failing:
File sourceModelFile = new File(inputModel); 
                
ResourceSet resourceSet = new ResourceSetImpl(); 
resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put("*",_xmiFac); 
                
URI uri = URI.createFileURI(sourceModelFile.getAbsolutePath()); 
            
Resource resource = resourceSet.getResource(uri, true); 

[Updated on: Thu, 26 August 2010 11:23]

Report message to a moderator

Re: MOFScript Java execution failing with PackageNotFoundException [message #555378 is a reply to message #555334] Thu, 26 August 2010 13:15 Go to previous message
Ismar  is currently offline Ismar Friend
Messages: 2
Registered: August 2010
Junior Member
I solved this problem by adding load option to the resource set, before calling resourceSet.getResource(uri,true):

resourceSet.getLoadOptions().put(XMLResource.OPTION_RECORD_UNKNOWN_FEATURE, Boolean.TRUE);

[Updated on: Thu, 26 August 2010 13:15]

Report message to a moderator

Previous Topic:Unexpected output
Next Topic:[Epsilon - EOL] Cloning model elements
Goto Forum:
  


Current Time: Fri Dec 19 16:44:03 GMT 2014

Powered by FUDForum. Page generated in 0.02866 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software