Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 350428

Summary: registerGenModelFile does not work in some cases (see description)
Product: [Modeling] TMF Reporter: Serano Colameo <serano.colameo>
Component: XtextAssignee: Project Inbox <tmf.xtext-inbox>
Status: CLOSED WORKSFORME QA Contact:
Severity: normal    
Priority: P3 CC: ed, michael.wohlfart, sebastian.zarnekow, sven.efftinge
Version: 2.0.1   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
mwe2 file none

Description Serano Colameo CLA 2011-06-27 07:48:21 EDT
Build Identifier: Xtext 2.0.1.v201106261503

causes => java.net.MalformedURLException: unknown protocol: classpath
---------------
Workflow {
    bean = StandaloneSetup {
		platformUri = "${runtimeProject}/.."
		uriMap = {
    		from="platform:/plugin/org.eclipse.xsd/model/XSD.ecore"
    		to="classpath:/model/XSD.ecore"
  		}
  		uriMap = {
    		from="platform:/plugin/org.eclipse.xsd/model/XSD.genmodel"
    		to="classpath:/model/XSD.genmodel"
		}
		uriMap = {
    		from="platform:/plugin/org.eclipse.wst.wsdl/model/WSDL.ecore"
    		to="classpath:/model/WSDL.ecore"
  		}
  		uriMap = {
    		from="platform:/plugin/org.eclipse.wst.wsdl/model/WSDL.genmodel"
    		to="classpath:/model/WSDL.genmodel"
		}
		registerGenModelFile = "platform:/resource/org.eclipse.xtext.common.types/model/JavaVMTypes.genmodel"
		registerGenModelFile = "platform:/resource/com.csg.cs.tools.mdgen.idl/src/com/csg/cs/tools/mdgen/idl/Idl.genmodel"
    	registerGenModelFile = "classpath:/model/XSD.genmodel"
    	registerGenModelFile = "classpath:/model/WSDL.genmodel"
	}

this works fine, but it's obsolete:

Workflow {
...
	component = Generator {
...
		language = {
...
		// Generate java classes for Ecore models
		fragment = ecore.EcoreGeneratorFragment {
	    	referencedGenModels = "classpath:/model/XSD.genmodel,classpath:/model/WSDL.genmodel"			
		}
...
}

Reproducible: Always

Steps to Reproduce:
1. see also attached mwe2
2.
3.
Comment 1 Serano Colameo CLA 2011-06-27 07:49:23 EDT
Created attachment 198638 [details]
mwe2 file
Comment 2 Sven Efftinge CLA 2011-06-27 09:39:07 EDT
please provide the stacktrace as well
Comment 3 Serano Colameo CLA 2011-06-27 10:38:34 EDT
...sorry, here it is:
----------------------------->
0    [main] INFO  lipse.emf.mwe.utils.StandaloneSetup  - Registering platform uri 'C:\Data\projects\workspaceIndigo\MDGEN\lib'
6796 [main] INFO  lipse.emf.mwe.utils.StandaloneSetup  - Adding URI mapping from 'platform:/plugin/org.eclipse.xsd/model/XSD.ecore' to 'classpath:/model/XSD.ecore'
6796 [main] INFO  lipse.emf.mwe.utils.StandaloneSetup  - Adding URI mapping from 'platform:/plugin/org.eclipse.xsd/model/XSD.genmodel' to 'classpath:/model/XSD.genmodel'
6796 [main] INFO  lipse.emf.mwe.utils.StandaloneSetup  - Adding URI mapping from 'platform:/plugin/org.eclipse.wst.wsdl/model/WSDL.ecore' to 'classpath:/model/WSDL.ecore'
6796 [main] INFO  lipse.emf.mwe.utils.StandaloneSetup  - Adding URI mapping from 'platform:/plugin/org.eclipse.wst.wsdl/model/WSDL.genmodel' to 'classpath:/model/WSDL.genmodel'
7327 [main] INFO  clipse.emf.mwe.utils.GenModelHelper  - Registered GenModel 'http://www.eclipse.org/xtext/common/JavaVMTypes' from 'platform:/resource/org.eclipse.xtext.common.types/model/JavaVMTypes.genmodel'
7421 [main] INFO  clipse.emf.mwe.utils.GenModelHelper  - Registered GenModel 'http://www.company.com/tools/mdgen/idl/Idl' from 'platform:/resource/tools.mdgen.idl/src/tools/mdgen/idl/Idl.genmodel'
7452 [main] ERROR mf.mwe2.launch.runtime.Mwe2Launcher  - Problems instantiating module tools.mdgen.icm.IcmDsl: java.lang.reflect.InvocationTargetException
java.lang.RuntimeException: Problems instantiating module <>.tools.mdgen.icm.IcmDsl: java.lang.reflect.InvocationTargetException
	at org.eclipse.emf.mwe2.launch.runtime.Mwe2Runner.run(Mwe2Runner.java:90)
	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)
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:137)
	at org.eclipse.emf.mwe2.language.factory.Mwe2ExecutionEngine.inCase(Mwe2ExecutionEngine.java:112)
	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.xtext.util.PolymorphicDispatcher.invoke(PolymorphicDispatcher.java:291)
	at org.eclipse.emf.mwe2.language.factory.Mwe2ExecutionEngine.internalSwitch(Mwe2ExecutionEngine.java:64)
	at org.eclipse.emf.mwe2.language.factory.Mwe2ExecutionEngine.internalApplyAssignments(Mwe2ExecutionEngine.java:136)
	at org.eclipse.emf.mwe2.language.factory.Mwe2ExecutionEngine.inCase(Mwe2ExecutionEngine.java:112)
	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.xtext.util.PolymorphicDispatcher.invoke(PolymorphicDispatcher.java:291)
	at org.eclipse.emf.mwe2.language.factory.Mwe2ExecutionEngine.internalSwitch(Mwe2ExecutionEngine.java:64)
	at org.eclipse.emf.mwe2.language.factory.Mwe2ExecutionEngine.inCase(Mwe2ExecutionEngine.java:78)
	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.xtext.util.PolymorphicDispatcher.invoke(PolymorphicDispatcher.java:291)
	at org.eclipse.emf.mwe2.language.factory.Mwe2ExecutionEngine.internalSwitch(Mwe2ExecutionEngine.java:64)
	at org.eclipse.emf.mwe2.language.factory.Mwe2ExecutionEngine.create(Mwe2ExecutionEngine.java:60)
	at org.eclipse.emf.mwe2.launch.runtime.Mwe2Runner.run(Mwe2Runner.java:88)
	... 5 more
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.net.MalformedURLException: unknown protocol: classpath
	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:298)
	... 35 more
