|
|
Re: MWE2 Running as Standalone [message #727900 is a reply to message #727690] |
Thu, 22 September 2011 07:36 |
Daniel Missing name Messages: 101 Registered: July 2011 |
Senior Member |
|
|
Thanks for that hint but it has nothing to do with my problem. After changing the code I still get this error:
C:\Dev\tmp\standalone test> java -classpath .;MyDslRuntime.jar -jar MyDslRuntime.jar CompileToC.mwe2
0 [main] ERROR mf.mwe2.launch.runtime.Mwe2Launcher - Couldn't find module C:\Dev\tmp\standalone test\CompileToC.mwe2
java.lang.IllegalStateException: Couldn't find module C:\Dev\tmp\standalone test\CompileToC.mwe2
at org.eclipse.emf.mwe2.launch.runtime.Mwe2Runner.run(Mwe2Runner.java:79)
at org.eclipse.emf.mwe2.launch.runtime.Mwe2Runner.run(Mwe2Runner.java:73)
at org.eclipse.emf.mwe2.launch.runtime.Mwe2Launcher.run(Mwe2Launcher.java:76)
at org.eclipse.emf.mwe2.launch.runtime.Mwe2Launcher.main(Mwe2Launcher.java:35)
at at.mydsl.compiler.MyDslCompiler.runAsStandalone(MyDslCompiler.java:213)
at at.mydsl.compiler.CLI.main(CLI.java:33)
It also seems the Mwe2Launcher does not recognize file-paths very well. Therefore I tried to bypass the file-uri:
/**
* Runs the specified MWE file using the {@link Mwe2Runner} class created by
* a new {@link Mwe2StandaloneSetup} instance.
*
* @param mweFile the MWE file to execute
*/
public static void runAsStandalone(File mweFile) {
if (mweFile == null) {
throw new IllegalArgumentException("MWE file (mwe) must be set!"); //$NON-NLS-1$
}
if (!mweFile.exists() || !mweFile.isFile()) {
throw new IllegalArgumentException("The specified MWE file \"" + mweFile.getAbsolutePath() + "\" does not exist oder is no file"); //$NON-NLS-1$ //$NON-NLS-2$
}
Mwe2Launcher.main(new String[] {mweFile.toURI().toString()});
}
But this also does not solve the problem:
C:\Dev\tmp\standalone test>java -classpath .;MyDslRuntime.jar -jar MyDslRuntime.jar CompileToC.mwe2
1 [main] ERROR mf.mwe2.launch.runtime.Mwe2Launcher - Couldn't find module CompileToC
java.lang.IllegalStateException: Couldn't find module CompileToC
at org.eclipse.emf.mwe2.launch.runtime.Mwe2Runner.run(Mwe2Runner.java:79)
at org.eclipse.emf.mwe2.launch.runtime.Mwe2Runner.run(Mwe2Runner.java:73)
at org.eclipse.emf.mwe2.launch.runtime.Mwe2Runner.run(Mwe2Runner.java:64)
at org.eclipse.emf.mwe2.launch.runtime.Mwe2Runner.run(Mwe2Runner.java:55)
at org.eclipse.emf.mwe2.launch.runtime.Mwe2Launcher.run(Mwe2Launcher.java:74)
at org.eclipse.emf.mwe2.launch.runtime.Mwe2Launcher.main(Mwe2Launcher.java:35)
at at.mydsl.compiler.MyDslCompiler.runAsStandalone(MyDslCompiler.java:208)
at at.mydsl.compiler.CLI.main(CLI.java:33)
It seems the Module loaded via...
Mwe2Runner.java:58-70
public void run(URI createURI, Map<String, String> params, IWorkflowContext ctx) {
Resource resource = resourceSetProvider.get().getResource(createURI, true);
if (resource != null) {
if (!resource.getContents().isEmpty()) {
EObject eObject = resource.getContents().get(0);
if (eObject instanceof Module) {
run(((Module) eObject).getCanonicalName(), params);
return;
}
}
}
throw new IllegalArgumentException("Couldn't load module from URI " + createURI);
}
... does not get registered within the initializer.getInitializedResourceSet(). (findModule) and therefore the module cannot be found. I'm wondering why the Mwe2Runner does not already use the module instance of Mwe2Runner.java:64 instead of bypass the canonicalName and reresolve the module by name.
[Updated on: Thu, 22 September 2011 07:51] Report message to a moderator
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.02363 seconds