Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Xtext artifact generation from Ecore model fails when Ecore model refers to another model.
Xtext artifact generation from Ecore model fails when Ecore model refers to another model. [message #1272807] Tue, 18 March 2014 20:50 Go to next message
Ernesto Posse is currently offline Ernesto PosseFriend
Messages: 438
Registered: March 2011
Senior Member
Hi. I'm trying to create an Xtext project from an Ecore model which itself references another Ecore model, but when I try to generate the Xtext artifacts, it fails with the following exception (on a minimalistic example, see attached ZIP file):

0    [main] INFO  lipse.emf.mwe.utils.StandaloneSetup  - Registering platform uri '/Users/eposse/Local/Workspace'
68   [main] ERROR mf.mwe2.launch.runtime.Mwe2Launcher  - Problems instantiating module c.LangC: java.lang.reflect.InvocationTargetException
java.lang.RuntimeException: Problems instantiating module c.LangC: java.lang.reflect.InvocationTargetException
	at org.eclipse.emf.mwe2.launch.runtime.Mwe2Runner.run(Mwe2Runner.java:95)
	at org.eclipse.emf.mwe2.launch.runtime.Mwe2Runner.run(Mwe2Runner.java:62)
	at org.eclipse.emf.mwe2.launch.runtime.Mwe2Runner.run(Mwe2Runner.java:52)
	at org.eclipse.emf.mwe2.launch.runtime.Mwe2Launcher.run(Mwe2Launcher.java:74)
	at org.eclipse.emf.mwe2.launch.runtime.Mwe2Launcher.main(Mwe2Launcher.java:35)
Caused by: org.eclipse.emf.common.util.WrappedException: java.lang.reflect.InvocationTargetException
	at org.eclipse.emf.mwe2.language.factory.SettingProviderImpl$1$1.setValue(SettingProviderImpl.java:56)
	at org.eclipse.emf.mwe2.language.factory.Mwe2ExecutionEngine.internalApplyAssignments(Mwe2ExecutionEngine.java:143)
	at org.eclipse.emf.mwe2.language.factory.Mwe2ExecutionEngine.inCase(Mwe2ExecutionEngine.java:114)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:606)
	at org.eclipse.xtext.util.PolymorphicDispatcher.invoke(PolymorphicDispatcher.java:291)
	at org.eclipse.emf.mwe2.language.factory.Mwe2ExecutionEngine.internalSwitch(Mwe2ExecutionEngine.java:66)
	at org.eclipse.emf.mwe2.language.factory.Mwe2ExecutionEngine.internalApplyAssignments(Mwe2ExecutionEngine.java:142)
	at org.eclipse.emf.mwe2.language.factory.Mwe2ExecutionEngine.inCase(Mwe2ExecutionEngine.java:114)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:606)
	at org.eclipse.xtext.util.PolymorphicDispatcher.invoke(PolymorphicDispatcher.java:291)
	at org.eclipse.emf.mwe2.language.factory.Mwe2ExecutionEngine.internalSwitch(Mwe2ExecutionEngine.java:66)
	at org.eclipse.emf.mwe2.language.factory.Mwe2ExecutionEngine.inCase(Mwe2ExecutionEngine.java:80)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:606)
	at org.eclipse.xtext.util.PolymorphicDispatcher.invoke(PolymorphicDispatcher.java:291)
	at org.eclipse.emf.mwe2.language.factory.Mwe2ExecutionEngine.internalSwitch(Mwe2ExecutionEngine.java:66)
	at org.eclipse.emf.mwe2.language.factory.Mwe2ExecutionEngine.create(Mwe2ExecutionEngine.java:62)
	at org.eclipse.emf.mwe2.launch.runtime.Mwe2Runner.run(Mwe2Runner.java:93)
	... 4 more
Caused by: java.lang.reflect.InvocationTargetException
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:606)
	at org.eclipse.emf.mwe2.language.factory.SettingProviderImpl$1$1.setValue(SettingProviderImpl.java:54)
	... 29 more
Caused by: org.eclipse.emf.mwe.core.ConfigurationException: Couldn't find an interface b.BPackage
	at org.eclipse.emf.mwe.utils.StandaloneSetup.addRegisterGeneratedEPackage(StandaloneSetup.java:414)
	... 34 more


The minimalistic example contains three projects: a, b and c.

The first (a) contains a single package with a single class A.

The second (b) contains a single package with a class B that inherits from A. I linked a.A via "Right-click -> Load Resource...".

The third (c) contains the Xtext project, created with "New... -> Xtext project from existing Ecore model". The grammar seems mosly correct, except for the line

import "http://b/1.0" 


which causes error. When I replace it with

import "platform:/resource/b/model/b.ecore" 


the errors go away and I get only a warning that the imported package is not in the classpath. Is that what is causing the exception above? If so, how do I add the package to the classpath, or how can I import it otherwise? If it is not the cause, what is, and what could be done?

Thanks.

PS: I'm using Eclipse Kepler SR2 with Modeling Tools, Xtext 2.5.3 and no other plugins on Mac OS X 10.9.
Re: Xtext artifact generation from Ecore model fails when Ecore model refers to another model. [message #1272816 is a reply to message #1272807] Tue, 18 March 2014 21:08 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Hi,

sorry i cannot reproduce

import "http://b/1.0" works fine if you add the xtext nature to the b project (configure -> add xtext nature)
the existing import works fine too.

(1) use a.genmodel and b.genmodel to generate model code
(2) run the workflow

everything works fine.


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Xtext artifact generation from Ecore model fails when Ecore mdl refers to another mdl. [SOLVED] [message #1272820 is a reply to message #1272816] Tue, 18 March 2014 21:18 Go to previous message
Ernesto Posse is currently offline Ernesto PosseFriend
Messages: 438
Registered: March 2011
Senior Member
Thanks! I realised I had not generated the code from the Ecore models for neither a nor b. After generating the code for them it works. So I'm marking it as solved.
Previous Topic:Cross reference to data type
Next Topic:Error when running mwe2 on xcore-based xtext project
Goto Forum:
  


Current Time: Thu Apr 25 13:24:25 GMT 2024

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

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

Back to the top