Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » [Acceleo] Java application runner
[Acceleo] Java application runner [message #503175] Fri, 11 December 2009 09:48 Go to next message
Ilari Heikkinen is currently offline Ilari HeikkinenFriend
Messages: 2
Registered: December 2009
Junior Member
Hi,

my M2T transformation launching works when using "Acceleo plug-in application" runner in Eclipse launch configuration. But when using Java application runner I get PackageNotFoundException from Ecore XMLHandler:

Caused by: org.eclipse.emf.ecore.xmi.PackageNotFoundException: Package with uri 'http://myproject/ns/mymetamodel' not found. (file:/R:/eclipse_workspace/MyProject/resources/models/MyModel.xmi, 3, 88)


Models are stored in separate project from Acceleo module project and I refer to metamodels by URI in Acceleo templates. Opening MyModel.xmi in sample Ecore editor works fine. What might cause the error here? My eventual goal behind this is to run transformations with Ant.

Thanks,
Ilari
Re: [Acceleo] Java application runner [message #503188 is a reply to message #503175] Fri, 11 December 2009 05:32 Go to previous messageGo to next message
Laurent Goubet is currently offline Laurent GoubetFriend
Messages: 1639
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------000205030909070807070306
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit

Hi Ilari,

Running "Acceleo plu-in application" is running your generation within
an eclipse context, running as a "Java application" means running your
generation standalone.

Standalone runs require some more setup from your side; the main issue
being registering your metamodels in the package registry. Look at the
way it is done for UML :
http://wiki.eclipse.org/MDT/UML2/FAQ#What.27s_required_to_lo ad_a_UML_.28.uml.29_resource_from_a_standalone_application.3 F
..

What's important for you in there are the lines

resourceSet.getPackageRegistry().put(UMLPackage.eNS_URI,
UMLPackage.eINSTANCE);
resourceSet.getResourceFactoryRegistry().getExtensionToFacto ryMap().put(UMLResource.FILE_EXTENSION,
UMLResource.Factory.INSTANCE);

Which goal is to register the package in the registry and associate a
given resource factory with the UML extension. You need to do the same,
replacing the UMLPackage by the XxxPackage that's been generated for
your metamodel, the "uml" file extension by yours, and the
UMLResource.Factory.INSTANCE by the one that's been generated for you
(if any, this might not be necessary)

Laurent Goubet
Obeo


Ilari Heikkinen wrote:
> Hi,
>
> my M2T transformation launching works when using "Acceleo plug-in
> application" runner in Eclipse launch configuration. But when using Java
> application runner I get PackageNotFoundException from Ecore XMLHandler:
>
> Caused by: org.eclipse.emf.ecore.xmi.PackageNotFoundException: Package
> with uri 'http://myproject/ns/mymetamodel' not found.
> (file:/R:/eclipse_workspace/MyProject/resources/models/MyMod el.xmi, 3, 88)
>
> Models are stored in separate project from Acceleo module project and I
> refer to metamodels by URI in Acceleo templates. Opening MyModel.xmi in
> sample Ecore editor works fine. What might cause the error here? My
> eventual goal behind this is to run transformations with Ant.
>
> Thanks,
> Ilari
>


--------------000205030909070807070306
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=
--------------000205030909070807070306--
Re: [Acceleo] Java application runner [message #503416 is a reply to message #503188] Sun, 13 December 2009 20:02 Go to previous messageGo to next message
Ilari Heikkinen is currently offline Ilari HeikkinenFriend
Messages: 2
Registered: December 2009
Junior Member
Thanks,

just added a line

resourceSet.getPackageRegistry().put(MyPackage.eINSTANCE.get NsURI(),
MyPackage.eINSTANCE);

to method registerPackages(ResourceSet resourceSet) in my template
module entry point class and it works.

-Ilari

On 11/12/09 12:27, Laurent Goubet wrote:
> Hi Ilari,
>
> Running "Acceleo plu-in application" is running your generation within
> an eclipse context, running as a "Java application" means running your
> generation standalone.
>
> Standalone runs require some more setup from your side; the main issue
> being registering your metamodels in the package registry. Look at the
> way it is done for UML :
> http://wiki.eclipse.org/MDT/UML2/FAQ#What.27s_required_to_lo ad_a_UML_.28.uml.29_resource_from_a_standalone_application.3 F
> .
>
> What's important for you in there are the lines
>
> resourceSet.getPackageRegistry().put(UMLPackage.eNS_URI,
> UMLPackage.eINSTANCE);
> resourceSet.getResourceFactoryRegistry().getExtensionToFacto ryMap().put(UMLResource.FILE_EXTENSION,
> UMLResource.Factory.INSTANCE);
>
> Which goal is to register the package in the registry and associate a
> given resource factory with the UML extension. You need to do the same,
> replacing the UMLPackage by the XxxPackage that's been generated for
> your metamodel, the "uml" file extension by yours, and the
> UMLResource.Factory.INSTANCE by the one that's been generated for you
> (if any, this might not be necessary)
>
> Laurent Goubet
> Obeo
>
>
> Ilari Heikkinen wrote:
>> Hi,
>>
>> my M2T transformation launching works when using "Acceleo plug-in
>> application" runner in Eclipse launch configuration. But when using
>> Java application runner I get PackageNotFoundException from Ecore
>> XMLHandler:
>>
>> Caused by: org.eclipse.emf.ecore.xmi.PackageNotFoundException: Package
>> with uri 'http://myproject/ns/mymetamodel' not found.
>> (file:/R:/eclipse_workspace/MyProject/resources/models/MyMod el.xmi, 3,
>> 88)
>>
>> Models are stored in separate project from Acceleo module project and
>> I refer to metamodels by URI in Acceleo templates. Opening MyModel.xmi
>> in sample Ecore editor works fine. What might cause the error here? My
>> eventual goal behind this is to run transformations with Ant.
>>
>> Thanks,
>> Ilari
>>
>
Re: [Acceleo] Java application runner [message #503451 is a reply to message #503416] Mon, 14 December 2009 04:38 Go to previous messageGo to next message
Laurent Goubet is currently offline Laurent GoubetFriend
Messages: 1639
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------020002010508090501040302
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit

Thanks for the feedback Ilari, glad that it works ^^.

Ilari Heikkinen wrote:
> Thanks,
>
> just added a line
>
> resourceSet.getPackageRegistry().put(MyPackage.eINSTANCE.get NsURI(),
> MyPackage.eINSTANCE);
>
> to method registerPackages(ResourceSet resourceSet) in my template
> module entry point class and it works.
>
> -Ilari
>
> On 11/12/09 12:27, Laurent Goubet wrote:
>> Hi Ilari,
>>
>> Running "Acceleo plu-in application" is running your generation within
>> an eclipse context, running as a "Java application" means running your
>> generation standalone.
>>
>> Standalone runs require some more setup from your side; the main issue
>> being registering your metamodels in the package registry. Look at the
>> way it is done for UML :
>> http://wiki.eclipse.org/MDT/UML2/FAQ#What.27s_required_to_lo ad_a_UML_.28.uml.29_resource_from_a_standalone_application.3 F
>>
>> .
>>
>> What's important for you in there are the lines
>>
>> resourceSet.getPackageRegistry().put(UMLPackage.eNS_URI,
>> UMLPackage.eINSTANCE);
>> resourceSet.getResourceFactoryRegistry().getExtensionToFacto ryMap().put(UMLResource.FILE_EXTENSION,
>>
>> UMLResource.Factory.INSTANCE);
>>
>> Which goal is to register the package in the registry and associate a
>> given resource factory with the UML extension. You need to do the same,
>> replacing the UMLPackage by the XxxPackage that's been generated for
>> your metamodel, the "uml" file extension by yours, and the
>> UMLResource.Factory.INSTANCE by the one that's been generated for you
>> (if any, this might not be necessary)
>>
>> Laurent Goubet
>> Obeo
>>
>>
>> Ilari Heikkinen wrote:
>>> Hi,
>>>
>>> my M2T transformation launching works when using "Acceleo plug-in
>>> application" runner in Eclipse launch configuration. But when using
>>> Java application runner I get PackageNotFoundException from Ecore
>>> XMLHandler:
>>>
>>> Caused by: org.eclipse.emf.ecore.xmi.PackageNotFoundException: Package
>>> with uri 'http://myproject/ns/mymetamodel' not found.
>>> (file:/R:/eclipse_workspace/MyProject/resources/models/MyMod el.xmi, 3,
>>> 88)
>>>
>>> Models are stored in separate project from Acceleo module project and
>>> I refer to metamodels by URI in Acceleo templates. Opening MyModel.xmi
>>> in sample Ecore editor works fine. What might cause the error here? My
>>> eventual goal behind this is to run transformations with Ant.
>>>
>>> Thanks,
>>> Ilari
>>>
>>
>


--------------020002010508090501040302
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=
--------------020002010508090501040302--
Re: [Acceleo] Java application runner [message #533215 is a reply to message #503451] Wed, 12 May 2010 15:03 Go to previous messageGo to next message
koita Aboubakar is currently offline koita AboubakarFriend
Messages: 11
Registered: April 2010
Junior Member
Hi,

I'm also trying to launch acceleo generation in standalone, with Java launcher. I have not any exception, but also any generation in output. Only the output folder is created. And of course, my templates works with acceleo plugin
Some explications ?

Edit: The issue is that a profile that I apply to my model is not applied in fact, and I don't know why. I will search in this direction.



[Updated on: Wed, 12 May 2010 16:16]

Report message to a moderator

Re: [Acceleo] Java application runner [message #533822 is a reply to message #533215] Mon, 17 May 2010 08:16 Go to previous message
Laurent Goubet is currently offline Laurent GoubetFriend
Messages: 1639
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------030408060705060904000709
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit

Hi,

We have a known bug with the Acceleo "Java Application" launch. We're
trying to get this fixed for RC1 but it is unusable until then. Sorry
for the inconvenience.

Laurent Goubet
Obeo

koïta Aboubakar wrote:
> Hi,
>
> I'm also trying to launch acceleo generation in standalone, with Java
> launcher. I have not any exception, but also any generation in output.
> Only the output folder is created. And of course, my templates works
> with acceleo plugin
> Some explications ?
>
> Thanks
>
>


--------------030408060705060904000709
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=
--------------030408060705060904000709--
Previous Topic:[XPAND/XTEND] defining aliases
Next Topic:Model based debugging
Goto Forum:
  


Current Time: Fri Dec 19 18:23:13 GMT 2014

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

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