Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [emf-dev] why I got the following errors when a standalone app try to load EMF model



Ruo,

Please ask questions on the newsgroup; this question was recently asked
there.  When running standalone, you need to make sure each EPackage is
registered.  Calling EcorePackage.eINSTANCE.getEFactoryInstance before the
load should do the trick.


Ed Merks/Toronto/IBM@IBMCA
mailto: merks@xxxxxxxxxx
905-413-3265  (t/l 969)




                                                                           
             Ruo Bo Huang                                                  
             <huangrb@xxxxxx.c                                             
             om>                                                        To 
             Sent by:                  emf-dev@xxxxxxxxxxx                 
             emf-dev-admin@ecl                                          cc 
             ipse.org                                                      
                                                                   Subject 
                                       [emf-dev] why I got the following   
             04/12/2004 06:14          errors when a standalone app try to 
             AM                        load EMF model                      
                                                                           
                                                                           
             Please respond to                                             
                  emf-dev                                                  
                                                                           
                                                                           





Hi. I am trying to use the following code to load a EMF model into my
standalone app. but got exception, who know why it happen:

code:

String fileName="c:/test.ecore";
URI ModelURI= URI.createFileURI(fileName);
ResourceSet resourceset = new ResourceSetImpl();
Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put("ecore",new
 XMIResourceFactoryImpl());


Resouce resource= resourceSet.getResource(ModelURI, true); //Exception was
throw here


the exception is:

Package with uri 'http://www.eclipse.org/emf/2002/ECore' not found.
at
org.eclipse.emf.ecore.xmi.imple.XMLHandler.getPackageForURI(XMLHandler.java:1029)

.......


Thanks.
Huang RB



Back to the top