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 |
|
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 107 times)
|
|
| |
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 |
|
Christian Dietrich wrote on Sun, 24 June 2012 17:32How 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 #891979 is a reply to message #891797] |
Tue, 26 June 2012 18:15 |
|
Christian Dietrich wrote on Mon, 25 June 2012 23:45Strange, 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 |
|
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
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 |
|
Christian Dietrich wrote on Tue, 26 June 2012 15:15Hi,
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 #892349 is a reply to message #892122] |
Wed, 27 June 2012 20:38 |
|
Christian Dietrich wrote on Wed, 27 June 2012 03:23sorry 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.
|
|
| | | | |
Goto Forum:
Current Time: Fri Sep 20 14:55:55 GMT 2024
Powered by FUDForum. Page generated in 0.05192 seconds
|