Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » [Acceleo] Resource Factory issue(Migration from Acceleo 3.0.3 to 3.1)
[Acceleo] Resource Factory issue [message #708233] Tue, 02 August 2011 15:45 Go to next message
simon.vivien is currently offline simon.vivienFriend
Messages: 21
Registered: August 2011
Junior Member
Hello,

I started an Acceleo project based on a custom metamodel, and everything was working until I decided to migrate from Acceleo 3.0.3 to 3.1.

Without making any modification in my templates, I now have this error when I try to generate some code :

Exception in thread "main" java.lang.RuntimeException: Cannot create a resource for 'file:/Users/siv/Documents/repos/pod-programming/modeling/podml/org.eclipse.acceleo.podml.to.java.bis/src/scrum.podml'; a registered resource factory is needed
at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.getResource(ResourceSetImpl.java:394)
at org.eclipse.acceleo.common.utils.ModelUtils.load(ModelUtils.java:348)
at org.eclipse.acceleo.engine.service.AbstractAcceleoGenerator.initialize(AbstractAcceleoGenerator.java:416)
at com.podprogramming.framework.ui.classesgeneration.common.Generate.<init>(Generate.java:96)
at com.podprogramming.framework.ui.classesgeneration.common.Generate.main(Generate.java:143)

Until now, it wasn't necessary to mannually register the ResourceFactory. Any ideas about the cause of this issue ?

Regards.
Re: [Acceleo] Resource Factory issue [message #708285 is a reply to message #708233] Tue, 02 August 2011 16:17 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 4154
Registered: July 2009
Senior Member
Hi

Yes. "a registered resource factory is needed".

Read the comments in your generated Java file.

[Acceleo has been having considerable difficulty with model access,
mostly making improvements, but not always.
You are seeing a 'better'/different 3.1 behaviour.]

Regards

Ed Willink

On 02/08/2011 16:45, simon.vivien wrote:
> Hello,
>
> I started an Acceleo project based on a custom metamodel, and
> everything was working until I decided to migrate from Acceleo 3.0.3
> to 3.1.
>
> Without making any modification in my templates, I now have this error
> when I try to generate some code :
>
> Exception in thread "main" java.lang.RuntimeException: Cannot create a
> resource for
> 'file:/Users/siv/Documents/repos/pod-programming/modeling/podml/org.eclipse.acceleo.podml.to.java.bis/src/scrum.podml';
> a registered resource factory is needed
> at
> org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.getResource(ResourceSetImpl.java:394)
> at
> org.eclipse.acceleo.common.utils.ModelUtils.load(ModelUtils.java:348)
> at
> org.eclipse.acceleo.engine.service.AbstractAcceleoGenerator.initialize(AbstractAcceleoGenerator.java:416)
> at
> com.podprogramming.framework.ui.classesgeneration.common.Generate.<init>(Generate.java:96)
> at
> com.podprogramming.framework.ui.classesgeneration.common.Generate.main(Generate.java:143)
>
> Until now, it wasn't necessary to mannually register the
> ResourceFactory. Any ideas about the cause of this issue ?
>
> Regards.
Re: [Acceleo] Resource Factory issue [message #708779 is a reply to message #708285] Wed, 03 August 2011 07:04 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, but it seems weird to mannually register the Resource Factory for the meta-model from which I created my Acceleo Project. I mean, it is the main meta-model, and the comments in the Generate.java class says that the user can mannually register some 'extra' factories on purpose.
Re: [Acceleo] Resource Factory issue [message #709724 is a reply to message #708779] Thu, 04 August 2011 08:23 Go to previous messageGo to next message
Laurent Goubet is currently offline Laurent GoubetFriend
Messages: 1638
Registered: July 2009
Senior Member
Simon,

Your generated Java launcher should already have the required resource factory registered from its "registerResourceFactories" method if it did work with Acceleo 3.0.3. Otherwise, that could be a difference between the Eclipse in which you had 3.0.3 installed and the Eclipse in which you have 3.1.0 (was your "podml" metamodel plugin installed in that previous Eclipse? Is it in the new?). It could also be a difference in the order in which you do things : if you double-click a "podml" file in your workspace, is it properly loaded in its generated editor (if you generated the editor code)? Is it even recognized as an ecore model, or is it opened in the text editor when you double-click it? It it does open in its own editor and not in the text editor, you should not see the problem again if you re-launch the Acceleo generator.

In other words ... no, there is no difference in resource factory handling between Acceleo 3.0.3 and Acceleo 3.1.0 that I know of. However the resource factory *does* need to be registered somewhere. If it is not by your Acceleo launcher, it must be by one of the plugins : either the podml plugin if you install it in your Eclipse, or EMF itself when you will try to open a podml file in an editor.

Laurent Goubet
Obeo
Re: [Acceleo] Resource Factory issue [message #709927 is a reply to message #709724] Thu, 04 August 2011 13:39 Go to previous messageGo to next message
simon.vivien is currently offline simon.vivienFriend
Messages: 21
Registered: August 2011
Junior Member
Hi,

My podml files DO open in their generated editor, so the metamodel plugin seems to be correctly installed.
However, I forgot to mention that my resource factory is handled by Xtext (2.0), and that it worked under Acceleo 3.0.3/Xtext 2.0. Maybe it is some compatibility problem between Acceleo 3.1 and Xtext 2.0

Regards,
Simon.

[Updated on: Thu, 04 August 2011 13:40]

Report message to a moderator

Re: [Acceleo] Resource Factory issue [message #710059 is a reply to message #709927] Thu, 04 August 2011 16:12 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 4154
Registered: July 2009
Senior Member
Hi

Xtext 2.0 and Acceleo 3.1 work fine together provided you register the
Resource Factory which you do by calling Xtext's generated
XXXStnadaloneSetup.doSetup() whhere the comments in the Acceleo file
tell you to register your Resource Factory.

Regards

Ed Willink

On 04/08/2011 14:39, simon.vivien wrote:
> Hi,
>
> My podml files DO open in their generated editor, so the metamodel
> plugin seems to be correctly installed).
> However, I forgot to mention that my resource factory is handled by
> Xtext (2.0), and that it worked under Acceleo 3.0.3/Xtext 2.0. Maybe
> it is some compatibility problem between Acceleo 3.1 and Xtext 2.0
>
> Regards,
> Simon.
Re: [Acceleo] Resource Factory issue [message #710589 is a reply to message #710059] Fri, 05 August 2011 07:36 Go to previous messageGo to next message
Laurent Goubet is currently offline Laurent GoubetFriend
Messages: 1638
Registered: July 2009
Senior Member
Hi Ed, Simon,

This incompatibility is not something we were aware of, nor was the way to register the Xtext resource factory through a "doSetup".

Simon, If you try and use Acceleo 3.0.3 in the very same environment you are in now, are you sure that the generation indeed works successfuly? i.e : is it really _only_ Acceleo that changed or is this incompatibility really coming from a number of factors? When you use Ed's suggestion of registering the factory though the "standaloneSetup.doSetup()" method, is the problem fixed?

If it does, this is definitely something we have to document somewhere, since AFAIK working with Xtext models as input of Acceleo generations was really straightforward before.

Laurent Goubet
Obeo
Re: [Acceleo] Resource Factory issue [message #710679 is a reply to message #710589] Fri, 05 August 2011 09:45 Go to previous messageGo to next message
Laurent Goubet is currently offline Laurent GoubetFriend
Messages: 1638
Registered: July 2009
Senior Member
Simon, something I just detected but ... could this stem from https://bugs.eclipse.org/bugs/show_bug.cgi?id=353981 ? It seems we mix up the URIs when using XMI serialization for the modules. (Right-click your Acceleo project > Acceleo Compiler > select "XMI" instead of "binary".)
Re: [Acceleo] Resource Factory issue [message #710688 is a reply to message #710589] Fri, 05 August 2011 09:53 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 4154
Registered: July 2009
Senior Member
Hi Laurent
> If it does, this is definitely something we have to document
> somewhere, since AFAIK working with Xtext models as input of Acceleo
> generations was really straightforward before.
I don't think anything has changed here. Xtext's smart textual resources
are very clever in that they 99% hide all the magic. However the
remaining 1% shows up in standalone usage. In
https://bugs.eclipse.org/bugs/show_bug.cgi?id=340408 I tried to get this
fixed, but it seems that every appliocation must be coded to accommodate
this Xtextism since Xtext won't fix it itself.

Regards

Ed Willink
Re: [Acceleo] Resource Factory issue [message #716729 is a reply to message #708233] Thu, 18 August 2011 08:59 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 tips, but I'm having some serious issues with my dev environement, and I can't have my Resource Factory error back again, so I'm not able to test your solutions.

I ended up with going back to my old environement (Helios + Xtext 2 + Acceleo 3.0.3), since I lost more than a week to make Indigo works...

Thanks anyway, I'll try your solutions later.
Re: [Acceleo] Resource Factory issue [message #717706 is a reply to message #716729] Mon, 22 August 2011 07:06 Go to previous message
simon.vivien is currently offline simon.vivienFriend
Messages: 21
Registered: August 2011
Junior Member
Hi,

Since I was using the same workspace in Helios and Indigo, I had a lot of issues. So I made a clean installation of Indigo and remade all my projects. As a consequence, it finally works and I didn't see the Resource Factory error again.
Thanks anyway for your tips, I hope it will help some other people facing similar issues.

Simon
Previous Topic:[JET] Select (with dynamic variable) difference from v0.8.1 to v1.1.1 error No Children
Next Topic:[Acceleo] how to format generated java code?
Goto Forum:
  


Current Time: Fri Nov 28 13:44:11 GMT 2014

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

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