Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » <language>.xtextbin not found
<language>.xtextbin not found [message #1066232] Mon, 01 July 2013 15:40 Go to next message
Henrik Rentz-Reichert is currently offline Henrik Rentz-ReichertFriend
Messages: 261
Registered: July 2009
Senior Member
Hi all,

I'm observing a really strange behavior.

The eTrice project uses Xtext 2.4.0 for quite a while now.
Today I switched to Xtext 2.4.2.

eTrice has code generators that read (Xtext) model files and generate code.
All that still works fine with Xtext 2.4.2.

There is only a problem I observe in a unit test where we invoke the generator from an Ant script (s.b.).
It seems that all classes can be loaded.
Only the new <language>.xtextbin files can not be found even though they are obviously there.
(I have seen that the first try of org.eclipse.xtext.service.GrammarProvider.getGrammar(Object) is to load <language>.xtextbin
(which is there in my case) and the second try is <language>.xmi (which doesn't exist after I generated with Xtext 2.4.2).)

I assume this is some kind of class loader issue but I can't figure out how to resolve it.

Does anybody else observe this issue?

Thanks,
Henrik

---------------------------------------------------------------------

The relevant part from the Ant script:

<target name="generate" depends="set_tp,copy_models">
<mkdir dir="${output}"/>
<path id="clspath">
<pathelement location="../../plugins/org.eclipse.etrice.generator.java/bin"/>
<pathelement location="../../plugins/org.eclipse.etrice.generator.config/bin"/>
<pathelement location="../../plugins/org.eclipse.etrice.generator.doc/bin"/>
<pathelement location="../../plugins/org.eclipse.etrice.generator/bin"/>
<pathelement location="../../plugins/org.eclipse.etrice.generator.config/bin"/>
<pathelement location="../../plugins/org.eclipse.etrice.core.room/bin"/>
<pathelement location="../../plugins/org.eclipse.etrice.core.etphys/bin"/>
<pathelement location="../../plugins/org.eclipse.etrice.core.etmap/bin"/>
<pathelement location="../../plugins/org.eclipse.etrice.core.config/bin"/>
<pathelement location="../../plugins/org.eclipse.etrice.core.genmodel/bin"/>
<fileset dir="${target.platform}/plugins/">
<include name="org.eclipse.emf.ecore_2.9*.jar" />
<include name="org.eclipse.emf.common_2.9*.jar" />
<include name="org.eclipse.emf.ecore.xmi_2.9*.jar" />
<include name="org.eclipse.xtext_2.*.jar" />
<include name="com.google.inject_*.jar" />
<include name="com.google.guava_10.*.jar" />
<include name="org.eclipse.equinox.common_3.6.*.jar" />
<include name="org.eclipse.xtext.util_2.*.jar" />
<include name="org.eclipse.xtend.lib_2.*.jar" />
<include name="org.eclipse.xtext.xbase.lib_2.*.jar" />
<include name="org.apache.log4j_1.2*.jar" />
<include name="org.antlr.runtime_3.2*.jar" />
<include name="javax.inject_1.0*.jar" />
</fileset>
</path>

<java output="${output}/generate.txt" error="${output}/generate_err.txt" classname="org.eclipse.etrice.generator.java.Main"
fork="true" failonerror="true">
<arg value="${java.tests.model.path}/generator.java.tests.config"/>
<arg value="${java.tests.model.path}/generator.java.tests.etmap"/>
<classpath refid="clspath"/>
</java>
</target>

---------------------------------------------------------------------

Output on generator invocation and exception thrown:

Info: -- reading models
Info: added model ./models/generator.java.tests.config
Info: added model ./models/generator.java.tests.etmap
Info: Loading
file:/C:/Users/hrentz/git/kepler/org.eclipse.etrice/tests/org.eclipse.etrice.generator.java.tests/models/generator.java.tests.etmap
Error: Guice provision errors:

1) Error injecting constructor, org.eclipse.emf.common.util.WrappedException:
org.eclipse.xtext.resource.ClasspathUriResolutionException: java.lang.IllegalStateException: Couldn't find resource on classpath.
URI was 'classpath:/org/eclipse/etrice/core/etmap/ETMap.xmi'
at org.eclipse.xtext.common.services.TerminalsGrammarAccess.<init>(Unknown Source)
at org.eclipse.xtext.common.services.TerminalsGrammarAccess.class(Unknown Source)
while locating org.eclipse.xtext.common.services.TerminalsGrammarAccess
for parameter 1 at org.eclipse.etrice.core.etmap.services.ETMapGrammarAccess.<init>(Unknown Source)
at org.eclipse.etrice.core.etmap.services.ETMapGrammarAccess.class(Unknown Source)
while locating org.eclipse.etrice.core.etmap.services.ETMapGrammarAccess
while locating org.eclipse.xtext.IGrammarAccess
for field at org.eclipse.xtext.linking.lazy.LazyLinker.grammarAccess(Unknown Source)
while locating org.eclipse.xtext.linking.lazy.LazyLinker
while locating org.eclipse.xtext.linking.ILinker
for field at org.eclipse.xtext.resource.XtextResource.linker(Unknown Source)
while locating org.eclipse.xtext.linking.lazy.LazyLinkingResource
while locating org.eclipse.xtext.resource.XtextResource
Caused by: org.eclipse.emf.common.util.WrappedException: org.eclipse.xtext.resource.ClasspathUriResolutionException:
java.lang.IllegalStateException: Couldn't find resource on classpath. URI was 'classpath:/org/eclipse/etrice/core/etmap/ETMap.xmi'
at org.eclipse.xtext.parser.BaseEPackageAccess.loadResource(BaseEPackageAccess.java:57)
Re: &lt;language&gt;.xtextbin not found [message #1066239 is a reply to message #1066232] Mon, 01 July 2013 16:11 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14675
Registered: July 2009
Senior Member
Hi,

did you update oder a fresh install,


maybe the old classes are on classpath as well


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: &amp;lt;language&amp;gt;.xtextbin not found [message #1066243 is a reply to message #1066239] Mon, 01 July 2013 17:04 Go to previous messageGo to next message
Henrik Rentz-Reichert is currently offline Henrik Rentz-ReichertFriend
Messages: 261
Registered: July 2009
Senior Member
its a fresh install. I've started with a Kepler modeling package and I've double checked:
there are only Xtext 2.4.2 plug-ins on the class path.

When I launch the generator as Java Application in Eclipse it works.
It fails when I use the Ant script.


Am 01.07.2013 18:11, schrieb Christian Dietrich:
> Hi,
>
> did you update oder a fresh install,
>
>
> maybe the old classes are on classpath as well
Re: &amp;lt;language&amp;gt;.xtextbin not found [message #1066258 is a reply to message #1066243] Mon, 01 July 2013 18:02 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14675
Registered: July 2009
Senior Member
Hmmmm strange,

you may have a look at org.eclipse.xtext.service.GrammarProvider.getGrammar(Object)
for further investigation.

are you sure the xtextbin file goes to the bin directory?


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de

[Updated on: Mon, 01 July 2013 18:58]

Report message to a moderator

Re: &amp;lt;language&amp;gt;.xtextbin not found [message #1066262 is a reply to message #1066258] Mon, 01 July 2013 18:46 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14675
Registered: July 2009
Senior Member
Hi,

i just gave it a try and it worked out of thr box
<project default="test">

	
	<path id="clspath">
	<pathelement location="../org.xtext.example.mydsl/bin"/>
	<pathelement location="bin"/>
	<fileset dir="/Users/dietrich/Downloads/eclipse 2/plugins/">
	<include name="org.eclipse.emf.ecore_2.9*.jar" />
	<include name="org.eclipse.emf.common_2.9*.jar" />
	<include name="org.eclipse.emf.ecore.xmi_2.9*.jar" />
	<include name="org.eclipse.xtext_2.4.2*.jar" />
	<include name="com.google.inject_*.jar" />
	<include name="com.google.guava_10.*.jar" />
	<include name="org.eclipse.equinox.common_3.6.*.jar" />
	<include name="org.eclipse.xtext.util_2.4.2*.jar" />
	<include name="org.eclipse.xtend.lib_2.4.2*.jar" />
	<include name="org.eclipse.xtext.common.types_2.4.2*.jar" />
	<include name="org.eclipse.xtext.xbase.lib_2.4.2*.jar" />
	<include name="org.apache.log4j_1.2*.jar" />
	<include name="org.antlr.runtime_3.2*.jar" />
	<include name="javax.inject_1.0*.jar" />
	</fileset>
	</path>
	
	<target name="test">
		<java classname="org.xtext.example.mydsl.tests.DummyTest" classpathref="clspath">
		
		</java>
	
	</target>
	
</project>


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: &amp;amp;lt;language&amp;amp;gt;.xtextbin not found [message #1066307 is a reply to message #1066262] Tue, 02 July 2013 06:33 Go to previous messageGo to next message
Henrik Rentz-Reichert is currently offline Henrik Rentz-ReichertFriend
Messages: 261
Registered: July 2009
Senior Member
Hi Christian,

I narrowed down the o.e.x version to 2.4.2 as you did below (I required only 2.*).
And it turned out that my platform path still pointed to a Juno installation :-/

Now it works just fine as before.

Thanks for your help,
Henrik

Am 01.07.2013 20:46, schrieb Christian Dietrich:
> Hi,
>
> i just gave it a try and it worked out of thr box
> <project default="test">
>
>
> <path id="clspath">
> <pathelement location="../org.xtext.example.mydsl/bin"/>
> <pathelement location="bin"/>
> <fileset dir="/Users/dietrich/Downloads/eclipse 2/plugins/">
> <include name="org.eclipse.emf.ecore_2.9*.jar" />
> <include name="org.eclipse.emf.common_2.9*.jar" />
> <include name="org.eclipse.emf.ecore.xmi_2.9*.jar" />
> <include name="org.eclipse.xtext_2.4.2*.jar" />
> <include name="com.google.inject_*.jar" />
> <include name="com.google.guava_10.*.jar" />
> <include name="org.eclipse.equinox.common_3.6.*.jar" />
> <include name="org.eclipse.xtext.util_2.4.2*.jar" />
> <include name="org.eclipse.xtend.lib_2.4.2*.jar" />
> <include name="org.eclipse.xtext.common.types_2.4.2*.jar" />
> <include name="org.eclipse.xtext.xbase.lib_2.4.2*.jar" />
> <include name="org.apache.log4j_1.2*.jar" />
> <include name="org.antlr.runtime_3.2*.jar" />
> <include name="javax.inject_1.0*.jar" />
> </fileset>
> </path>
>
> <target name="test">
> <java classname="org.xtext.example.mydsl.tests.DummyTest" classpathref="clspath">
>
> </java>
>
> </target>
>
> </project>
Re: &amp;amp;lt;language&amp;amp;gt;.xtextbin not found [message #1068332 is a reply to message #1066307] Sat, 13 July 2013 01:17 Go to previous messageGo to next message
Stephan Herrmann is currently offline Stephan HerrmannFriend
Messages: 1853
Registered: July 2009
Senior Member
I just spent a couple of hours chasing down a variant of this problem:

In my development IDE I use Xtext 2.4.2 and I want to deploy the DSL plugin into an IDE using the same Xtext version. Only, the application that uses the DSL's generator cannot yet depend on Xtext 2.4.2 in its maven build (because our nexus doesn't yet provide this version, and because application dependencies always evolve more slowly than tool versions - in fact the application build still refers to Xtext 2.3, which should be OK since the generator shouldn't depend on any newer features).

Result: the DSL was generated into the new MyDSL.xtextbin and the invocation of the generator failed because it could not load the MyDSL.xmi.

Question: what's the recommended way of using Xtext 2.4.2 for creating a generator that can run on earlier versions of Xtext? Is there a way to tell Xtext 2.4.2 to generate the "old" MyDSL.xmi file?

thanks,
Stephan
Re: &amp;amp;lt;language&amp;amp;gt;.xtextbin not found [message #1068428 is a reply to message #1068332] Sat, 13 July 2013 08:40 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14675
Registered: July 2009
Senior Member
Hi,

did you try to force the xml to be created?
    		fragment = grammarAccess.GrammarAccessFragment auto-inject {
    			xmlVersion = "1.0"
    		}


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: &amp;amp;amp;lt;language&amp;amp;amp;gt;.xtextbin not found [message #1068438 is a reply to message #1068428] Sat, 13 July 2013 09:14 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

It would be nice if the GrammarAccessFragment.setXmlVersion method had a
comment explaining the role of the setting.

Intuition would suggest that it was a way to specify the XML version as
1.1 rather than 1.0. Who would want to do that?

Regards

Ed Willink


On 13/07/2013 09:40, Christian Dietrich wrote:
> Hi,
>
> did you try to force the xml to be created?
> fragment = grammarAccess.GrammarAccessFragment auto-inject {
> xmlVersion = "1.0"
> }
Re: &amp;amp;amp;lt;language&amp;amp;amp;gt;.xtextbin not found [message #1068440 is a reply to message #1068438] Sat, 13 July 2013 09:19 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14675
Registered: July 2009
Senior Member
Right, but i am a code reader only as you are ;D

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: &amp;amp;amp;lt;language&amp;amp;amp;gt;.xtextbin not found [message #1068488 is a reply to message #1068440] Sat, 13 July 2013 12:43 Go to previous messageGo to next message
Stephan Herrmann is currently offline Stephan HerrmannFriend
Messages: 1853
Registered: July 2009
Senior Member
Thanks Christian, I will try this first thing on Monday.

Dude, you must be reading that code a lot. It seems like I could have benefited from a migration guide for 2.4.2, as suggested in another thread. Never thought that updating to a service release would require such...

thanks,
Stephan
Re: &amp;amp;amp;lt;language&amp;amp;amp;gt;.xtextbin not found [message #1069175 is a reply to message #1068488] Mon, 15 July 2013 10:34 Go to previous message
Stephan Herrmann is currently offline Stephan HerrmannFriend
Messages: 1853
Registered: July 2009
Senior Member
For posterity: yes, specifying xmlVersion did help in my case, as it ensures that .xmi is used, no matter which Xtext version is used. And: it needn't be "1.0", setting the version to "1.1" achieves the same result Smile

cheers,
Stephan
Previous Topic:Rule for enclosing a value in apostrophes
Next Topic:about C macro
Goto Forum:
  


Current Time: Sat May 04 05:50:18 GMT 2024

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

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

Back to the top