Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » parameter of the main template is a proxy(getting all the time the following error: parameter of the main template is a proxy)
parameter of the main template is a proxy [message #1006021] Tue, 29 January 2013 15:15 Go to next message
veronika domova is currently offline veronika domovaFriend
Messages: 7
Registered: January 2013
Junior Member
Hey!!
I am developeng an Acceleo project. It works perfectly when i launch it from eclipse as Acceleo plugin. Whenever i export it as a plugin and then install to eclipse, or try to launch as a Java application I am getting the following exception: the first parameter of the main template is a proxy. May be the tricky part here is that i use the meta-model which is defined in another plugin. So my plugin has that one in dependencies.

As it works when I launch it as Acceleo plugin from Eclipse, i assume, that there are no problems with my templates or models. Probably some dependencies trouble?

What may be wrong? I am trying to fix this for several days so far reading your forums, doesnt really help.

Is there any possibility to see the detailed log, what is not initialized, when this proxy happens?
Dont see any errors, while debugging. Why doesnt it throw any exception, when smth is initialized as proxy if its so critical for further work?

Please help!!

Thanx
Re: parameter of the main template is a proxy [message #1006074 is a reply to message #1006021] Tue, 29 January 2013 18:04 Go to previous messageGo to next message
veronika domova is currently offline veronika domovaFriend
Messages: 7
Registered: January 2013
Junior Member
May be its also a problem with packages manual registration.
Please suggest me what should be there in the packages registration function. I am attaching my model screenshot. Btw, the model uri doesnt start with "http". Could it be the reason?

Here is now what i have in the package registration function at the moment:

if (!isInWorkspace(LibraryElementPackage.class))
{
resourceSet.getPackageRegistry().put(LibraryElementPackage.eNS_URI,
LibraryElementPackage.eINSTANCE);

resourceSet.getPackageRegistry().put(DataPackage.eNS_URI, DataPackage.eINSTANCE);
resourceSet.getPackageRegistry().put(UiPackage.eNS_URI, UiPackage.eINSTANCE);
resourceSet.getPackageRegistry().put(PalettePackage.eNS_URI, PalettePackage.eINSTANCE);
resourceSet.getPackageRegistry().put(VirtualDNSPackage.eNS_URI, DataPackage.eINSTANCE);
}

here is registerResourceFactories (not sure what i should put here, please guide me. My model files are initially with "XML" extension and contain XMI inside)

resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put("xmi", new LibraryElementResourceFactoryImpl());
  • Attachment: model.png
    (Size: 42.23KB, Downloaded 335 times)
Re: parameter of the main template is a proxy [message #1006125 is a reply to message #1006074] Wed, 30 January 2013 05:34 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33133
Registered: July 2009
Senior Member
Veronika,

Proxies are generally the result of cross document references within the
instances themselves that fail to resolve. It's unlikely to be caused
by missing package registrations. A more likely cause stems from the URI
you're trying to use to load the instances, but you've said nothing
about that. In particular, if you don't use an absolute URI, e.g,.
platform:/resource/... or file:/c:/... any serialized references that
use relative paths will fail to resolve...


On 29/01/2013 7:04 PM, veronika domova wrote:
> May be its also a problem with packages manual registration.
> Please suggest me what should be there in the packages registration function. I am attaching my model screenshot. Btw, the model uri doesnt start with "http". Could it be the reason?
>
> Here is now what i have in the package registration function at the moment:
>
> if (!isInWorkspace(LibraryElementPackage.class))
> {
> resourceSet.getPackageRegistry().put(LibraryElementPackage.eNS_URI,
> LibraryElementPackage.eINSTANCE);
>
> resourceSet.getPackageRegistry().put(DataPackage.eNS_URI, DataPackage.eINSTANCE);
> resourceSet.getPackageRegistry().put(UiPackage.eNS_URI, UiPackage.eINSTANCE);
> resourceSet.getPackageRegistry().put(PalettePackage.eNS_URI, PalettePackage.eINSTANCE);
> resourceSet.getPackageRegistry().put(VirtualDNSPackage.eNS_URI, DataPackage.eINSTANCE);
> }
>
> here is registerResourceFactories (not sure what i should put here, please guide me. My model files are initially with "XML" extension and contain XMI inside)
>
> resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put("xmi", new LibraryElementResourceFactoryImpl());


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: parameter of the main template is a proxy [message #1006195 is a reply to message #1006125] Wed, 30 January 2013 12:22 Go to previous messageGo to next message
veronika domova is currently offline veronika domovaFriend
Messages: 7
Registered: January 2013
Junior Member
Hey again!!

I just noticed that, if the model project is also open as a project in the workspace, then acceleo plugin application launch works perfectly. But if i close the project, everything still compiles, but the acceleo plugin application launch gives me the proxy error [notice please that its not even JAVA launch]. The model plugin is already installed to Eclipse. Seems that Acceleo doesnt see it when launching the app, but it saw it perfectly when i was creating the project.. Why?

Attaching the screenshot as well

  • Attachment: model2.png
    (Size: 26.16KB, Downloaded 315 times)
Re: parameter of the main template is a proxy [message #1006199 is a reply to message #1006195] Wed, 30 January 2013 12:33 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33133
Registered: July 2009
Senior Member
Veronika,

Without knowing what your instances look like (i.e., their serialized
XML), what the cross references look like (i.e., the hrefs in the XML),
what URIs you use to load the instances (I've already asked about
those), nor even a stack trace (always include one in your question when
you say there is one), there's really nothing anyone can do to help you...

On 30/01/2013 1:22 PM, veronika domova wrote:
> Hey again!!
>
> I just noticed that, if the model project is also open as a project in the workspace, then acceleo plugin application launch works perfectly. But if i close the project, everything still compiles, but the acceleo plugin application launch gives me the proxy error [notice please that its not even JAVA launch]. The model plugin is already installed to Eclipse. Seems that Acceleo doesnt see it when launching the app, but it saw it perfectly when i was creating the project.. Why?
>
> Attaching the screenshot as well
>
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: parameter of the main template is a proxy [message #1006204 is a reply to message #1006021] Wed, 30 January 2013 12:53 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

You'll find a number of comments from me highlighting the need to use
particular version of Acceleo.

You haven't said what version you are using.

Regards

Ed Willink


On 29/01/2013 15:47, veronika domova wrote:
> What may be wrong? I am trying to fix this for several days so far
> reading your forums, doesnt really help.
Re: parameter of the main template is a proxy [message #1006208 is a reply to message #1006199] Wed, 30 January 2013 13:12 Go to previous messageGo to next message
veronika domova is currently offline veronika domovaFriend
Messages: 7
Registered: January 2013
Junior Member
Ed,
thanx for collaboration. Sorry, I though there might be some general approach for my case. Attaching now some sources and output.

Concerning URIs being used to load the instances, i just set it in the Acceleo launch configuration window. See the screenshot please.

This is what i get for eProxyPath while debuggin:
file:/home/veronika/Program_Files/CLEAN/4DIAC-IDE_1.2.0_Linux/workspace/bigTest/bin/bigTest/main/org.fordiac.ide.model#//AutomationSystem)

EXCEPTION OUTPUT:
Exception in thread "main" org.eclipse.acceleo.engine.AcceleoEvaluationException: The type of the first parameter of the main template named 'generateElement' is a proxy.
at org.eclipse.acceleo.engine.service.AcceleoService.doGenerate(AcceleoService.java:566)
at org.eclipse.acceleo.engine.service.AbstractAcceleoGenerator.generate(AbstractAcceleoGenerator.java:193)
at org.eclipse.acceleo.engine.service.AbstractAcceleoGenerator.doGenerate(AbstractAcceleoGenerator.java:158)
at bigTest.main.Generate.doGenerate(Generate.java:214)
at bigTest.main.Generate.main(Generate.java:172)

MTL:

[comment encoding = UTF-8 /]
[**
* The documentation of the module generate.
*/]
[module generate('org.fordiac.ide.model')]

[**
* The documentation of the template generateElement.
* @param anAutomationSystem
*/]
[template public generateElement(anAutomationSystem : AutomationSystem)]
[comment @main/]
[file (anAutomationSystem.name, false, 'UTF-8')]
test
[/file]
[/template]

COMPILED EMTL [some first rows, let me know if you need entire]:
<mtl:Module name="generate" nsURI="bigTest::main::generate" startHeaderPosition="83" endHeaderPosition="217">
<documentation xsi:type="mtl:ModuleDocumentation">
<body startPosition="32" endPosition="80" value="&#xA;The documentation of the module generate.&#xA;&#xA;"/>
</documentation>
<input>
<takesTypesFrom href="org.fordiac.ide.model#/"/>
</input>

XML that is passed to the template:
<?xml version="1.0" encoding="UTF-8"?>
<libraryElement:AutomationSystem xmi:version="2.0" xmlns:xmi="htt p:/ /www .omg.org/XMI" xmlns:libraryElement="org.fordiac.ide.model" name="Boiler" id="_74JrEBq1EeG0i7iuCMyDJA">
<versionInfo author="Author" organization="4DIAC-Consortium" version="1.0"/>
<application comment="" name="MyBoiler">
<fBNetwork href="MyBoiler.xml#//@fbNetwork"/>
</application>
<application comment="" name="globals">
<fBNetwork href="globals.xml#//@fbNetwork"/>
</application>
<systemConfiguration>
<systemConfigurationNetwork href="SysConf.xml#//@systemConfigNetwork"/>
</systemConfiguration>
</libraryElement:AutomationSystem>
  • Attachment: model2.png
    (Size: 57.32KB, Downloaded 307 times)
Re: parameter of the main template is a proxy [message #1006209 is a reply to message #1006208] Wed, 30 January 2013 13:13 Go to previous messageGo to next message
veronika domova is currently offline veronika domovaFriend
Messages: 7
Registered: January 2013
Junior Member
Acceleo version is: 3.3.1
Re: parameter of the main template is a proxy [message #1006211 is a reply to message #1006209] Wed, 30 January 2013 13:23 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

3.3.1 should be good.

When I get Proxy resolution failure I set a breakpoint in
EcoreUtil.resolve(EObject proxy, ResourceSet resourceSet) at the retry in:

try
{
resolvedObject = resourceSet.getEObject(proxyURI, true);
}
catch (RuntimeException exception)
{
resolvedObject = resourceSet.getEObject(proxyURI, false);
}

since for nearly all purposes the first call fails and the second fails
again for the same reason, so you can single step to discover why the
proxy resolution is failing, unless of course looking at the URI alone
tells you what the problem is.

Regards

Ed Willink

On 30/01/2013 13:13, veronika domova wrote:
> Acceleo version is: 3.3.1
Re: parameter of the main template is a proxy [message #1006261 is a reply to message #1006208] Wed, 30 January 2013 15:41 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33133
Registered: July 2009
Senior Member
Is there really a file here in the file system?

/home/veronika/Program_Files/CLEAN/4DIAC-IDE_1.2.0_Linux/workspace/bigTest/bin/bigTest/main/org.fordiac.ide.model

The fact it's in a bin folder seems problematic already, because it
probably started out in a src folder...


On 30/01/2013 2:12 PM, veronika domova wrote:
> Ed,
> thanx for collaboration. Sorry, I though there might be some general approach for my case. Attaching now some sources and output.
>
> Concerning URIs being used to load the instances, i just set it in the Acceleo launch configuration window. See the screenshot please.
>
> This is what i get for eProxyPath while debuggin:
> file:/home/veronika/Program_Files/CLEAN/4DIAC-IDE_1.2.0_Linux/workspace/bigTest/bin/bigTest/main/org.fordiac.ide.model#//AutomationSystem)
>
> EXCEPTION OUTPUT:
> Exception in thread "main" org.eclipse.acceleo.engine.AcceleoEvaluationException: The type of the first parameter of the main template named 'generateElement' is a proxy.
> at org.eclipse.acceleo.engine.service.AcceleoService.doGenerate(AcceleoService.java:566)
> at org.eclipse.acceleo.engine.service.AbstractAcceleoGenerator.generate(AbstractAcceleoGenerator.java:193)
> at org.eclipse.acceleo.engine.service.AbstractAcceleoGenerator.doGenerate(AbstractAcceleoGenerator.java:158)
> at bigTest.main.Generate.doGenerate(Generate.java:214)
> at bigTest.main.Generate.main(Generate.java:172)
>
> MTL:
>
> [comment encoding = UTF-8 /]
> [**
> * The documentation of the module generate.
> */]
> [module generate('org.fordiac.ide.model')]
>
> [**
> * The documentation of the template generateElement.
> * @param anAutomationSystem
> */]
> [template public generateElement(anAutomationSystem : AutomationSystem)]
> [comment @main/]
> [file (anAutomationSystem.name, false, 'UTF-8')]
> test
> [/file]
> [/template]
>
> COMPILED EMTL [some first rows, let me know if you need entire]:
> <mtl:Module name="generate" nsURI="bigTest::main::generate" startHeaderPosition="83" endHeaderPosition="217">
> <documentation xsi:type="mtl:ModuleDocumentation">
> <body startPosition="32" endPosition="80" value="
> The documentation of the module generate.
>
> "/>
> </documentation>
> <input>
> <takesTypesFrom href="org.fordiac.ide.model#/"/>
> </input>
>
> XML that is passed to the template:
> <?xml version="1.0" encoding="UTF-8"?>
> <libraryElement:AutomationSystem xmi:version="2.0" xmlns:xmi="htt p:/ /www .omg.org/XMI" xmlns:libraryElement="org.fordiac.ide.model" name="Boiler" id="_74JrEBq1EeG0i7iuCMyDJA">
> <versionInfo author="Author" organization="4DIAC-Consortium" version="1.0"/>
> <application comment="" name="MyBoiler">
> <fBNetwork href="MyBoiler.xml#//@fbNetwork"/>
> </application>
> <application comment="" name="globals">
> <fBNetwork href="globals.xml#//@fbNetwork"/>
> </application>
> <systemConfiguration>
> <systemConfigurationNetwork href="SysConf.xml#//@systemConfigNetwork"/>
> </systemConfiguration>
> </libraryElement:AutomationSystem>
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: parameter of the main template is a proxy [message #1006278 is a reply to message #1006261] Wed, 30 January 2013 16:37 Go to previous messageGo to next message
veronika domova is currently offline veronika domovaFriend
Messages: 7
Registered: January 2013
Junior Member
hey!
trying to debug, it turns to be really complicated :l

For sure there is no such file path .. seems like it is concatted from the path to mtl file + uri of the object in the meta-model..
file:/home/veronika/Program_Files/CLEAN/4DIAC-IDE_1.2.0_Linux/workspace/bigTest/bin/bigTest/main/org.fordiac.ide.model#//AutomationSystem)

Seems like for some reason it looks for the meta-model object reference in the mtl file folder instead of using installed eclipse plugin..
Finally should be smth like this I guess:
platform:/plugin/org.fordiac.ide.model/model/fordiac.genmodel#//AutomationSystem

Could i register somehow this particular path for the 'org.fordiac.ide.model' uri?


Thanx in advance!
Re: parameter of the main template is a proxy [message #1006286 is a reply to message #1006278] Wed, 30 January 2013 17:04 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33133
Registered: July 2009
Senior Member
Veronika,

Comments below.

On 30/01/2013 5:37 PM, veronika domova wrote:
> hey!
> trying to debug, it turns to be really complicated :l
>
> For sure there is no such file path .. seems like it is concatted from
> the path to mtl file + uri of the object in the meta-model..
> file:/home/veronika/Program_Files/CLEAN/4DIAC-IDE_1.2.0_Linux/workspace/bigTest/bin/bigTest/main/org.fordiac.ide.model#//AutomationSystem)
>
My guess would be that you really want to be loading some file that's in
your src folder and it has a relative reference to something that's not
in that same src folder (or is, but isn't copied to the bin folder), but
are actually loading a file that's in the bin folder, and so the
relative reference expects that references thing to be in that relative
location in the bin folder.
>
> Seems like for some reason it looks for the meta-model object
> reference in the mtl file folder instead of using installed eclipse
> plugin..
> Finally should be smth like this I guess:
> platform:/plugin/org.fordiac.ide.model/model/fordiac.genmodel#//AutomationSystem
Yes.
>
> Could i register somehow this particular path for the
> 'org.fordiac.ide.model' uri?
Not sure about all the Acceeo details. If you have the debugger
working, look in the resource set and look at the URI of the first
resource in that resource set. What URI is that?
>
>
> Thanx in advance!
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: parameter of the main template is a proxy [message #1006294 is a reply to message #1006286] Wed, 30 January 2013 17:21 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

I am afraid that URI resolution in Acceleo is unusual.

The basic problem is that references from compiled templates are created
within an Eclipse context and then resolved in a standalone context.

In order to make this re-resolution work there is some helpful heuristic
code that kind of works for the ordinary cases, but which in my
experience makes life worse in the more complex case.

[You can search for 'my' Acceleo bugs if you want to see the details.]

MDT/OCL uses Acceleo templates from an MWE context, so you may study the
invocations in the org.eclipse.ocl.examples.build project.

I found it necessary to create a StandaloneProjectMap that recreated the
Eclipse registrations for the standalone context. (Most of this
functionality has now been provided by EcorePlugin, so you should be
able to just use that new functionality.) You then just need to ensure
that Acceleo help is bypassed.

Regards

Ed Willink
>> Could i register somehow this particular path for the
>> 'org.fordiac.ide.model' uri?
> Not sure about all the Acceeo details. If you have the debugger
> working, look in the resource set and look at the URI of the first
> resource in that resource set. What URI is that?
Re: parameter of the main template is a proxy [message #1011796 is a reply to message #1006294] Wed, 20 February 2013 09:19 Go to previous message
Laurent Goubet is currently offline Laurent GoubetFriend
Messages: 1902
Registered: July 2009
Senior Member
And once again, can we go back to the initial problem instead of going to the standaloneprojectmap and whatnot?

> It works perfectly when i launch it from eclipse as Acceleo plugin.

This is expected, since in such a case you benefit from the registrations made by EMF and other plugins.

> the first parameter of the main template is a proxy

As Ed Merks mentionned, this is due to the resolution of some references failing. However, contrarily to what he mentions afterwards, this _is_ more often that not due to a failure in resolving a metamodel (a missing or incorrect package registration). Acceleo modules are models themselves; their own metamodel is resolved (since it is Acceleo itself). However, the "target" metamodel of your transformation is the culprit. In this case, you "target" a metamodel which NsURI should be org.fordiac.ide.model because of your module's signature : [module generate('org.fordiac.ide.model')].

Is that the actual NsURI of your model? If yes, it should also be what's returned by a call to LibraryElementPackage.eNS_URI. Otherwise, your registering of resourceSet.getPackageRegistry().put(LibraryElementPackage.eNS_URI, LibraryElementPackage.eINSTANCE); is incorrect.

You also seem to have the project containing your metamodel both as a project in your workspace and as an installed arteface in your current Eclipse. This is rarely a good idea. You might want to close/remove the project, restart your eclipse, then try re-compiling your acceleo modules. That should make for better serialized URLs from EMF.

Laurent Goubet
Obeo
Previous Topic:Generating Templates
Next Topic:[Acceleo] Dynamic Overriding with polymorphic templates
Goto Forum:
  


Current Time: Thu Apr 18 13:28:41 GMT 2024

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

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

Back to the top