|
|
Re: Acceleo Java Launcher [message #642217 is a reply to message #642209] |
Tue, 30 November 2010 12:39 |
|
Hi Maik,
Sebastien's answer would work, but it would be better to keep your package registrations local to the resource set instead of adding to the global EPackage registry .
The problem you have is that you're trying to load an UML model created with an older version of Eclipse. The URI of the UML project's metamodel has evolved from "http://www.eclipse.org/uml2/2.0.0/UML" to ""http://www.eclipse.org/uml2/3.0.0/UML" ... and thus EMF cannot find the "2.0.0" URI when you manually register the package.
in addition to the line you've already added :
resourceSet.getPackageRegistry().put(org.eclipse.uml2.uml.UMLPackage.eINSTANCE.getNsURI(), org.eclipse.uml2.uml.UMLPackage.eINSTANCE);
Please add this one :
resourceSet.getPackageRegistry().put("http://www.eclipse.org/uml2/2.0.0/UML", org.eclipse.uml2.uml.UMLPackage.eINSTANCE);
Laurent Goubet
Obeo
|
|
|
Re: Acceleo Java Launcher [message #642227 is a reply to message #642209] |
Tue, 30 November 2010 13:22 |
dieppi Messages: 27 Registered: November 2010 |
Junior Member |
|
|
Hi Sebastien and Laurent,
no i got another exception:
org.eclipse.emf.ecore.resource.impl.ResourceSetImpl$1Diagnos ticWrappedException: org.eclipse.emf.ecore.xmi.ClassNotFoundException: Class 'StringLiteralExp' is not found or is abstract. (file:/com/test/bin/generate.emtl 13, 856)
Do i need an additional package to register?
[Updated on: Tue, 30 November 2010 16:13] Report message to a moderator
|
|
|
Re: Acceleo Java Launcher [message #642402 is a reply to message #642227] |
Wed, 01 December 2010 07:57 |
|
This is a multi-part message in MIME format.
--------------040301020509010705090607
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Hi Maik,
This last one would indicate that you're missing the OCL package
registration ... but that registration should be handled by the
generated java launcher by default ... Have your removed any of the
lines from "registerPackages" when adding the registration of the UML
package? (Specifically, you need to call
super.registerPackages(resourceSet) from this method.)
Laurent Goubet
Obeo
On 30/11/2010 14:22, dieppi@gmx.de wrote:
> Hi Sebastien and Laurent,
>
> it works now as java application running in eclipse. Many thanks for that.
> Now i created a ant task. After running ant task i get the following
> error message
>
> org.eclipse.emf.ecore.resource.impl.ResourceSetImpl$1Diagnos
> ticWrappedException: org.eclipse.emf.ecore.xmi.ClassNotFoundException:
> Class 'StringLiteralExp' is not found or is abstract.
> (file:/com/test/generate.emtl 13, 856)
>
> Do i need an additional package to register?
--------------040301020509010705090607
Content-Type: text/x-vcard; charset=utf-8;
name="laurent_goubet.vcf"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
filename="laurent_goubet.vcf"
YmVnaW46dmNhcmQNCmZuOkxhdXJlbnQgR291YmV0DQpuOkdvdWJldDtMYXVy ZW50DQpvcmc6
PGEgaHJlZj0iaHR0cDovL3d3dy5vYmVvLmZyIj5PYmVvPC9hPg0KZW1haWw7 aW50ZXJuZXQ6
bGF1cmVudC5nb3ViZXRAb2Jlby5mcg0KdXJsOmh0dHA6Ly93d3cub2Jlby5m cg0KdmVyc2lv
bjoyLjENCmVuZDp2Y2FyZA0KDQo=
--------------040301020509010705090607--
|
|
|
|
Re: Acceleo Java Launcher [message #642450 is a reply to message #642440] |
Wed, 01 December 2010 11:57 |
|
This is a multi-part message in MIME format.
--------------030605080701030407020604
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Maik,
I must admit I don't know how to register profiles, but I do know
metamodel (your namespaces) registrations should be done through the
java launcher and its "registerPackage" method. The fact that your ant
task doesn't seem to find the Ecore metamodel even though it is
registered seems ... wrong.
In any case, "StringLiteralExp" is part of the OCL metamodel, and this
is the namespace you're missing. The Java launcher _should_ take care of
registering it properly. I don't remember the package hierarchy in which
StringLiteralExp is located, you can look at the org.eclipse.ocl plugin
and its "model/ocl.ecore" model, as it it the metamodel you're searching
for.
Laurent Goubet
Obeo
On 01/12/2010 11:59, Maik wrote:
> Hi Laurent,
>
> thanks for your answer. But i have a strange behavior here. I think it
> depends on eclipse and how i finds the nesessary packages and profile.
>
> My model is an uml file with additionally profile files. After adding
> the UML namespace http://www.eclipse.org/uml2/2.0.0/UML to method
> registerPackages i as able to run java launcher in eclipse as java
> application.
>
> So i created a ant task. After starting the ant task i got the message
> class viewstate from my viewprofile cannot be found. So i added the
> viewprofile namespace to method registerPackages. After starting the ant
> task again i got the error message EClass cannot be found. So i added
> ecore namespace. After starting ant task again i got the error message
> StringLetralExp not found. So what can in do?
>
> My model file has the following namespace
>
> <?xml version="1.0" encoding="UTF-8"?>
> <xmi:XMI xmi:version="2.1"
> xmlns:xmi="http://schema.omg.org/spec/XMI/2.1"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns:MagicDrawProfile="http:///schemas/MagicDrawProfile/_CAA84HhZEd-ijZRcwHp7Mw/0"
> xmlns:ViewProfile="http:///schemas/ViewProfile/_B_3y8HhZEd-ijZRcwHp7Mw/0" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore"
> xmlns:uml="http://www.eclipse.org/uml2/2.0.0/UML"
> xsi:schemaLocation="http:///schemas/MagicDrawProfile/_CAA84HhZEd-ijZRcwHp7Mw/0
> UML_Standard_Profile.MagicDraw_Profile.profile.uml#_CYqG33hZ
> Ed-ijZRcwHp7Mw http:///schemas/ViewProfile/_B_3y8HhZEd-ijZRcwHp7Mw/0
> ViewProfile.profile.uml#_CYsi9nhZEd-ijZRcwHp7Mw">
> <uml:Model xmi:id="eee_1045467100313_135436_1" name="test_model"
> viewpoint="">
> <ownedComment xmi:id="_12_5_41801a3_1265618805392_492566_98"
> body="Author: Team
> Created: 08.02.10 09:46Uhr
> Title: Test
> Comment: " annotatedElement="eee_1045467100313_135436_1"/>
> <packageImport xmi:id="_0primitiveTypestest_model">
> <importedPackage xmi:type="uml:Model"
> href="pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#_0"/>
> </packageImport>
> <packageImport xmi:id="_0javaPrimitiveTypestest_model">
> <importedPackage xmi:type="uml:Model"
> href="pathmap://UML_LIBRARIES/JavaPrimitiveTypes.library.uml#_0"/>
> </packageImport>
>
> One of my profile file has to following namspace
>
> <?xml version="1.0" encoding="UTF-8"?>
> <uml:Profile xmi:version="2.1"
> xmlns:xmi="http://schema.omg.org/spec/XMI/2.1"
> xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore"
> xmlns:uml="http://www.eclipse.org/uml2/2.0.0/UML"
> xmi:id="_12_1_1_41801a3_1180279591484_435565_108" name="ViewProfile"
> metamodelReference="_0metamodelReferenceViewProfile">
> <eAnnotations xmi:id="_CYsi9XhZEd-ijZRcwHp7Mw"
> source="http://www.eclipse.org/uml2/2.0.0/UML">
> <contents xmi:type="ecore:EPackage" xmi:id="_CYsi9nhZEd-ijZRcwHp7Mw"
> name="ViewProfile"
> nsURI="http:///schemas/ViewProfile/_B_3y8HhZEd-ijZRcwHp7Mw/0"
> nsPrefix="ViewProfile">
> <eClassifiers xmi:type="ecore:EClass" xmi:id="_CYsi93hZEd-ijZRcwHp7Mw"
> name="ViewState">
>
> Is that the right way to register profiles in these method?
>
> Best regards
> Maik
>
>
>
>
--------------030605080701030407020604
Content-Type: text/x-vcard; charset=utf-8;
name="laurent_goubet.vcf"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
filename="laurent_goubet.vcf"
YmVnaW46dmNhcmQNCmZuOkxhdXJlbnQgR291YmV0DQpuOkdvdWJldDtMYXVy ZW50DQpvcmc6
PGEgaHJlZj0iaHR0cDovL3d3dy5vYmVvLmZyIj5PYmVvPC9hPg0KZW1haWw7 aW50ZXJuZXQ6
bGF1cmVudC5nb3ViZXRAb2Jlby5mcg0KdXJsOmh0dHA6Ly93d3cub2Jlby5m cg0KdmVyc2lv
bjoyLjENCmVuZDp2Y2FyZA0KDQo=
--------------030605080701030407020604--
|
|
|
|
Powered by
FUDForum. Page generated in 0.03088 seconds