Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Mwe2Launcher
Mwe2Launcher [message #543463] Tue, 29 June 2010 14:01 Go to next message
Rubén Porras Campo is currently offline Rubén Porras CampoFriend
Messages: 67
Registered: July 2009
Member
Hi,

i have problems running the standalone setup of a XTEXT grammar with an MWE2 file. I use the Mwe2Launcher.main to launch it. The MWE2 file is

module btt

import org.eclipse.emf.mwe.utils.*

var fileEncoding = "UTF-8"
var modelDir
var targetDir

Workflow {
	bean = StandaloneSetup {
	  platformUri = ".."
	  registerGeneratedEPackage = "com.foo.bttg.meta_model.btc.btc.BtcPackage"
	  registerGeneratedEPackage = "com.foo.bttg.meta_model.btpt.btpt.BtptPackage"
	}
	
	component = org.eclipse.xtext.mwe.Reader {
	    path = modelDir
	        register = com.foo.bttg.meta_model.btc.BTCStandaloneSetup {}
		register = com.foo.bttg.meta_model.btpt.BTPTStandaloneSetup {}
		register = com.foo.bttg.meta_model.btt.BTTStandaloneSetup {}
		register = com.foo.bttg.meta_model.mtd.MTDStandaloneSetup {}

	    load = {
			slot = "model"
			type = "BusinessTrxType"
		}
	}
	component = org.eclipse.xpand2.Generator {
		metaModel = org.eclipse.xtend.typesystem.emf.EmfRegistryMetaModel {}
		expand = "com::foo::bttg::generator::abs::btt::Main::main FOREACH model"
		outlet = {
			path = targetDir
		}		
		fileEncoding = fileEncoding
	}
	
}


The error message is

Quote:

Mwe2Launcher - [XtextLinkingDiagnostic: null:18 Couldn't resolve reference to JvmType 'com.foo.bttg.meta_model.btc.BTCStandaloneSetup'.]
java.lang.IllegalStateException: [XtextLinkingDiagnostic: null:18 Couldn't resolve reference to JvmType 'com.foo.bttg.meta_model.btc.BTCStandaloneSetup'.]
at org.eclipse.emf.mwe2.launch.runtime.Mwe2Runner.run(Mwe2Runne r.java:66)
at org.eclipse.emf.mwe2.launch.runtime.Mwe2Launcher.run(Mwe2Lau ncher.java:76)
at org.eclipse.emf.mwe2.launch.runtime.Mwe2Launcher.main(Mwe2La uncher.java:35)
at com.foo.bttg.Activator.run(Activator.java:85)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.foo.bttg.generator_service.BttGenerator.performGeneratio n(BttGenerator.java:149)
at com.foo.bttg.generator_service.BttGenerator.run(BttGenerator .java:128)
at com.foo.bttg.generator_service.BttGenerationApp.main(BttGene rationApp.java:90)



The same errors are given for the other StandaloneSetups registered for mwe.Reader.

A similar MWE2 file works fine within eclipse to generate some files for the model.

To me it seems like a classpath problem. But I don't know where the problem is, since the Activator.java calling the Mwe2Launcher.main() and the registered StandaloneSetups are in the same jar file, and the jar file has the MANIFEST file that follows.

Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: com.foo.bttg
Bundle-Vendor: Foo Evolution AG
Bundle-Version: 2.0.0
Bundle-SymbolicName: com.foo.bttg;singleton:=true
Eclipse-RegisterBuddy: org.eclipse.xtext.log4j
Bundle-ActivationPolicy: lazy
Require-Bundle: org.eclipse.xtext,
 org.eclipse.xtext.util,
 org.eclipse.emf.ecore,
 org.eclipse.emf.common,
 org.antlr.runtime,
 org.apache.log4j;bundle-version="1.2.15",
 org.eclipse.xtend,
 org.eclipse.emf.mwe2.launch;bundle-version="1.0.0",
 org.junit;bundle-version="4.8.1",
 org.eclipse.xtend.util.stdlib;bundle-version="1.0.0",
 org.apache.ant;bundle-version="1.7.1",
 org.eclipse.xtext.generator;bundle-version="1.0.0",
 org.apache.commons.logging;bundle-version="1.1.1",
 org.eclipse.xtext.xtend;bundle-version="1.0.0"
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Export-Package: com.foo.bttg.meta_model.btc,
 com.foo.bttg.meta_model.btc.btc,
 com.foo.bttg.meta_model.btc.btc.impl,
 com.foo.bttg.meta_model.btc.btc.util,
 com.foo.bttg.meta_model.btc.parseTreeConstruction,
 com.foo.bttg.meta_model.btc.parser.antlr,
 com.foo.bttg.meta_model.btc.parser.antlr.internal,
 com.foo.bttg.meta_model.btc.services,
 com.foo.bttg.meta_model.btc.validation,
 com.foo.bttg.meta_model.btpt,
 com.foo.bttg.meta_model.btpt.btpt,
 com.foo.bttg.meta_model.btpt.btpt.impl,
 com.foo.bttg.meta_model.btpt.btpt.util,
 com.foo.bttg.meta_model.btpt.parseTreeConstruction,
 com.foo.bttg.meta_model.btpt.parser.antlr,
 com.foo.bttg.meta_model.btpt.parser.antlr.internal,
 com.foo.bttg.meta_model.btpt.services,
 com.foo.bttg.meta_model.btpt.validation,
 com.foo.bttg.meta_model.btt,
 com.foo.bttg.meta_model.btt.btt,
 com.foo.bttg.meta_model.mtd,
 com.foo.bttg.meta_model.mtd.mtd,
 com.foo.bttg.meta_model.mtd.mtd.impl,
 com.foo.bttg.meta_model.mtd.mtd.util,
 com.foo.bttg.meta_model.mtd.parseTreeConstruction,
 com.foo.bttg.meta_model.mtd.parser.antlr,
 com.foo.bttg.meta_model.mtd.parser.antlr.internal,
 com.foo.bttg.meta_model.mtd.services,
 com.foo.bttg.meta_model.mtd.validation
Import-Package: org.apache.log4j
Bundle-ClassPath: src/,.


Could anyone help me?

Thanks!
Re: Mwe2Launcher [message #543526 is a reply to message #543463] Tue, 29 June 2010 16:42 Go to previous messageGo to next message
Sven Efftinge is currently offline Sven EfftingeFriend
Messages: 1823
Registered: July 2009
Senior Member
It is a known shortcoming (bug) in the current MWE2Launcher that running
it from within OSGi is not working.

Thr problem is the code in
org.eclipse.xtext.mwe.RuntimeResourceSetInitializer :

public List<String> getClassPathEntries() {
List<String> pathes = Lists.newArrayList();
String classPath = System.getProperty("java.class.path");
String separator = System.getProperty("path.separator");
String[] strings = classPath.split(separator);
for (String path : strings) {
pathes.add(path);
}
return pathes;
}

which uses the system property 'java.class.path' to determine the list
of classpath entries. You could override it and bind your own
implementation to RuntimeResourcesetInitializer. You should also use
Mwe2Runner instead of Mwe2Launcher, which is intended to be used from
command line.
We will fix this for the SR1 release (to be released in a couple of weeks).

In the meantime you could still use the old workflow engine in an OSGi
context.

Sorry,
Sven

Ruben schrieb:
> Hi,
>
> i have problems running the standalone setup of a XTEXT grammar with an
> MWE2 file. I use the Mwe2Launcher.main to launch it. The MWE2 file is
>
> module btt
>
> import org.eclipse.emf.mwe.utils.*
>
> var fileEncoding = "UTF-8"
> var modelDir
> var targetDir
>
> Workflow {
> bean = StandaloneSetup {
> platformUri = ".."
> registerGeneratedEPackage =
> "com.foo.bttg.meta_model.btc.btc.BtcPackage"
> registerGeneratedEPackage =
> "com.foo.bttg.meta_model.btpt.btpt.BtptPackage"
> }
>
> component = org.eclipse.xtext.mwe.Reader {
> path = modelDir
> register = com.foo.bttg.meta_model.btc.BTCStandaloneSetup {}
> register = com.foo.bttg.meta_model.btpt.BTPTStandaloneSetup {}
> register = com.foo.bttg.meta_model.btt.BTTStandaloneSetup {}
> register = com.foo.bttg.meta_model.mtd.MTDStandaloneSetup {}
>
> load = {
> slot = "model"
> type = "BusinessTrxType"
> }
> }
> component = org.eclipse.xpand2.Generator {
> metaModel =
> org.eclipse.xtend.typesystem.emf.EmfRegistryMetaModel {}
> expand = "com::foo::bttg::generator::abs::btt::Main::main
> FOREACH model"
> outlet = {
> path = targetDir
> }
> fileEncoding = fileEncoding
> }
>
> }
>
>
> The error message is
>
> Quote:
>> Mwe2Launcher - [XtextLinkingDiagnostic: null:18 Couldn't resolve
>> reference to JvmType 'com.foo.bttg.meta_model.btc.BTCStandaloneSetup'.]
>> java.lang.IllegalStateException: [XtextLinkingDiagnostic: null:18
>> Couldn't resolve reference to JvmType
>> 'com.foo.bttg.meta_model.btc.BTCStandaloneSetup'.]
>> at org.eclipse.emf.mwe2.launch.runtime.Mwe2Runner.run(Mwe2Runne
>> r.java:66)
>> at org.eclipse.emf.mwe2.launch.runtime.Mwe2Launcher.run(Mwe2Lau
>> ncher.java:76)
>> at org.eclipse.emf.mwe2.launch.runtime.Mwe2Launcher.main(Mwe2La
>> uncher.java:35)
>> at com.foo.bttg.Activator.run(Activator.java:85)
>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>> at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
>> at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
>> at java.lang.reflect.Method.invoke(Unknown Source)
>> at com.foo.bttg.generator_service.BttGenerator.performGeneratio
>> n(BttGenerator.java:149)
>> at com.foo.bttg.generator_service.BttGenerator.run(BttGenerator
>> .java:128)
>> at com.foo.bttg.generator_service.BttGenerationApp.main(BttGene
>> rationApp.java:90)
>
>
> The same errors are given for the other StandaloneSetups registered for
> mwe.Reader.
>
> A similar MWE2 file works fine within eclipse to generate some files for
> the model.
>
> To me it seems like a classpath problem. But I don't know where the
> problem is, since the Activator.java calling the Mwe2Launcher.main() and
> the registered StandaloneSetups are in the same jar file, and the jar
> file has the MANIFEST file that follows.
>
> Manifest-Version: 1.0
> Bundle-ManifestVersion: 2
> Bundle-Name: com.foo.bttg
> Bundle-Vendor: Foo Evolution AG
> Bundle-Version: 2.0.0
> Bundle-SymbolicName: com.foo.bttg;singleton:=true
> Eclipse-RegisterBuddy: org.eclipse.xtext.log4j
> Bundle-ActivationPolicy: lazy
> Require-Bundle: org.eclipse.xtext,
> org.eclipse.xtext.util,
> org.eclipse.emf.ecore,
> org.eclipse.emf.common,
> org.antlr.runtime,
> org.apache.log4j;bundle-version="1.2.15",
> org.eclipse.xtend,
> org.eclipse.emf.mwe2.launch;bundle-version="1.0.0",
> org.junit;bundle-version="4.8.1",
> org.eclipse.xtend.util.stdlib;bundle-version="1.0.0",
> org.apache.ant;bundle-version="1.7.1",
> org.eclipse.xtext.generator;bundle-version="1.0.0",
> org.apache.commons.logging;bundle-version="1.1.1",
> org.eclipse.xtext.xtend;bundle-version="1.0.0"
> Bundle-RequiredExecutionEnvironment: JavaSE-1.6
> Export-Package: com.foo.bttg.meta_model.btc,
> com.foo.bttg.meta_model.btc.btc,
> com.foo.bttg.meta_model.btc.btc.impl,
> com.foo.bttg.meta_model.btc.btc.util,
> com.foo.bttg.meta_model.btc.parseTreeConstruction,
> com.foo.bttg.meta_model.btc.parser.antlr,
> com.foo.bttg.meta_model.btc.parser.antlr.internal,
> com.foo.bttg.meta_model.btc.services,
> com.foo.bttg.meta_model.btc.validation,
> com.foo.bttg.meta_model.btpt,
> com.foo.bttg.meta_model.btpt.btpt,
> com.foo.bttg.meta_model.btpt.btpt.impl,
> com.foo.bttg.meta_model.btpt.btpt.util,
> com.foo.bttg.meta_model.btpt.parseTreeConstruction,
> com.foo.bttg.meta_model.btpt.parser.antlr,
> com.foo.bttg.meta_model.btpt.parser.antlr.internal,
> com.foo.bttg.meta_model.btpt.services,
> com.foo.bttg.meta_model.btpt.validation,
> com.foo.bttg.meta_model.btt,
> com.foo.bttg.meta_model.btt.btt,
> com.foo.bttg.meta_model.mtd,
> com.foo.bttg.meta_model.mtd.mtd,
> com.foo.bttg.meta_model.mtd.mtd.impl,
> com.foo.bttg.meta_model.mtd.mtd.util,
> com.foo.bttg.meta_model.mtd.parseTreeConstruction,
> com.foo.bttg.meta_model.mtd.parser.antlr,
> com.foo.bttg.meta_model.mtd.parser.antlr.internal,
> com.foo.bttg.meta_model.mtd.services,
> com.foo.bttg.meta_model.mtd.validation
> Import-Package: org.apache.log4j
> Bundle-ClassPath: src/,.
>
>
> Could anyone help me?
>
> Thanks!


--
Need professional support for Xtext and EMF?
Go to: http://xtext.itemis.com
Twitter : @svenefftinge
Blog : blog.efftinge.de
Re: Mwe2Launcher [message #543621 is a reply to message #543463] Wed, 30 June 2010 05:36 Go to previous message
Rubén Porras Campo is currently offline Rubén Porras CampoFriend
Messages: 67
Registered: July 2009
Member
Hi Sven,

thanks, I will wait for the fix
Previous Topic:Using Acceleo instead of Xpand with Xtext
Next Topic:Proposals behave differently in exported RCP application
Goto Forum:
  


Current Time: Fri Apr 26 09:21:34 GMT 2024

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

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

Back to the top