Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » [Acceleo] Problem invoke java service
[Acceleo] Problem invoke java service [message #975373] Wed, 07 November 2012 15:46 Go to next message
Guillaume Lincé is currently offline Guillaume Lincé
Messages: 6
Registered: November 2012
Junior Member
Hello,

I'm using Acceleo to generate HTML5/CSS3 from two models. These two models are conform to ecore meta-models. I'm giving the first Model element (root element of the first model) to my main template. For the second one, I'm trying to invoke a java service that gets the Model element (a FCSSModel). When I'm running the java method normally, I get the correct result but when I try to invoke it using a query in acceleo, I get this error:

java.lang.NoClassDefFoundError: be/ac/fundp/info/fCSS/FCSSModel
	at java.lang.Class.getDeclaredMethods0(Native Method)
	at java.lang.Class.privateGetDeclaredMethods(Unknown Source)
	at java.lang.Class.getMethod0(Unknown Source)
	at java.lang.Class.getMethod(Unknown Source)
	at org.eclipse.acceleo.engine.internal.environment.AcceleoLibraryOperationVisitor.findInvokeMethod(AcceleoLibraryOperationVisitor.java:891)
	at org.eclipse.acceleo.engine.internal.environment.AcceleoLibraryOperationVisitor.invoke(AcceleoLibraryOperationVisitor.java:1176)
	at org.eclipse.acceleo.engine.internal.environment.AcceleoLibraryOperationVisitor.callNonStandardOperation(AcceleoLibraryOperationVisitor.java:133)
	at org.eclipse.acceleo.engine.internal.evaluation.AcceleoEvaluationVisitor.visitOperationCallExp(AcceleoEvaluationVisitor.java:1213)
	at org.eclipse.ocl.ecore.impl.OperationCallExpImpl.accept(OperationCallExpImpl.java:390)
	at org.eclipse.ocl.AbstractEvaluationVisitor.visitExpression(AbstractEvaluationVisitor.java:248)
	at org.eclipse.ocl.EvaluationVisitorDecorator.visitExpression(EvaluationVisitorDecorator.java:156)
	at org.eclipse.acceleo.engine.internal.evaluation.AcceleoEvaluationVisitor.switchExpression(AcceleoEvaluationVisitor.java:1887)
	at org.eclipse.acceleo.engine.internal.evaluation.AcceleoEvaluationVisitor.visitExpression(AcceleoEvaluationVisitor.java:1042)
	at org.eclipse.acceleo.engine.internal.evaluation.AcceleoEvaluationVisitor.visitAcceleoQueryInvocation(AcceleoEvaluationVisitor.java:872)
	at org.eclipse.acceleo.engine.internal.evaluation.AcceleoEvaluationVisitor.switchExpression(AcceleoEvaluationVisitor.java:1864)
	at org.eclipse.acceleo.engine.internal.evaluation.AcceleoEvaluationVisitor.visitExpression(AcceleoEvaluationVisitor.java:1042)
	at org.eclipse.acceleo.engine.internal.evaluation.AcceleoEvaluationVisitor.visitAcceleoLetBlock(AcceleoEvaluationVisitor.java:660)
	at org.eclipse.acceleo.engine.internal.evaluation.AcceleoEvaluationVisitor.switchExpression(AcceleoEvaluationVisitor.java:1870)


Here is the code of my module where I invoke the java service:

[comment encoding = UTF-8 /]
[module generate('FCSS ecore URI')/]

[query public getFCSSModel(filePath:String) : FCSSModel
	= invoke('TVLtoHTML5.main.FCSSModelGetter', 'getFCSSModel(java.lang.String)', Sequence{filePath}) /]


Here is how I call the query (in the main template):

[module generateConfigurator('TVL ecore URI','FCSS ecore URI')]

...

[let fcssModel:FCSSModel = '/Users/GLince/workspace/TVLtoHTML5/tvlFiles/tune.fcss'.getFCSSModel()]
[fcssModel.imp.importURI/]
[/let]


I also tried a really simple java service which just returns true to see if the invoke method was working and it was.

From the error's look, it seems it doesn't find the FCSS meta-model or something like that but I don't know why since the URI is specified in each module file.

Do you know where the error could be from?

Thanks for your help,

Guillaume
Re: [Acceleo] Problem invoke java service [message #975993 is a reply to message #975373] Thu, 08 November 2012 03:27 Go to previous messageGo to next message
Laurent Goubet is currently offline Laurent Goubet
Messages: 1622
Registered: July 2009
Senior Member
Guillaume,

Judging by the error message, the most likely cause is that you do not have an explicit dependency between the project containing your Acceleo module and the project containing the java service. Another possibility would be that the latter does not "export" the package containing the Java service and/or the package containing the "be.ac.fundp.info.fCSS.FCSSModel" class.

Laurent Goubet
Obeo
Re: [Acceleo] Problem invoke java service [message #976075 is a reply to message #975993] Thu, 08 November 2012 04:45 Go to previous messageGo to next message
Guillaume Lincé is currently offline Guillaume Lincé
Messages: 6
Registered: November 2012
Junior Member
Hi,

Thanks for your reply. Actually, the java service is in the same project than the acceleo module. I added a dependency (be.fundp.info.fcss) in the required plugins of the manifest file and I don't have the error anymore.

Thanks again,

Guillaume
Re: [Acceleo] Problem invoke java service [message #976108 is a reply to message #976075] Thu, 08 November 2012 05:15 Go to previous messageGo to next message
Laurent Goubet is currently offline Laurent Goubet
Messages: 1622
Registered: July 2009
Senior Member
Guillaume,

Ok, so the dependency problem was in fact one towards the metamodel ... though that is surprising : without this dependency, your java service should not have compiled altogether?

Laurent Goubet
Obeo
Re: [Acceleo] Problem invoke java service [message #976609 is a reply to message #976108] Thu, 08 November 2012 13:10 Go to previous message
Guillaume Lincé is currently offline Guillaume Lincé
Messages: 6
Registered: November 2012
Junior Member
Well yes, even without the dependency, the java service was running without any problem.

Guillaume
Previous Topic:escape chrachter in Xpand
Next Topic:[Acceleo] Dynamic overriding
Goto Forum:
  


Current Time: Sat Aug 02 04:55:01 EDT 2014

Powered by FUDForum. Page generated in 0.01671 seconds