Caused by: java.net.MalformedURLException: unknown protocol: classpath
	at java.net.URL.<init>(URL.java:574)
	at java.net.URL.<init>(URL.java:464)
	at java.net.URL.<init>(URL.java:413)
	at org.eclipse.emf.ecore.resource.impl.URIHandlerImpl.createInputStream(URIHandlerImpl.java:176)
	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
Comment 4 Ed Willink CLA 2011-07-09 12:36:17 EDT
Seems to be just a problem of inconsistent classpath: support.

The deprecated way works

fragment = ecore.EcoreGeneratorFragment {
    referencedGenModels = "classpath:/model/Ecore.genmodel"
}

and the replacement crashes

bean = StandaloneSetup {
    ...
    registerGenModelFile = "classpath:/model/Ecore.genmodel"
}
Comment 5 Sebastian Zarnekow CLA 2011-08-28 12:55:50 EDT
Please add scanClassPath=true to the standalone setup and use platform:/resource uris instead of classpath uris. Please reopen if the problem persist.
Comment 6 Karsten Thoms CLA 2017-09-19 18:00:26 EDT
Closing all bugs that were set to RESOLVED before Neon.0
Comment 7 Karsten Thoms CLA 2017-09-19 18:10:57 EDT
Closing all bugs that were set to RESOLVED before Neon.0