|
Re: loading .uml / .xmi files in eclipse [message #985884 is a reply to message #985776] |
Fri, 16 November 2012 14:49 |
|
Hi,
You need to have the org.eclipse.emf.mapping.ecore2xml plug-in in your
run-time configuration if you are trying to load UML2 3.0 models in a
Juno Eclipse configuration.
But, as you are running this as a java application, you need to have
the org.eclipse.emf.mapping.ecore2xml_<version>.jar on your
application's classpath. (where <version> is just some version
identifier for the EMF release)
HTH,
Christian
On 2012-11-16 13:59:33 +0000, Toqeer Israr said:
> Hi
>
> I am a complete newbie at Eclipse and UML 2 plugins. I created an
> activity model in Rational Software Architect and exported as .emx and
> also as .uml
>
> I am trying to load either of these file in Eclipse such that I would
> be able to retrieve the model information programatically.
>
> I followed the "improved" tutorial to load the files at
> https://bugs.eclipse.org/bugs/attachment.cgi?id=217415.
>
>
> public static void main(String[] args) {
> // TODO Auto-generated method stub
> PerfEngine engine = new PerfEngine();
> engine.analyze();
>
> }
>
> private void analyze() {
>
> ResourceSet resourceSet1 = new ResourceSetImpl();
> UML300ResourcesUtil.init(resourceSet1);
>
> URI uri1 = URI.createURI("TMS_xmi.xmi");
> Model loadedModel1 = (Model) load(resourceSet1, uri1);
> System.out.println(loadedModel1);
>
> ResourceSet resourceSet2 = new ResourceSetImpl();
> UML300ResourcesUtil.init(resourceSet2);
>
> URI uri2 = URI.createURI("TMS_uml.uml");
> Model loadedModel2 = (Model) load(resourceSet2, uri2);
> System.out.println(loadedModel2);
>
> }
>
>
>
> I am using the functions from the attached .zip file of the
> tutorial(link given above) but every time I try to run this, I get the
> following error message:
>
> Exception in thread "main" java.lang.NoClassDefFoundError:
> org/eclipse/emf/mapping/ecore2xml/Ecore2XMLRegistry
> at
> org.eclipse.uml2.uml.resource.UML212UMLResource$Factory.<clinit>(UML212UMLResource.java:31)
>
> at perf.UML300ResourcesUtil.init(UML300ResourcesUtil.java:221)
> at perf.PerfEngine.analyze(PerfEngine.java:67)
> at perf.PerfEngine.main(PerfEngine.java:61)
> Caused by: java.lang.ClassNotFoundException:
> org.eclipse.emf.mapping.ecore2xml.Ecore2XMLRegistry
> at java.net.URLClassLoader$1.run(Unknown Source)
> at java.security.AccessController.doPrivileged(Native Method)
> at java.net.URLClassLoader.findClass(Unknown Source)
> at java.lang.ClassLoader.loadClass(Unknown Source)
> at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
> at java.lang.ClassLoader.loadClass(Unknown Source)
> ... 4 more
>
>
> I really really would appreciate anyone's help in the above or if there
> is a simpler way of loading the files. At the end of the day, I wish
> to traverse the meta-model of input model.
>
> Thanks
>
> Toqeer
> P.S. I am using:
> Eclipse IDE for Java Developers
> Version: Juno Service Release 1
> Build id: 20120920-0800
> <image><image><image>
|
|
|
Re: loading .uml / .xmi files in eclipse [message #985900 is a reply to message #985884] |
Fri, 16 November 2012 15:44 |
Ed Willink Messages: 7655 Registered: July 2009 |
Senior Member |
|
|
Hi Toqeer, Christain
The tutorial was prepared just during the Juno RCs. Further problems
with UML content registrations showed up and are 'finally' fixed in Juno
SR1.
Whether running standalone or not, content type registrations must be in
the local ResourceSet and a *.uml extension registration must be in the
global registry. This happens pretty automatically within Eclipse, and
can now happen fully by calling UMLResourcesUtil.init(localResourceSet).
UML300ResourcesUtil was an attempt to reverse migrate UMLResourcesUtil
from 4.0 to 3.0. It needs updating to reflect abandoning the option of
using only global registries.
The ecore2xml mapping now uses a local ResourceSet with appropriate
local registrations, so if you use a plugin maifest to compute your
classpath it should be easy.
If you are determined to use your own classpath; good luck.
Regards
Ed Willink
On 16/11/2012 14:49, Christian W. Damus wrote:
> Hi,
>
> You need to have the org.eclipse.emf.mapping.ecore2xml plug-in in your
> run-time configuration if you are trying to load UML2 3.0 models in a
> Juno Eclipse configuration.
>
> But, as you are running this as a java application, you need to have
> the org.eclipse.emf.mapping.ecore2xml_<version>.jar on your
> application's classpath. (where <version> is just some version
> identifier for the EMF release)
>
> HTH,
>
> Christian
>
>
> On 2012-11-16 13:59:33 +0000, Toqeer Israr said:
>
>> Hi
>>
>> I am a complete newbie at Eclipse and UML 2 plugins. I created an
>> activity model in Rational Software Architect and exported as .emx
>> and also as .uml
>>
>> I am trying to load either of these file in Eclipse such that I would
>> be able to retrieve the model information programatically.
>>
>> I followed the "improved" tutorial to load the files at
>> https://bugs.eclipse.org/bugs/attachment.cgi?id=217415.
>>
>>
>> public static void main(String[] args) {
>> // TODO Auto-generated method stub
>> PerfEngine engine = new PerfEngine();
>> engine.analyze();
>>
>> }
>>
>> private void analyze() {
>>
>> ResourceSet resourceSet1 = new ResourceSetImpl();
>> UML300ResourcesUtil.init(resourceSet1);
>>
>> URI uri1 = URI.createURI("TMS_xmi.xmi");
>> Model loadedModel1 = (Model) load(resourceSet1, uri1);
>> System.out.println(loadedModel1);
>>
>> ResourceSet resourceSet2 = new ResourceSetImpl();
>> UML300ResourcesUtil.init(resourceSet2);
>>
>> URI uri2 = URI.createURI("TMS_uml.uml");
>> Model loadedModel2 = (Model) load(resourceSet2, uri2);
>> System.out.println(loadedModel2);
>>
>> }
>>
>>
>>
>> I am using the functions from the attached .zip file of the
>> tutorial(link given above) but every time I try to run this, I get
>> the following error message:
>>
>> Exception in thread "main" java.lang.NoClassDefFoundError:
>> org/eclipse/emf/mapping/ecore2xml/Ecore2XMLRegistry
>> at
>> org.eclipse.uml2.uml.resource.UML212UMLResource$Factory.<clinit>(UML212UMLResource.java:31)
>>
>> at perf.UML300ResourcesUtil.init(UML300ResourcesUtil.java:221)
>> at perf.PerfEngine.analyze(PerfEngine.java:67)
>> at perf.PerfEngine.main(PerfEngine.java:61)
>> Caused by: java.lang.ClassNotFoundException:
>> org.eclipse.emf.mapping.ecore2xml.Ecore2XMLRegistry
>> at java.net.URLClassLoader$1.run(Unknown Source)
>> at java.security.AccessController.doPrivileged(Native Method)
>> at java.net.URLClassLoader.findClass(Unknown Source)
>> at java.lang.ClassLoader.loadClass(Unknown Source)
>> at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
>> at java.lang.ClassLoader.loadClass(Unknown Source)
>> ... 4 more
>>
>>
>> I really really would appreciate anyone's help in the above or if
>> there is a simpler way of loading the files. At the end of the day,
>> I wish to traverse the meta-model of input model.
>>
>> Thanks
>>
>> Toqeer
>> P.S. I am using:
>> Eclipse IDE for Java Developers
>> Version: Juno Service Release 1
>> Build id: 20120920-0800
>> <image><image><image>
>
>
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04899 seconds