Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » IllegalStateException when parsing external linked ecore model while generating the Xtext classes(I linked an external ecore model to my Xtext file and get this error when I try to generate my model classes from the Xtext file.)
IllegalStateException when parsing external linked ecore model while generating the Xtext classes [message #891384] Sun, 24 June 2012 21:29 Go to next message
Olaf Bigalk is currently offline Olaf BigalkFriend
Messages: 141
Registered: July 2009
Location: Berlin
Senior Member
Hi All,

I linked an external ecore model to my Xtext file and get this error when I try to generate my model classes from the Xtext file.

I have attached my Xtext file because I can not post it through the forum system


Autocompletion works fine within the Xtext editor for the external classes but generation of the model classes fails with the following exception.

I replaced the : in the stacktrace to prevent the forum system from recognizing them as URL.

Caused by: java.lang.reflect.InvocationTargetException
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.eclipse.emf.mwe2.language.factory.SettingProviderImpl$1$1.setValue(SettingProviderImpl.java:54)
	... 38 more
Caused by: java.lang.IllegalStateException: Problem parsing 'classpath|/org/xtext/example/mydsl/MyDsl.xtext':[XtextLinkingDiagnostic: null:5 Couldn't resolve reference to EPackage 'http|//www.emftext.org/java/classifiers'., XtextLinkingDiagnostic: null:6 Couldn't resolve reference to EPackage 'http|//www.emftext.org/java/types'., XtextLinkingDiagnostic: null:10 Couldn't resolve reference to EClassifier 'ConcreteClassifier'., XtextLinkingDiagnostic: null:19 Couldn't resolve reference to EClassifier 'TypedElement'., TransformationDiagnostic: null:10 Cannot find type for ' [classifiers::ConcreteClassifier]'. (ErrorCode: NoSuchTypeAvailable), TransformationDiagnostic: null:19 Cannot find type for ' [types::TypedElement]'. (ErrorCode: NoSuchTypeAvailable)]
	at org.eclipse.xtext.generator.LanguageConfig.setUri(LanguageConfig.java:131)
	... 43 more


What am I doing wrong?
  • Attachment: MyDsl.xtext
    (Size: 0.45KB, Downloaded 80 times)
Re: IllegalStateException when parsing external linked ecore model while generating the Xtext classe [message #891387 is a reply to message #891384] Sun, 24 June 2012 21:32 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13468
Registered: July 2009
Senior Member
How does your workflow look like? Do you register epackage and
genmodel?


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/xtext/
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: IllegalStateException when parsing external linked ecore model while generating the Xtext classe [message #891783 is a reply to message #891387] Mon, 25 June 2012 22:14 Go to previous messageGo to next message
Olaf Bigalk is currently offline Olaf BigalkFriend
Messages: 141
Registered: July 2009
Location: Berlin
Senior Member
Christian Dietrich wrote on Sun, 24 June 2012 17:32
How does your workflow look like? Do you register epackage and
genmodel?


Thank you for your answer.
I didn't know about that, but when I add those lines to my workflow an other error did apear:

Caused by: java.lang.reflect.InvocationTargetException
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.eclipse.emf.mwe2.language.factory.SettingProviderImpl$1$1.setValue(SettingProviderImpl.java:54)
	... 30 more
Caused by: org.eclipse.emf.ecore.resource.impl.ResourceSetImpl$1DiagnosticWrappedException: java.io.IOException: The path '/org.emftext.language.java/metamodel/java.genmodel' is unmapped
	at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.handleDemandLoadException(ResourceSetImpl.java:315)
	at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.demandLoadHelper(ResourceSetImpl.java:274)
	at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.getResource(ResourceSetImpl.java:397)
	at org.eclipse.emf.mwe.utils.GenModelHelper.registerGenModel(GenModelHelper.java:34)
	at org.eclipse.emf.mwe.utils.StandaloneSetup.addRegisterGenModelFile(StandaloneSetup.java:302)
	... 35 more
Caused by: java.io.IOException: The path '/org.emftext.language.java/metamodel/java.genmodel' is unmapped
	at org.eclipse.emf.ecore.resource.impl.PlatformResourceURIHandlerImpl.createInputStream(PlatformResourceURIHandlerImpl.java:462)
	at org.eclipse.emf.ecore.resource.impl.ExtensibleURIConverterImpl.createInputStream(ExtensibleURIConverterImpl.java:350)
	at org.eclipse.emf.ecore.resource.impl.ResourceImpl.load(ResourceImpl.java:1262)
	at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.demandLoad(ResourceSetImpl.java:255)
	at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.demandLoadHelper(ResourceSetImpl.java:270)
	... 38 more


I attached the workflow file and the jar that contains the ecore model(I removed some class files for size reasons, hoping not removed to much).
Re: IllegalStateException when parsing external linked ecore model while generating the Xtext classe [message #891797 is a reply to message #891783] Tue, 26 June 2012 03:45 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13468
Registered: July 2009
Senior Member
Strange, sure you added the jar to the classpath of the xtext project (as required bundle)?

~Christian


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/xtext/
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: IllegalStateException when parsing external linked ecore model while generating the Xtext classe [message #891979 is a reply to message #891797] Tue, 26 June 2012 18:15 Go to previous messageGo to next message
Olaf Bigalk is currently offline Olaf BigalkFriend
Messages: 141
Registered: July 2009
Location: Berlin
Senior Member
Christian Dietrich wrote on Mon, 25 June 2012 23:45
Strange, sure you added the jar to the classpath of the xtext project (as required bundle)?

~Christian


Yes, here an excerpt from the MANIFEST.MF

Require-Bundle: org.eclipse.xtext;bundle-version="2.0.1";visibility:=reexport,
 org.eclipse.xtext.xbase;bundle-version="2.1.0";resolution:=optional;visibility:=reexport,
 org.apache.log4j;bundle-version="1.2.15";visibility:=reexport,
 org.apache.commons.logging;bundle-version="1.0.4";resolution:=optional;visibility:=reexport,
 org.eclipse.xtext.generator;resolution:=optional,
 org.eclipse.emf.codegen.ecore;resolution:=optional,
 org.eclipse.emf.mwe.utils;resolution:=optional,
 org.eclipse.emf.mwe2.launch;resolution:=optional,
 org.eclipse.xtext.util,
 org.eclipse.emf.ecore,
 org.eclipse.emf.common,
 org.antlr.runtime,
 org.eclipse.xtext.common.types,
 org.emftext.commons.antlr3_4_0;bundle-version="3.4.0",
===================================================
 org.emftext.language.java;bundle-version="1.4.0",
===================================================
 org.emftext.language.java.resource.bcel;bundle-version="1.4.0",
 org.emftext.language.java.resource.java;bundle-version="1.4.0",
 org.emftext.language.java.resource;bundle-version="1.4.0",
 org.eclipse.emf.compare.match;bundle-version="1.2.2",
 org.eclipse.emf.compare;bundle-version="1.2.2",
 org.eclipse.emf.compare.diff;bundle-version="1.2.2",
 net.bigalk.jamopp.utils;bundle-version="1.0.0"


When I use the generated Xtext-editor for my grammar the code completion finds all classes from the referenced ecore model.
Re: IllegalStateException when parsing external linked ecore model while generating the Xtext classe [message #891997 is a reply to message #891979] Tue, 26 June 2012 19:15 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13468
Registered: July 2009
Senior Member
Hi,

still cannot reproduce this

grammar org.xtext.example.mydsl3.MyDsl with org.eclipse.xtext.common.Terminals

generate myDsl "http://www.xtext.org/example/mydsl3/MyDsl"

import "http://www.emftext.org/java/classifiers" as java


Model:
	greetings+=Greeting*;
	
Greeting:
	'Hello' name=ID x=[java::Class]'!';


    bean = StandaloneSetup {
        scanClassPath = true
        platformUri = "${runtimeProject}/.."
        registerGenModelFile = "platform:/resource/org.emftext.language.java/metamodel/java.genmodel"
		// registerGenModelFile = "platform:/resource/org.eclipse.xtext.xbase/model/Xbase.genmodel"
        // registerGenModelFile = "platform:/resource/org.eclipse.xtext.common.types/model/JavaVMTypes.genmodel"
        // registerGeneratedEPackage = "org.eclipse.xtext.xbase.XbasePackage"
        registerGeneratedEPackage = "org.emftext.language.java.classifiers.ClassifiersPackage"
        registerGeneratedEPackage = "org.emftext.language.java.types.TypesPackage"
        // registerGeneratedEPackage = "org.eclipse.xtext.common.types.TypesPackage"
    }


Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: org.xtext.example.mydsl3
Bundle-Vendor: My Company
Bundle-Version: 1.0.0
Bundle-SymbolicName: org.xtext.example.mydsl3; singleton:=true
Bundle-ActivationPolicy: lazy
Require-Bundle: org.eclipse.xtext;bundle-version="2.1.0";visibility:=reexport,
 org.eclipse.xtext.xbase;bundle-version="2.1.0";resolution:=optional;visibility:=reexport,
 org.apache.log4j;bundle-version="1.2.15";visibility:=reexport,
 org.apache.commons.logging;bundle-version="1.0.4";resolution:=optional;visibility:=reexport,
 org.eclipse.xtext.generator;resolution:=optional,
 org.eclipse.emf.codegen.ecore;resolution:=optional,
 org.eclipse.emf.mwe.utils;resolution:=optional,
 org.eclipse.emf.mwe2.launch;resolution:=optional,
 org.emftext.language.java;bundle-version="1.3.0",
 org.eclipse.xtext.util,
 org.eclipse.emf.ecore,
 org.eclipse.emf.common,
 org.antlr.runtime,
 org.eclipse.xtext.common.types
Import-Package: org.apache.log4j,
 org.apache.commons.logging,
 org.eclipse.xtext.xbase.lib,
 org.eclipse.xtend2.lib
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Export-Package: org.xtext.example.mydsl3,
 org.xtext.example.mydsl3.services,
 org.xtext.example.mydsl3.myDsl,
 org.xtext.example.mydsl3.myDsl.impl,
 org.xtext.example.mydsl3.myDsl.util,
 org.xtext.example.mydsl3.serializer,
 org.xtext.example.mydsl3.parser.antlr,
 org.xtext.example.mydsl3.parser.antlr.internal,
 org.xtext.example.mydsl3.validation,
 org.xtext.example.mydsl3.scoping,
 org.xtext.example.mydsl3.generator,
 org.xtext.example.mydsl3.formatting


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/xtext/
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: IllegalStateException when parsing external linked ecore model while generating the Xtext classe [message #892029 is a reply to message #891997] Tue, 26 June 2012 21:53 Go to previous messageGo to next message
Olaf Bigalk is currently offline Olaf BigalkFriend
Messages: 141
Registered: July 2009
Location: Berlin
Senior Member
Christian Dietrich wrote on Tue, 26 June 2012 15:15
Hi,

still cannot reproduce this


Yes I checked the bundles list and the package registration and I cannot reproduce the error either. But I can produce a new error. This error occurs only if
an external model is actually referenced. The error does not occur if the external model is only declared (import, registration) but no actual reference is used in the Xtext file.
If you comment out the line 12 from the Xtext file the error disappears.

Best Regards
Olaf
Re: IllegalStateException when parsing external linked ecore model while generating the Xtext classe [message #892122 is a reply to message #892029] Wed, 27 June 2012 07:23 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13468
Registered: July 2009
Senior Member
sorry still cannot reproduce.

Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/xtext/
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: IllegalStateException when parsing external linked ecore model while generating the Xtext classe [message #892349 is a reply to message #892122] Wed, 27 June 2012 20:38 Go to previous messageGo to next message
Olaf Bigalk is currently offline Olaf BigalkFriend
Messages: 141
Registered: July 2009
Location: Berlin
Senior Member
Christian Dietrich wrote on Wed, 27 June 2012 03:23
sorry still cannot reproduce.


I tried again:

1. created a new example project.
2. added the reference to the ecore model to the grammar file.
3. added the jar dependency to the MANIFEST.MF
4. added a reference to an ecore model object in the grammar file.
5. added the registration of EPackage and model to the workflow file.
6. run the generator workflow.
7. got this strange NullPointerException

I zipped the whole project, hoping you can reproduce with that.
Thank you for helping me.
Re: IllegalStateException when parsing external linked ecore model while generating the Xtext classe [message #892359 is a reply to message #892349] Wed, 27 June 2012 21:23 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13468
Registered: July 2009
Senior Member
Hmm,

seems it has something to do with you using emftext 1.4 i am using 1.3

~Christian


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/xtext/
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: IllegalStateException when parsing external linked ecore model while generating the Xtext classe [message #892361 is a reply to message #892359] Wed, 27 June 2012 21:37 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13468
Registered: July 2009
Senior Member
P.S: where do i get org.emftext.language.java in version 1.4 from?

Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/xtext/
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: IllegalStateException when parsing external linked ecore model while generating the Xtext classe [message #892366 is a reply to message #892122] Wed, 27 June 2012 22:23 Go to previous messageGo to next message
Olaf Bigalk is currently offline Olaf BigalkFriend
Messages: 141
Registered: July 2009
Location: Berlin
Senior Member
Christian Dietrich wrote on Wed, 27 June 2012 03:23
sorry still cannot reproduce.


Hi Christian,

it seems to be an indigo problem. In the todays Juno release I cannot reproduce the error. I will move on to Juno.
Re: IllegalStateException when parsing external linked ecore model while generating the Xtext classe [message #892525 is a reply to message #892361] Thu, 28 June 2012 14:29 Go to previous message
Olaf Bigalk is currently offline Olaf BigalkFriend
Messages: 141
Registered: July 2009
Location: Berlin
Senior Member
Christian Dietrich wrote on Wed, 27 June 2012 17:37
P.S: where do i get org.emftext.language.java in version 1.4 from?


I used the following update-site:
http[colon]//www.emftext.org/update_trunk
Previous Topic:How to disable project nature notification
Next Topic:Eclipse Marketplace contains old version
Goto Forum:
  


Current Time: Sat May 30 10:00:07 GMT 2020

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

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

Back to the top