Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » UML2 » Acceleo only works the first time
Acceleo only works the first time [message #909604] Fri, 07 September 2012 12:02 Go to next message
Carlos André is currently offline Carlos AndréFriend
Messages: 2
Registered: September 2012
Junior Member
Hey,

I'm trying to generate some C++ code using Acceleo in conjunction with ATL.
For some strange reason, my transformation works perfectly at first time, but any further attempts to do it again fail always, forcing me to restart eclipse.
I'm using the latest version of Acceleo (3.2.2) and ATL 3.2.1.

This is the way I'm using Acceleo:

		try {
			
			File modelFile = getOriginalEmxModelFile();
			File outputFolder = new File(getOutputFolder(), MGC_OUTPUT_FOLDER_NAME);

			URI modelURI = URI.createPlatformResourceURI(modelFile.getAbsolutePath(), true);
			
			GenerateMgcCpp gen0 = new GenerateMgcCpp(modelURI, outputFolder, new ArrayList<String>());
			monitor.worked(1);
			gen0.doGenerate(BasicMonitor.toMonitor(monitor));
			monitor.worked(1);
			
		} catch (Exception e) {
			return new Status(IStatus.ERROR, MgcActivator.PLUGIN_ID,
					e.getMessage(), e);
		}

		finally {
			monitor.done();
			System.gc();
		}



And this is the error I get after trying to run this transformation again:
VM Exception thrown by ATL Launcher: org.eclipse.m2m.atl.engine.emfvm.VMException
Java Stack:
org.eclipse.m2m.atl.engine.emfvm.VMException
at org.eclipse.m2m.atl.engine.emfvm.adapter.UML2ModelAdapter.finalizeModel(Unknown Source)
at org.eclipse.m2m.atl.engine.emfvm.lib.ExecEnv.terminated(Unknown Source)
at org.eclipse.m2m.atl.engine.emfvm.ASM.run(Unknown Source)
at org.eclipse.m2m.atl.engine.emfvm.launch.EMFVMLauncher.internalLaunch(Unknown Source)
at org.eclipse.m2m.atl.engine.emfvm.launch.EMFVMUILauncher.launch(Unknown Source)
at org.eclipse.m2m.atl.core.service.LauncherService.launch(Unknown Source)
at org.eclipse.core.internal.jobs.Worker.run(Unknown Source)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.GeneratedMethodAccessor60.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.m2m.atl.engine.emfvm.adapter.UML2ModelAdapter.applyDelayedInvocations(Unknown Source)
... 9 more
Caused by: java.lang.IllegalArgumentException: org.eclipse.uml2.uml.internal.impl.StereotypeImpl@1d641d64 (name: Documentation, visibility: <unset>) (isLeaf: false, isAbstract: false) (isActive: false)
at org.eclipse.uml2.uml.internal.operations.ElementOperations.applyStereotype(Unknown Source)
at org.eclipse.uml2.uml.internal.impl.ElementImpl.applyStereotype(Unknown Source)
... 13 more

I basically use ATL to generate an intermediate model and then I run Acceleo on it.
All ATL transformations were pretty stable until now, when I started to use Acceleo.
Does anyone have any idea what might be causing this?
I'm kind of new to this type of technologies, maybe I'm doing something completely wrong.

Thanks,
Carlos
Re: Acceleo only works the first time [message #909618 is a reply to message #909604] Fri, 07 September 2012 12:29 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

[Acceleo 3.2.2 is not the most recent; I strongly recommend moving to
3.3; but I doubt that is your problem]

If you need to restart Eclipse then it is very likely that you have
corrupted a global registry.

Tou might find org.eclipse.xtext.junit4.GlobalRegistries useful to to
take a copy of important registries before a transformation so that
you can see what has changed.

Regards

Ed Willink

On 07/09/2012 13:02, Carlos André wrote:
> Hey,
>
> I'm trying to generate some C++ code using Acceleo in conjunction with
> ATL.
> For some strange reason, my transformation works perfectly at first
> time, but any further attempts to do it again fail always, forcing me
> to restart eclipse.
> I'm using the latest version of Acceleo (3.2.2) and ATL 3.2.1.
>
> This is the way I'm using Acceleo:
>
>
> try {
>
> File modelFile = getOriginalEmxModelFile();
> File outputFolder = new File(getOutputFolder(),
> MGC_OUTPUT_FOLDER_NAME);
>
> URI modelURI =
> URI.createPlatformResourceURI(modelFile.getAbsolutePath(), true);
>
> GenerateMgcCpp gen0 = new GenerateMgcCpp(modelURI,
> outputFolder, new ArrayList<String>());
> monitor.worked(1);
> gen0.doGenerate(BasicMonitor.toMonitor(monitor));
> monitor.worked(1);
>
> } catch (Exception e) {
> return new Status(IStatus.ERROR, MgcActivator.PLUGIN_ID,
> e.getMessage(), e);
> }
>
> finally {
> monitor.done();
> System.gc();
> }
>
>
>
> And this is the error I get after trying to run this transformation
> again:
> VM Exception thrown by ATL Launcher:
> org.eclipse.m2m.atl.engine.emfvm.VMException
> Java Stack:
> org.eclipse.m2m.atl.engine.emfvm.VMException
> at
> org.eclipse.m2m.atl.engine.emfvm.adapter.UML2ModelAdapter.finalizeModel(Unknown
> Source)
> at org.eclipse.m2m.atl.engine.emfvm.lib.ExecEnv.terminated(Unknown
> Source)
> at org.eclipse.m2m.atl.engine.emfvm.ASM.run(Unknown Source)
> at
> org.eclipse.m2m.atl.engine.emfvm.launch.EMFVMLauncher.internalLaunch(Unknown
> Source)
> at
> org.eclipse.m2m.atl.engine.emfvm.launch.EMFVMUILauncher.launch(Unknown
> Source)
> at org.eclipse.m2m.atl.core.service.LauncherService.launch(Unknown
> Source)
> at org.eclipse.core.internal.jobs.Worker.run(Unknown Source)
> Caused by: java.lang.reflect.InvocationTargetException
> at sun.reflect.GeneratedMethodAccessor60.invoke(Unknown Source)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
> at java.lang.reflect.Method.invoke(Unknown Source)
> at
> org.eclipse.m2m.atl.engine.emfvm.adapter.UML2ModelAdapter.applyDelayedInvocations(Unknown
> Source)
> ... 9 more
> Caused by: java.lang.IllegalArgumentException:
> mailto:org.eclipse.uml2.uml.internal.impl.StereotypeImpl@1d641d64
> (name: Documentation, visibility: <unset>) (isLeaf: false, isAbstract:
> false) (isActive: false)
> at
> org.eclipse.uml2.uml.internal.operations.ElementOperations.applyStereotype(Unknown
> Source)
> at
> org.eclipse.uml2.uml.internal.impl.ElementImpl.applyStereotype(Unknown
> Source)
> ... 13 more
>
> I basically use ATL to generate an intermediate model and then I run
> Acceleo on it.
> All ATL transformations were pretty stable until now, when I started
> to use Acceleo.
> Does anyone have any idea what might be causing this?
> I'm kind of new to this type of technologies, maybe I'm doing
> something completely wrong.
>
> Thanks,
> Carlos
Re: Acceleo only works the first time [message #910693 is a reply to message #909618] Mon, 10 September 2012 08:21 Go to previous messageGo to next message
Carlos André is currently offline Carlos AndréFriend
Messages: 2
Registered: September 2012
Junior Member
Hi Ed,

That's exactly what I was looking for, It solved my problem!
I've restore the global registries after using Acceleo and everything is working again.

These are the instructions I've added:

// before running Acceleo
GlobalRegistries globalReg = new GlobalRegistries();
GlobalStateMemento registers = globalReg.makeCopyOfGlobalState();

// after running Acceleo
registers.restoreGlobalState();



Thanks a lot,
Carlos
Re: Acceleo only works the first time [message #910777 is a reply to message #910693] Mon, 10 September 2012 11:29 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

Those should only be diagnosis tools. You want to find out and eliminate
the corruption that requires restoration.

Regards

Ed Willink

On 10/09/2012 09:21, Carlos André wrote:
> Hi Ed,
>
> That's exactly what I was looking for, It solved my problem!
> I've restore the global registries after using Acceleo and everything
> is working again.
>
> These are the instructions I've added:
>
> // before running Acceleo
> GlobalRegistries globalReg = new GlobalRegistries();
> GlobalStateMemento registers = globalReg.makeCopyOfGlobalState();
>
> // after running Acceleo
> registers.restoreGlobalState();
>
>
> Thanks a lot,
> Carlos
Re: Acceleo only works the first time [message #911881 is a reply to message #910777] Wed, 12 September 2012 13:56 Go to previous messageGo to next message
Ronan B is currently offline Ronan BFriend
Messages: 273
Registered: July 2009
Senior Member
Hi Ed,
The problem seems to be that the EPackage.Registry.INSTANCE has a number of extra entries after running Acceleo. These extra entries are URIs like "http:///schemas/..." which are references to UML profiles used by the model being transformed by Acceleo. I suspect that Acceleo is registering these while it runs but it registers them in such a way that other model transformation langauges like ATL cannot read them.

If I explicitly remove all the URIs that Acceleo adds then the ATL transforms will run again. Obviously I don't want to so this.

I suspect we have not registered our profiles correctly with the EPackage registry. However, all other transformation languages we have used have worked correctly so I'm unsure.

We register each UML profile in a plugin as follows:

<extension
point="org.eclipse.emf.ecore.uri_mapping">
<mapping
source="pathmap://MY_PROFILE/"
target="platform:/plugin/com.mycompany.x.y.dsl/profiles/">
</mapping>
</extension>

The above extension makes the profiles visible to ATL


<extension point="org.eclipse.uml2.uml.dynamic_package">
<profile uri="http:///schemas/MyProfile/_tu8F0J2oEeGo24HAU8QWcA/52" location="platform:/plugin/com.mycompany.x.y.dsl/profiles/MyProfile.epx#_0"/>
</extension>

The above extension makes the profile visible to UML2. Note:We build the profile in RSA but it is just the same as .profile.uml

We have no genmodel for the profiles as I don't think you need one. However, this seems to be where acceleo gets upset. If I register an org.eclipse.emf.ecore.dynamic_package extension with the URI of "http:///schemas/..." for example then I can get the EPackage.Registry.INSTANCE to ahve the same number of entries before and after Acceleo runs. However, the org.eclipse.emf.ecore.dynamic_package extension are not correct as we don't have a genmodel for these. When Acceleo runs the second time it will overwrite these and ATL will again fail.

Any hints?

Thanks!
Ronan

Re: Acceleo only works the first time [message #911940 is a reply to message #911881] Wed, 12 September 2012 16:05 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

Please report this as an Acceleo bug.

If you're only using extension points then it should work.

Any transformation-specific registrations should be in a local registry
to avoid exactly the problem you see.

Regards

Ed Willink



On 12/09/2012 14:56, Ronan B wrote:
> Hi Ed,
> The problem seems to be that the EPackage.Registry.INSTANCE has a
> number of extra entries after running Acceleo. These extra entries are
> URIs like "http:///schemas/..." which are references to UML profiles
> used by the model being transformed by Acceleo. I suspect that Acceleo
> is registering these while it runs but it registers them in such a way
> that other model transformation langauges like ATL cannot read them.
> If I explicitly remove all the URIs that Acceleo adds then the ATL
> transforms will run again. Obviously I don't want to so this.
>
> I suspect we have not registered our profiles correctly with the
> EPackage registry. However, all other transformation languages we have
> used have worked correctly so I'm unsure.
>
> We register each UML profile in a plugin as follows:
>
> <extension
> point="org.eclipse.emf.ecore.uri_mapping">
> <mapping
> source="pathmap://MY_PROFILE/"
> target="platform:/plugin/com.mycompany.x.y.dsl/profiles/">
> </mapping>
> </extension>
>
> The above extension makes the profiles visible to ATL
>
>
> <extension point="org.eclipse.uml2.uml.dynamic_package">
> <profile
> uri="http:///schemas/MyProfile/_tu8F0J2oEeGo24HAU8QWcA/52"
> location="platform:/plugin/com.mycompany.x.y.dsl/profiles/MyProfile.epx#_0"/>
> </extension>
>
> The above extension makes the profile visible to UML2. Note:We build
> the profile in RSA but it is just the same as .profile.uml
>
> We have no genmodel for the profiles as I don't think you need one.
> However, this seems to be where acceleo gets upset. If I register an
> org.eclipse.emf.ecore.dynamic_package extension with the URI of
> "http:///schemas/..." for example then I can get the
> EPackage.Registry.INSTANCE to ahve the same number of entries before
> and after Acceleo runs. However, the
> org.eclipse.emf.ecore.dynamic_package extension are not correct as we
> don't have a genmodel for these. When Acceleo runs the second time it
> will overwrite these and ATL will again fail.
>
> Any hints?
>
> Thanks!
> Ronan
>
>
Re: Acceleo only works the first time [message #912356 is a reply to message #911940] Thu, 13 September 2012 12:16 Go to previous message
Ronan B is currently offline Ronan BFriend
Messages: 273
Registered: July 2009
Senior Member
Great thanks Ed! Bug filed at https://bugs.eclipse.org/bugs/show_bug.cgi?id=389497
Previous Topic:ApplyStereotypes takes seconds at first time
Next Topic:Deleting elements efficiently
Goto Forum:
  


Current Time: Fri Apr 19 15:04:27 GMT 2024

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

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

Back to the top