Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » [Acceleo 3.1] Metamodel loading issues(Metamodel loads one time in two)
[Acceleo 3.1] Metamodel loading issues [message #725571] Thu, 15 September 2011 08:50 Go to next message
simon.vivien is currently offline simon.vivienFriend
Messages: 21
Registered: August 2011
Junior Member
Hi,

I am facing metamodel loading issues within Eclipse Indigo.
I have an Acceleo project which uses a homemade metamodel.

Scenario 1 :
- I run a second Eclipse instance, with my metamodel and my acceleo project deployed as plugins in it. The generation works fine.

Scenario 2 :
- I make an update-site out of my projects, and install those plugins in a brand new fresh Indigo. I get this error :


Quote:

The generation fail to generate any file because there are no model elements that matches at least the type of the first parameter of one of your main templates.
The problem may be caused by a problem with the registration of your metamodel, please see the method named "registerPackages" in the Java launcher of your generator.


It seems that in the second scenario, Acceleo won't load correctly my metamodel. It is weird, since :
- The plugins loaded in the scenario 1 are the same as the ones I put on the update-site (scenario 2).
- My Xtext editor succeed in both scenarios to open a file from my metamodel, and edit it (impossible if the metamodel is not correctly deployed in Eclipse).


I do not understand the problem, and would appreciate any help Smile

Thanks,
Simon.
Re: [Acceleo 3.1] Metamodel loading issues [message #725645 is a reply to message #725571] Thu, 15 September 2011 12:29 Go to previous messageGo to next message
Laurent Goubet is currently offline Laurent GoubetFriend
Messages: 1902
Registered: July 2009
Senior Member
Hi Simon,

First things first, have your tried Ed's suggestion from http://www.eclipse.org/forums/index.php/m/717706/ ?

Quote:
calling Xtext's generated
XXXStnadaloneSetup.doSetup() whhere the comments in the Acceleo file
tell you to register your Resource Factory.


If you did, and the generation still fails, could you provide us with the model, metamodel and modules you're using on a bugzilla so that we can try and debug what's happening?

Otherwise, could you debug AbstractAcceleoGenerator#generate (at line 189 : "for (int i = 0; i < templateNames.length; i++) {") and tell us what "getModel()" returns? Does it return a proxy, or has your model properly been loaded?

Laurent Goubet
Obeo
Re: [Acceleo 3.1] Metamodel loading issues [message #725715 is a reply to message #725645] Thu, 15 September 2011 15:18 Go to previous messageGo to next message
simon.vivien is currently offline simon.vivienFriend
Messages: 21
Registered: August 2011
Junior Member
Hi,

I tried to call the doSetup() of my meta-model standalone setup, but the issue remains.

I cannot debug the line you mentionned since I launch the generation from an UI Launcher project in which I added a lot of code. I can't launch the generation from the original project anymore, and it seems impossible to launch a generation in debug mode via the UI Launcher (is it ?).
I cannot give you the files either, due to confidentiality.

But, in the two scenarios, installed plugins are supposed to be identical !? I do not understand.

[Updated on: Fri, 16 September 2011 08:02]

Report message to a moderator

Re: [Acceleo 3.1] Metamodel loading issues [message #726784 is a reply to message #725715] Mon, 19 September 2011 14:53 Go to previous messageGo to next message
Stephane Begaudeau is currently offline Stephane BegaudeauFriend
Messages: 458
Registered: April 2010
Location: Nantes (France)
Senior Member

Hi,

You can launch the new Eclipse instance in debug mode and then place a break point at the desired location. You could also check the ".emtl" files in your "bin" folder to see the uri of the metamodel serialiazed (if the ".emtl" files are saved as binary files, right click on your project, go to properties and switched to XMI).

You should look for something like this (near the top of the "emtl" files).
<input>
  <takesTypesFrom href="http://www.eclipse.org/uml2/3.0.0/UML#/"/>
</input>


Regards,

Stephane Begaudeau, Obeo

--
Twitter: @sbegaudeau
Google+: stephane.begaudeau
Blog: http://stephanebegaudeau.tumblr.com
Acceleo Documentation: http://docs.obeonetwork.com/acceleo
Re: [Acceleo 3.1] Metamodel loading issues [message #727005 is a reply to message #725571] Tue, 20 September 2011 07:21 Go to previous messageGo to next message
simon.vivien is currently offline simon.vivienFriend
Messages: 21
Registered: August 2011
Junior Member
Hi,

In the scenario (1) in which I use a second instance, the generation works fine.
The problem is when I want to install my plugins through an update-site into a fresh install of Eclipse. Moreover, I launch my generation with the UI Launcher Project I generated (right click on a model file -> generate code), so I cannot launch any generation into debug mode.

Concerning the .emtl file, it does contain the right metamodel uri.
But as I explained earlier, in one of the two scenarios, the generation won't work, even though the two solutions are based on the very same .emtl file.


Regards,
Simon

EDIT : I rebuild the update-site, and it now works... I basically didn't change a single line of code, so I'm not sure to understand what was happening. However, I'd be interested in a way of launching a generation in debug mode via the UI Launcher Project, if it is possible. Thanks.

[Updated on: Tue, 20 September 2011 08:04]

Report message to a moderator

Re: [Acceleo 3.1] Metamodel loading issues [message #728562 is a reply to message #727005] Fri, 23 September 2011 13:33 Go to previous messageGo to next message
simon.vivien is currently offline simon.vivienFriend
Messages: 21
Registered: August 2011
Junior Member
Hi,

I am facing again the same issue. I did not know how, but the update-site ended up working a few days ago (cf. the EDIT part of my previous comment). I made modifications in my Acceleo templates, and wanted to update the update-site, and I now have the same error...
This is seriously annoying, since the only modifications I made are in the Acceleo templates, so they should not impact the meta-model loading.

Any suggestions ?

Regards,
Simon

[Updated on: Fri, 23 September 2011 13:57]

Report message to a moderator

Re: [Acceleo 3.1] Metamodel loading issues [message #729447 is a reply to message #728562] Mon, 26 September 2011 08:28 Go to previous messageGo to next message
Laurent Goubet is currently offline Laurent GoubetFriend
Messages: 1902
Registered: July 2009
Senior Member
Simon,

Other than differences between your two eclipses (the one in which you install the generators missing some dependencies)... I don't really know what could be happening. You can still debug even in this Eclipse, though it is a little more convoluted. Notably, you ought to have the Acceleo SDK installed (and not just the runtime) but when you have it, in the Eclipse you have installed the generators :

Import the Acceleo code :
- Right-click the package explorer and select "Import... > Plug-ins and fragments"
- In the third group "Import As", tick "Projects with source folders" and hit "Next>"
- Filter on "*acceleo" and double-click at least "org.eclipse.acceleo.engine"
- Open AbstractAcceleoGenerator, and place a breakpoint as mentionned in my first post on this thread.

Launch the debug :
- Click on Run > Debug Configurations...
- Double-click "Eclipse Application" then hit "Debug"
- In the new runtime Eclipse you just launched, import the projects containing the model on which you want to launch a generation, then launch it (either through a plugin UI, right-clicking on the model and selecting the accurate menu item, or through a launch config. Whatever the means, the breakpoint you set in your first Eclipse should be hit).

That should at least make for a starting point to determine what could possibly go wrong here.

Laurent Goubet
Obeo
Re: [Acceleo 3.1] Metamodel loading issues [message #729458 is a reply to message #729447] Mon, 26 September 2011 09:02 Go to previous messageGo to next message
simon.vivien is currently offline simon.vivienFriend
Messages: 21
Registered: August 2011
Junior Member
Hi,

Thanks for your answer.
I did debug the line you mentionned earlier in the AbstractAcceleoGenerator, and the meta-model is properly loaded, it isn't a proxy.


Regards,
Simon.
Re: [Acceleo 3.1] Metamodel loading issues [message #729486 is a reply to message #729458] Mon, 26 September 2011 09:55 Go to previous messageGo to next message
Laurent Goubet is currently offline Laurent GoubetFriend
Messages: 1902
Registered: July 2009
Senior Member
Simon,

And yet we do not find any element in the model that match the main template parameters...

Sorry about the hassle, but as you cannot provide us with the models and templates, I can only point you to the lines of code that could be the culprit. Namely, we seek candidates for the generation in AcceleoService#doGenerate() (line 571 : if (argumentType.isInstance(model)) { and line 581 : argumentType.isInstance(potentialTarget)). If none of these if ever return true, then nothing gets generated, and you get the warning mentionned in the original post.

Neither "model" nor "potentialTarget" should be proxies according to what you said earlier. Other potential causes include :
- argumentType is a proxy (and that would be a real blocker as it means that we couldn't load the module properly)
- "argumentType" and one of "model" or "potentialTarget" do match ... but their EClass come from two distinct metamodels (or rather : the metamodel has been loaded twice). You can check this in the "display" view by typing "argumentType.eClass().ePackage() == model.eClass().ePackage()" that "should" return true.
- you really have no element in the model that match "argumentType" (included in the list for completion ... but that cannot be the case as your generation works on that model in other circumstances).

Laurent Goubet
Obeo
Re: [Acceleo 3.1] Metamodel loading issues [message #729560 is a reply to message #729486] Mon, 26 September 2011 14:02 Go to previous messageGo to next message
simon.vivien is currently offline simon.vivienFriend
Messages: 21
Registered: August 2011
Junior Member
Hi,

I managed to launch the generation in debug mode in both scenarios, in order to watch at the argumentType variable.
In the scenario 1 (cf. first post of this thread), the argumentType is correctly retrieved, but in the scenario 2, the argumentType remains set to null. It seems that the findTemplates() call does not return the same list in the two cases.
The templates returned in the scenario 2 does have a parameter field with an empty type.

Hope this will help you to find out what's happening.

Regards,
Simon.
Re: [Acceleo 3.1] Metamodel loading issues [message #730045 is a reply to message #729560] Tue, 27 September 2011 14:33 Go to previous messageGo to next message
Stephane Begaudeau is currently offline Stephane BegaudeauFriend
Messages: 458
Registered: April 2010
Location: Nantes (France)
Senior Member

Hi,

If the templates have parameters with empty types, we didn't found the metamodel when we have loaded the modules. There are two possibles explanations:
- when you are producing your update site, the emtl files, preferably serialized as XMI based resources (not binary) do not have the metamodel declared like this:
<input>
  <takesTypesFrom href="http://www.eclipse.org/uml2/3.0.0/UML#/"/>
</input>


But like that:
<input>
  <takesTypesFrom href="<path_to_my_ecore_file>"/>
</input>


And once deployed in your Eclipse, we can't find "<path_to_my_ecore_file>" anymore. In that case, the parameters or the type of the template should be an EMF proxy. You can have a look at its uri (EcoreUtil.getURI(...)) to see what metamodel we are looking for.

- Or, the emtl in the jars of your update site are ok, and the metamodel is not correctly registered in the other Eclipse. You can create a new empty ecore model in your Eclipse and then right click -> load resource and browse register package to see if it is there. You can use AcceleoPackageRegistry.getEPackage(String) to see if the package matching your URI is there before the loading of your Acceleo module in the initialize method of your Java launcher.

Regards,

Stephane Begaudeau, Obeo

--
Twitter: @sbegaudeau
Google+: stephane.begaudeau
Blog: http://stephanebegaudeau.tumblr.com
Acceleo Documentation: http://docs.obeonetwork.com/acceleo
Re: [Acceleo 3.1] Metamodel loading issues [message #730083 is a reply to message #730045] Tue, 27 September 2011 15:28 Go to previous messageGo to next message
simon.vivien is currently offline simon.vivienFriend
Messages: 21
Registered: August 2011
Junior Member
Hi,

I checked my emtl files and they are ok.
Moreover, my metamodel is correctly registered as it appears in the registered packages list.
Still, the generation won't work ..


Regards,
Simon.

EDIT : I also sysout the getEPackage() result at the beggining of the run() method in the Acceleo UI Project, and it returns the right package, so my metamodel seems definitely loaded.

[Updated on: Wed, 28 September 2011 07:35]

Report message to a moderator

Re: [Acceleo 3.1] Metamodel loading issues [message #730797 is a reply to message #730083] Thu, 29 September 2011 07:49 Go to previous messageGo to next message
Laurent Goubet is currently offline Laurent GoubetFriend
Messages: 1902
Registered: July 2009
Senior Member
Hi Simon,

Quote:
The templates returned in the scenario 2 does have a parameter field with an empty type.

Quote:
getEPackage() result at the beggining of the run() method in the Acceleo UI Project

Could you sysout the "template.getParameters().getType().eResource().getURI()" (or, if "eResource()" is null, "((InternalEObject)template.getParameters().getType()).eProxyURI()"), and compare it with the "getEPackage().eResource().getURI()" ? My guess it that those two URIs are different. In short the URI that is in the emtl :

<takesTypesFrom href="<URI of the metamodel>"/>

or declared in the module declaration on top of the mtl file :
[module myModule('<URI of the metamodel>')]


does not match the "NsURI" that you declared in your metamodel

Laurent Goubet
Obeo
Re: [Acceleo 3.1] Metamodel loading issues [message #730881 is a reply to message #730797] Thu, 29 September 2011 12:49 Go to previous messageGo to next message
simon.vivien is currently offline simon.vivienFriend
Messages: 21
Registered: August 2011
Junior Member
Hi,

The nsURI that I declared in my metamodel does match with the URI I declared in my .mtl files.

The "template.getParameters().getType().eResource().getURI()" call returns the .ecore location in the scenario 2 (when the generation does not work).
But the same call at the same moment returns the correct URI in the scenario 1 !


Sorry to insist on that, but I repeat that both scenarios are based on the very same code, and the generation works in one of these two cases. It seems that the update-site building is the problem.

Regards,
Simon.

[Updated on: Thu, 29 September 2011 13:22]

Report message to a moderator

Re: [Acceleo 3.1] Metamodel loading issues [message #730886 is a reply to message #730083] Thu, 29 September 2011 12:39 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi Simon

You might want to review
https://bugs.eclipse.org/bugs/show_bug.cgi?id=345708 to see if your
problems bear any resemblance to some that I have. I notice a reference
to the UML metamodel earlier in this thread. If you have UML open as a
project then that may cause interesting effects. I recommend avoiding
the possibility that platform:/resource/... and platform:/plugin/...
could reference different files; I find Acceleo and many other tools are
weak on URI resolution, particularly standalone, and even more so when
plugin and standalone need to co-operate (editor + executor). MWE has
some interesting classpath technology in its StandaloneSetup that I've
just wrapped up as a simple ResourceSet initializer to register all
plugins and projects in both EcorePlugin.getPlatformResourceMap and the
ResourceSet.getUriConverter().getURIMap(). I plan to contribute this to
EMF once I've tested it a bit more, then maybe projects can stop
providing their own wrong solutions.

Regards

Ed Willink


On 27/09/2011 16:28, simon.vivien wrote:
> Hi,
>
> I checked my emtl files and they are ok.
> Moreover, my metamodel is correctly registered as it appears in the
> registered packages list (I didn't succeed to sysout the getEPackage()
> result, but I will retry tommorow).
> Still, the generation won't work ..
>
>
> Regards,
> Simon.
Re: [Acceleo 3.1] Metamodel loading issues [message #730906 is a reply to message #730881] Thu, 29 September 2011 13:53 Go to previous messageGo to next message
simon.vivien is currently offline simon.vivienFriend
Messages: 21
Registered: August 2011
Junior Member
It seems that I finnaly solved the problem.

I updated Acceleo from 3.1.0 to 3.1.1, re-built the site, and it now works.


Regards,
Simon.
Re: [Acceleo 3.1] Metamodel loading issues [message #731153 is a reply to message #730906] Fri, 30 September 2011 06:56 Go to previous message
Laurent Goubet is currently offline Laurent GoubetFriend
Messages: 1902
Registered: July 2009
Senior Member
Simon,

This issue does not remind me of any known fix we had for 3.1.1 ... but glad it did do the trick.

Laurent Goubet
Obeo
Previous Topic:Modularizing an Acceleo transformation
Next Topic:invoking workflow with XPandfacade causes problems with primitive types
Goto Forum:
  


Current Time: Fri Apr 19 08:34:15 GMT 2024

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

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

Back to the top