Thursday, December 23, 2010

Solving inside Eclipse IDE: org.eclipse.emf.ecore.xmi.PackageNotFoundException: Package with uri 'http://*' not found

When opening an XMI file (EMF model) inside the Eclipse Modeling IDE you may sometimes encounter the following error:

org.eclipse.emf.ecore.resource.impl.ResourceSetImpl$1DiagnosticWrappedException: org.eclipse.emf.ecore.xmi.PackageNotFoundException: Package with uri 'http://www.abispulsa.com/model/1.0' not found. (platform:/resource/com.abispulsa.model/src/model/Catalog.xmi, 2, 126)
at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.handleDemandLoadException(ResourceSetImpl.java:315)
at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.demandLoadHelper(ResourceSetImpl.java:274)
at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.getResource(ResourceSetImpl.java:397)
at org.eclipse.emf.ecore.presentation.EcoreEditor.createModelGen(EcoreEditor.java:1062)
at org.eclipse.emf.ecore.presentation.EcoreEditor.createModel(EcoreEditor.java:1082)
at org.eclipse.emf.ecore.presentation.EcoreEditor.createPages(EcoreEditor.java:1147)
...

When this happens in your application, you can register the package to fix it.

However in this case the error happens when you want to edit an XMI file (EMF model) inside the Eclipse IDE.

To fix it open the file using the plain XML Editor, and change the line :

<abispulsa:Catalog xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:abispulsa="http://www.abispulsa.com/model/1.0">

to point to the metamodel's location using xsi:schemaLocation :

<abispulsa:Catalog xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:abispulsa="http://www.abispulsa.com/model/1.0" xsi:schemaLocation="http://www.abispulsa.com/model/1.0 abispulsa.ecore">

Now you can open the file in the EMF Editor successfully.

4 comments:

  1. I have exactly the situation you describe here, but happen to be unable to point to an matching .ecore file:
    In Rational Software Architect I created an Data model based on Oracle specifics. The resulting model, among other extensions, uses

    xmlns:SQLSchema="http:///org/eclipse/datatools/modelbase/sql/schema.ecore"

    Having looked into all .jar-Files of the installation I was unable to find a matching File. Instead I found .class-Files in org.eclipse.datatools.modelbase.sql_1.0.900.v20091201_1500.jar that seem to represent the ecore-Metamodel in Java. Is it possible to convert such classes back to an .ecore-Metamodel or is there another option to make the editor understand that a metamodel representation is available?

    ReplyDelete
  2. Satchel understood that the great white players such as Joe DiMaggio for example, received treatment from others that cambridge satchel would help propel their star status and legendary accomplishments. He knew if he was going to ensure his own legacy, he would need to do that self promotion himself. In a way, it's as if Satchel Paige understood cambridge satchel company in this early era the importance of having a personal brand. He even contributed to discrepancies about his age in order to make his accomplishments more extraordinary. We hear that one of the greatest mysteries of the 30's and 40's was the true age of messi jersey!

    ReplyDelete
  3. Wow Gold can be used to buy weapons and items, which are essential to finish the tasks or to conquer the enemies in game. Different items have different values, including the most common weapons. They are commonly measured and traded with certain amount of Cheap WOW Gold. So many regular gamers spend several hours every day to farm enough World Of Warcraft Gold to exchange the great weapons they seeking for. But obviously, it's time-consuming and frustrated because you could be beaten constantly.Welcome to www.zyy.com to Buy wow Gold.

    ReplyDelete
  4. Cute story. Makes me want to be better. Thanks for sharing. You are wonderful.

    Cheap RS Gold

    Cheap MapleStory Mesos

    ReplyDelete