Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Running MWE2 Workflow from ANT buildfile causes ANTLR Error(Explicit encoding was set but is not supported by the available version of the AntlrToolRunner)
Running MWE2 Workflow from ANT buildfile causes ANTLR Error [message #1252775] Fri, 21 February 2014 15:44 Go to next message
Till F. is currently offline Till F.Friend
Messages: 58
Registered: August 2012
Member
Hi,

I'm trying to automate xtext code generation using an Ant build file. I found this article, which pointed mit into the correct direction.

Unfortunately, I get the following error (while everything else seems to work fine):

[java] 12059 [main] ERROR enerator.CompositeGeneratorFragment  - Explicit encoding was set but is not supported by the available version of the AntlrToolRunner.
[java] Please use the ANTLR parser generator in version 2.1 or better


This error does not occur, when I run the workflow manually. I found out that the problem seems to be related with the used libraries (.jar files). In my Ant file, I'm using exactly the same jar files as configured for the project. I ensured this using the Project->Export->Ant Buildfiles functionality of eclipse.

Following are the included .jar files. Any idea what I have to change to get rid of the error?

<pathelement location="${env.ECLIPSE_HOME}/plugins/org.eclipse.xtext_2.5.2.v201402120812.jar"/>
<pathelement location="${env.ECLIPSE_HOME}/plugins/org.eclipse.emf.ecore.xmi_2.9.1.v20131212-0545.jar"/>
<pathelement location="${env.ECLIPSE_HOME}/plugins/org.eclipse.emf.ecore_2.9.2.v20131212-0545.jar"/>
<pathelement location="${env.ECLIPSE_HOME}/plugins/org.eclipse.emf.common_2.9.2.v20131212-0545.jar"/>
<pathelement location="${env.ECLIPSE_HOME}/plugins/org.antlr.runtime_3.2.0.v201101311130.jar"/>
<pathelement location="${env.ECLIPSE_HOME}/plugins/com.google.inject_3.0.0.v201203062045.jar"/>
<pathelement location="${env.ECLIPSE_HOME}/plugins/org.eclipse.emf.mwe.core_1.2.1.v201402030544.jar"/>
<pathelement location="${env.ECLIPSE_HOME}/plugins/org.apache.commons.cli_1.2.0.v201105210650.jar"/>
<pathelement location="${env.ECLIPSE_HOME}/plugins/org.eclipse.emf.mwe2.runtime_2.5.1.v201402030544.jar"/>
<pathelement location="${env.ECLIPSE_HOME}/plugins/org.eclipse.emf.mwe.utils_1.3.1.v201402030544.jar"/>
<pathelement location="${env.ECLIPSE_HOME}/plugins/org.eclipse.xtext.util_2.5.2.v201402120812.jar"/>
<pathelement location="${env.ECLIPSE_HOME}/plugins/com.google.guava_10.0.1.v201203051515.jar"/>
<pathelement location="${env.ECLIPSE_HOME}/plugins/javax.inject_1.0.0.v20091030.jar"/>
<pathelement location="${env.ECLIPSE_HOME}/plugins/org.eclipse.xtext.xbase_2.5.2.v201402120812.jar"/>
<pathelement location="${env.ECLIPSE_HOME}/plugins/org.eclipse.xtext.common.types_2.5.2.v201402120812.jar"/>
<pathelement location="${env.ECLIPSE_HOME}/plugins/org.eclipse.jdt.annotation_1.1.0.v20130513-1648.jar"/>
<pathelement location="${env.ECLIPSE_HOME}/plugins/org.eclipse.xtend.lib_2.5.2.v201402120812.jar"/>
<pathelement location="${env.ECLIPSE_HOME}/plugins/org.eclipse.xtext.xbase.lib_2.5.2.v201402120812.jar"/>
<pathelement location="${env.ECLIPSE_HOME}/plugins/org.eclipse.xtext.generator_2.5.2.v201402120812.jar"/>
<pathelement location="${env.ECLIPSE_HOME}/plugins/org.eclipse.xtend_1.4.0.v201306110406.jar"/>
<pathelement location="${env.ECLIPSE_HOME}/plugins/com.ibm.icu_50.1.1.v201304230130.jar"/>
<pathelement location="${env.ECLIPSE_HOME}/plugins/org.eclipse.xpand_1.4.0.v201306110406.jar"/>
<pathelement location="${env.ECLIPSE_HOME}/plugins/org.eclipse.xtend.typesystem.emf_1.4.0.v201306110406.jar"/>
<pathelement location="${env.ECLIPSE_HOME}/plugins/org.eclipse.emf.codegen.ecore_2.9.1.v20140203-1126.jar"/>
<pathelement location="${env.ECLIPSE_HOME}/plugins/org.eclipse.emf.codegen_2.9.0.v20140203-1126.jar"/>
<pathelement location="${env.ECLIPSE_HOME}/plugins/de.itemis.xtext.antlr_2.0.0.v201108011202.jar"/>
<pathelement location="${env.ECLIPSE_HOME}/plugins/org.antlr.generator_3.2.0.v201108011202.jar"/>
<pathelement location="${env.ECLIPSE_HOME}/plugins/org.eclipse.emf.mwe2.lib_2.5.1.v201402030544.jar"/>
<pathelement location="${env.ECLIPSE_HOME}/plugins/org.eclipse.core.runtime_3.9.0.v20130326-1255.jar"/>
<pathelement location="${env.ECLIPSE_HOME}/plugins/org.eclipse.osgi_3.9.1.v20130814-1242.jar"/>
<pathelement location="${env.ECLIPSE_HOME}/plugins/org.eclipse.equinox.common_3.6.200.v20130402-1505.jar"/>
<pathelement location="${env.ECLIPSE_HOME}/plugins/org.eclipse.core.jobs_3.5.300.v20130429-1813.jar"/>
<pathelement location="${env.ECLIPSE_HOME}/plugins/org.eclipse.core.runtime.compatibility.registry_3.5.200.v20130514-1256/runtime_registry_compatibility.jar"/>
<pathelement location="${env.ECLIPSE_HOME}/plugins/org.eclipse.equinox.registry_3.5.301.v20130717-1549.jar"/>
<pathelement location="${env.ECLIPSE_HOME}/plugins/org.eclipse.equinox.preferences_3.5.100.v20130422-1538.jar"/>
<pathelement location="${env.ECLIPSE_HOME}/plugins/org.eclipse.core.contenttype_3.4.200.v20130326-1255.jar"/>
<pathelement location="${env.ECLIPSE_HOME}/plugins/org.eclipse.equinox.app_1.3.100.v20130327-1442.jar"/>
<pathelement location="${env.ECLIPSE_HOME}/plugins/org.eclipse.core.resources_3.8.101.v20130717-0806.jar"/>
<pathelement location="${env.ECLIPSE_HOME}/plugins/org.apache.commons.logging_1.1.1.v201101211721.jar"/>
<pathelement location="${env.ECLIPSE_HOME}/plugins/org.eclipse.emf.mwe2.launch_2.5.1.v201402030750.jar"/>
<pathelement location="${env.ECLIPSE_HOME}/plugins/org.eclipse.emf.mwe2.language_2.5.1.v201402030750.jar"/>
<pathelement location="${env.ECLIPSE_HOME}/plugins/org.eclipse.ocl.ecore_3.3.0.v20130520-1222.jar"/>
<pathelement location="${env.ECLIPSE_HOME}/plugins/org.eclipse.ocl_3.3.0.v20130909-1552.jar"/>
<pathelement location="${env.ECLIPSE_HOME}/plugins/lpg.runtime.java_2.0.17.v201004271640.jar"/>
<pathelement location="${env.ECLIPSE_HOME}/plugins/org.eclipse.ocl.common_1.1.0.v20130531-0544.jar"/>
<pathelement location="${env.ECLIPSE_HOME}/plugins/org.eclipse.ui.workbench_3.105.1.v20130821-1411.jar"/>
<pathelement location="${env.ECLIPSE_HOME}/plugins/org.eclipse.e4.ui.workbench3_0.12.0.v20130515-1857.jar"/>
<pathelement location="${env.ECLIPSE_HOME}/plugins/org.apache.log4j_1.2.15.v201012070815.jar"/>
Re: Running MWE2 Workflow from ANT buildfile causes ANTLR Error [message #1252807 is a reply to message #1252775] Fri, 21 February 2014 16:23 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13637
Registered: July 2009
Senior Member
Hi is the a .somethingwithantlrandgenerator.jar in your project


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Running MWE2 Workflow from ANT buildfile causes ANTLR Error [message #1252948 is a reply to message #1252775] Fri, 21 February 2014 19:45 Go to previous messageGo to next message
Till F. is currently offline Till F.Friend
Messages: 58
Registered: August 2012
Member
Hi Christian,

what do you mean by "in the project"?

There is one .jar in the dependencies that is called similar (org.antlr.generator_3.2.0.v201108011202.jar). It is required to run the workflow (if I exclude it, I get a classnotfound exception). IMHO version 3.2 is "better" than 2.1...

Cheers,
Till
Re: Running MWE2 Workflow from ANT buildfile causes ANTLR Error [message #1252968 is a reply to message #1252948] Fri, 21 February 2014 20:10 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13637
Registered: July 2009
Senior Member
;D this is what i meant ;D

Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Running MWE2 Workflow from ANT buildfile causes ANTLR Error [message #1253528 is a reply to message #1252968] Sat, 22 February 2014 11:09 Go to previous messageGo to next message
Till F. is currently offline Till F.Friend
Messages: 58
Registered: August 2012
Member
Hi,

I feel I didn't get the point. What can I do now? Everything seems to be correct for me... the error message state that I should use a newer version of the ANTLR generator than 2.1, and that's exactly what I do...
Re: Running MWE2 Workflow from ANT buildfile causes ANTLR Error [message #1253544 is a reply to message #1253528] Sat, 22 February 2014 11:34 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13637
Registered: July 2009
Senior Member
then the arror should not occur.
so please have a look that the class "AntlrToolfacade" and make sure your version of the de.itemis.xtext.antlr.toolrunner.AntlrToolRunner class
has a method runWithEncodingAndParams.

in my case i have the bundle de.itemis.xtext.antlr.source_2.1.0.v201308291703.jar installed which contains that class.
the downloaded antlr-generator-3.2.0.jar does this too (it may be stored as "./.antlr-generator-3.2.0.jar" in the runtime project in your case
(this depends on your setup


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Running MWE2 Workflow from ANT buildfile causes ANTLR Error [message #1255261 is a reply to message #1252775] Mon, 24 February 2014 08:59 Go to previous messageGo to next message
Till F. is currently offline Till F.Friend
Messages: 58
Registered: August 2012
Member
This is pretty confusing.

I don't have any de.itemis.xtext.antlr{*}2.1.0{*}.jar on my machine. Instead, I can only find a 2.0.0 version.

But as said, the "regular" method to run the MWE2 workflow does not result in any errors. And because I'm using exactly the same .jar files within the ANT build file as available to eclipse, I don't understand why I should download a 2.1.0 to get it working. Ah, and I never downloaded any antlr-generator-3.2.0.jar file. It has always been available in my eclipse plugin directory. It does not reside in my workspace or so.

And now after I've learned that there's a 2.1.0 xtext.antlr version, I'm also confused why it seems that I don't get the latest release when I press "check for updates" in my eclipse 4.3.1. Are there any new update sites?

Shocked many questions at once Smile

[Updated on: Mon, 24 February 2014 09:00]

Report message to a moderator

Re: Running MWE2 Workflow from ANT buildfile causes ANTLR Error [message #1255271 is a reply to message #1255261] Mon, 24 February 2014 09:11 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13637
Registered: July 2009
Senior Member
Hi,

please have a look if the regular workflow downloaded the .antlr-generator-3.2.0.jar to your project (containing the workflow)


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Running MWE2 Workflow from ANT buildfile causes ANTLR Error [message #1255329 is a reply to message #1255271] Mon, 24 February 2014 10:30 Go to previous messageGo to next message
Till F. is currently offline Till F.Friend
Messages: 58
Registered: August 2012
Member
No antlr-generator-3.2.0.jar in my project (i searched the whole project on the file system, see screenshot). But as said, this .jar is on the dependencies list of my project and can be found in the eclipse plugins directory. However, this .jar is also used for the Ant build.

I rather think the problem is related to the fact that I've only got de.itemis.xtext.antlr_2.0.0.v201108011202.jar (and not 2.1.0) in my plugins directory. There is no class "AntlrToolfacade" inside. But this still leaves unanswered why I don't get any problems when running the MWE workflow directly....
Re: Running MWE2 Workflow from ANT buildfile causes ANTLR Error [message #1255338 is a reply to message #1255329] Mon, 24 February 2014 10:37 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13637
Registered: July 2009
Senior Member
Sorry I have no idea on that
Maybe you can use the debugger to find out which class is used in
eclipse

--
Need training, onsite consulting or any other kind of help for Xtext?
Go visit http://xtext.itemis.com or send a mail to xtext at itemis dot de


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Running MWE2 Workflow from ANT buildfile causes ANTLR Error [message #1255358 is a reply to message #1255329] Mon, 24 February 2014 11:00 Go to previous messageGo to next message
Till F. is currently offline Till F.Friend
Messages: 58
Registered: August 2012
Member
I just debugged the MWE2 workflow and found the explanation for the experienced behaviour:

In any case, the method "AntlrToolFacade.runWithEncodingAndParams" is called. Inside this method, reflection is used to call another(?) method "runWithEncodingAndParams" (this looks very awkward to me).

Anyway, even if the workflow is run from eclipse (Run As MWE2 Workflow), the following invoke() call throws an NoSuchMethodException. But while in the case of "Run As MWE2 Workflow" a following check on "Charset.defaultCharset().name().equals(explicitEncoding)" evaluates to true, it is false when the workflow is run via Ant. This causes the IllegalStateException ("Explicit encoding was set but is not supported by the available version of the AntlrToolRunner ...") to be thrown only in the case of an Ant-build.

I assume the problem would just go away when I update to a xtext-version with a 2.1.0-jar. This again leads me to the question why I don't get the latest version when I press "check for updates" in eclipse...

/edit:
thanks for the debugger hint... I found out that stuff above just before reading you last reply Smile

[Updated on: Mon, 24 February 2014 11:01]

Report message to a moderator

Re: Running MWE2 Workflow from ANT buildfile causes ANTLR Error [message #1255364 is a reply to message #1255358] Mon, 24 February 2014 11:08 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13637
Registered: July 2009
Senior Member
Cause it is on the itemis update site only cause of IP issues

--
Need training, onsite consulting or any other kind of help for Xtext?
Go visit http://xtext.itemis.com or send a mail to xtext at itemis dot de


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Running MWE2 Workflow from ANT buildfile causes ANTLR Error [message #1255368 is a reply to message #1255364] Mon, 24 February 2014 11:13 Go to previous message
Till F. is currently offline Till F.Friend
Messages: 58
Registered: August 2012
Member
Ah, ok.

I solved the problem differently then:

<jvmarg value="-Dfile.encoding=UTF-8"/>


... for java running org.eclipse.emf.mwe2.launch.runtime.Mwe2Launcher. It works!

[Updated on: Mon, 24 February 2014 11:14]

Report message to a moderator

Previous Topic:Problem related to scope provider
Next Topic:Xtext plugin doesn't work....
Goto Forum:
  


Current Time: Sun Oct 25 00:31:51 GMT 2020

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

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

Back to the top