Closed magick93 closed 7 years ago
I tried again, with an even simpler model:
And again, it fails:
Starting MTC: MTC
Setting variable [output] value to: /home/anton/eclipse-workspaces/priceinsight/emfresttest/src/main/java
Setting variable [ecore_file] value to: /home/anton/eclipse-workspaces/priceinsight/emfresttest/src/main/resources/book.ecore
Setting variable [genModel_file] value to: /home/anton/eclipse-workspaces/priceinsight/emfresttest/src/main/resources/book.genmodel
Setting variable [output_js] value to: /home/anton/eclipse-workspaces/priceinsight/emfresttest/src/main/webapp/scripts
Setting variable [pluginName] value to: emfresttest
Setting variable [foreignModel] value to: book.ecore
Setting variable [modelName] value to:
Setting variable [output_pom] value to: /home/anton/eclipse-workspaces/priceinsight/emfresttest
Initializing Model Environments.
Finished Model Environments Initialization.
Model ready : Ecore Fully Annotated(/home/anton/eclipse-workspaces/priceinsight/emfresttest/src/main/resources/book.ecore)
Executing Ecore -> JavaScript API transformation
Executing Ecore->Genmodel transformation
Executing Default Index transformation
Executing pom transformation
Exception executing Default Index transformation
java.lang.NullPointerException
at com.emf.rest.standalone.PluginResourceLocator.getTarget(PluginResourceLocator.java:188)
at com.mtcflow.engine.egl.EGLTransformationExecutor$1.createModule(EGLTransformationExecutor.java:51)
at com.mtcflow.engine.epsilon.common.EpsilonExecutor.execute(EpsilonExecutor.java:93)
at com.mtcflow.engine.egl.EGLTransformationExecutor.executeTransformation(EGLTransformationExecutor.java:88)
at com.mtcflow.engine.core.MTCChoreographer$1.run(MTCChoreographer.java:628)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Ecore -> JavaScript API transformation finished.
Model ready : GenModel(/home/anton/eclipse-workspaces/priceinsight/emfresttest/src/main/resources/book.genmodel)
Ecore->Genmodel transformation finished.
Executing GenerateEMF transformation
pom transformation finished.
Exception executing GenerateEMF transformation
java.lang.NullPointerException
at org.eclipse.emf.codegen.ecore.genmodel.impl.GenPackageImpl$DependencyHelper.handle(GenPackageImpl.java:2490)
at org.eclipse.emf.codegen.ecore.genmodel.impl.GenPackageImpl$DependencyHelper.<init>(GenPackageImpl.java:2422)
at org.eclipse.emf.codegen.ecore.genmodel.impl.GenPackageImpl.prepareCache(GenPackageImpl.java:3220)
at org.eclipse.emf.codegen.ecore.genmodel.generator.GenPackageGeneratorAdapter.doPreGenerate(GenPackageGeneratorAdapter.java:177)
at org.eclipse.emf.codegen.ecore.generator.AbstractGeneratorAdapter.preGenerate(AbstractGeneratorAdapter.java:284)
at org.eclipse.emf.codegen.ecore.generator.Generator.generate(Generator.java:700)
at org.eclipse.emf.codegen.ecore.generator.Generator.generate(Generator.java:619)
at com.emf.rest.EMFGenerator.executeTransformation(EMFGenerator.java:50)
at com.mtcflow.engine.core.MTCChoreographer$1.run(MTCChoreographer.java:628)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Its a shame. The goals of this product are really great! Its a shame its not maintained.
I would like to thank you for trying EMF-REST and I apologize for the late answer.
Regarding your last issue, I reproduced the same metamodel (with the abstract class AbstrackBook and the class ProductBook) and I was able to generate the code without problems. Please make sure you follow the steps mentioned in the tutorial.
Regarding the first issue, I see that you were trying to generate a REST API from the IFML metamodel taken from the IFML editor plugin. Unfortunately, EMF-REST doesn't support subpackages and multi packages for the moment. Your metamodel also imports some elements from another metamodel located in the workspace (the UML metamodel) which is also not supported (I added a known issues file explaining the actual limitations of EMF-REST). Some workarounds should be done on this metamodel to make the code generation work.
Feel free to send me mail for further assistance.
Hamza
Hello
I can still reproduce this, with a super simple model:
package books
class Book{
String name
String subject
}
You can see in the following screencast the steps I am doing. If I understand correctly, I am following the steps in your tutorial. Please see https://youtu.be/LufZNBka-E8
Hi again,
You're not following the steps of "How to use the plugin" explained in the link. I see that your ecore file is in an Empty EMF project and not a Maven project as required by the plugin (see step 1). The file should also be under the folder /src/main/resources (see step 2).
Please make sure to follow the steps correctly.
Hamza
Hi Hamza
Yes you are right. Not using maven project type was a fundamental mistake. I also used xcore - I assume that should be ok.
I have tried again. This time using a maven project. However I still get a NPE. You can see a new video example at https://youtu.be/12lAhQM3Fn4
Thanks
I've just reproduced the error. It seems that Xcore is causing the problem. The ecore file generated by Xcore uses a relative path to the project org.eclipse.emf.ecore to reference the EString element of the Ecore metamodel (i.e.,../../org.eclipse.emf.ecore/model/Ecore.ecore#//EString"/
) which is not supported by emf-rest (this will also cause problems if you move your ecore file to another directory). A quick fix will be to change the relative path to a URI (i.e., http://www.eclipse.org/emf/2002/Ecore#//EString
).
I was able to generate the different classes peacefully after this tweak.
Hamza
Thanks Hamza
The ecore file generated by Xcore uses a relative path to the project org.eclipse.emf.ecore to reference the EString...
Does that mean that this issue - of relative types - will be for any types used in the xcore file?
Yes. For any type taken from the Ecore metamodel.
Hello, I have the same problem with an even simpler ecore file which I create from scratch from eclipse:
<?xml version="1.0" encoding="UTF-8"?>
<ecore:EPackage xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore"
name=""/>
I don't have any relative path here and I uses the URI as you suggested, however I still get errors when I try to generate all:
Starting MTC: MTC
Setting variable [output] value to: /home/ponce/Downloads/eclipse/ws/demo/src/main/java
Setting variable [ecore_file] value to: /home/ponce/Downloads/eclipse/ws/demo/src/main/resources/My.ecore
Setting variable [genModel_file] value to: /home/ponce/Downloads/eclipse/ws/demo/src/main/resources/My.genmodel
Setting variable [output_js] value to: /home/ponce/Downloads/eclipse/ws/demo/src/main/webapp/scripts
Setting variable [pluginName] value to: demo
Setting variable [foreignModel] value to: My.ecore
Setting variable [modelName] value to:
Setting variable [output_pom] value to: /home/ponce/Downloads/eclipse/ws/demo
Initializing Model Environments.
Finished Model Environments Initialization.
Model ready : Ecore Fully Annotated(/home/ponce/Downloads/eclipse/ws/demo/src/main/resources/My.ecore)
Executing Ecore -> JavaScript API transformation
Executing Ecore->Genmodel transformation
Executing Default Index transformation
Executing pom transformation
Exception executing Default Index transformation
Exception executing Ecore->Genmodel transformation
Ecore -> JavaScript API transformation finished.
pom transformation finished.
java.lang.NullPointerException
at com.emf.rest.standalone.PluginResourceLocator.getTarget(PluginResourceLocator.java:188)
at com.mtcflow.engine.egl.EGLTransformationExecutor$1.createModule(EGLTransformationExecutor.java:51)
at com.mtcflow.engine.epsilon.common.EpsilonExecutor.execute(EpsilonExecutor.java:93)
at com.mtcflow.engine.egl.EGLTransformationExecutor.executeTransformation(EGLTransformationExecutor.java:88)
at com.mtcflow.engine.core.MTCChoreographer$1.run(MTCChoreographer.java:628)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Internal error: java.lang.StringIndexOutOfBoundsException: String index out of range: 1
at java.lang.String.substring[String.java:1963]
at org.eclipse.epsilon.eol.execute.operations.contributors.StringOperationContributor.firstToUpperCase[StringOperationContributor.java:41]
at sun.reflect.NativeMethodAccessorImpl.invoke0[Native Method]
at sun.reflect.NativeMethodAccessorImpl.invoke[NativeMethodAccessorImpl.java:62]
at sun.reflect.DelegatingMethodAccessorImpl.invoke[DelegatingMethodAccessorImpl.java:43]
at java.lang.reflect.Method.invoke[Method.java:498]
at org.eclipse.epsilon.eol.util.ReflectionUtil.executeMethod[ReflectionUtil.java:175]
at org.eclipse.epsilon.eol.util.ReflectionUtil.executeMethod[ReflectionUtil.java:157]
at org.eclipse.epsilon.eol.execute.PointExecutor.executeOperation[PointExecutor.java:154]
at org.eclipse.epsilon.eol.execute.PointExecutor.execute[PointExecutor.java:75]
at org.eclipse.epsilon.eol.execute.PointExecutor.execute[PointExecutor.java:44]
at org.eclipse.epsilon.eol.execute.PointExecutor.execute[PointExecutor.java:90]
at org.eclipse.epsilon.eol.execute.ExecutorFactory.executeAST[ExecutorFactory.java:226]
at org.eclipse.epsilon.eol.execute.ParametersExecutor.execute[ParametersExecutor.java:29]
at org.eclipse.epsilon.eol.execute.ExecutorFactory.executeAST[ExecutorFactory.java:226]
at org.eclipse.epsilon.eol.execute.PointExecutor.executeOperation[PointExecutor.java:131]
at org.eclipse.epsilon.eol.execute.PointExecutor.execute[PointExecutor.java:75]
at org.eclipse.epsilon.eol.execute.PointExecutor.execute[PointExecutor.java:44]
at org.eclipse.epsilon.eol.execute.PointExecutor.execute[PointExecutor.java:90]
at org.eclipse.epsilon.eol.execute.ExecutorFactory.executeAST[ExecutorFactory.java:226]
at org.eclipse.epsilon.eol.execute.AssignExecutor.execute[AssignExecutor.java:48]
at org.eclipse.epsilon.eol.execute.ExecutorFactory.executeAST[ExecutorFactory.java:226]
at org.eclipse.epsilon.eol.execute.ExecutorFactory.executeAST[ExecutorFactory.java:196]
at org.eclipse.epsilon.eol.execute.StatementBlockExecutor.execute[StatementBlockExecutor.java:26]
at org.eclipse.epsilon.eol.execute.ExecutorFactory.executeAST[ExecutorFactory.java:226]
at org.eclipse.epsilon.erl.ErlModule.execute[ErlModule.java:88]
at org.eclipse.epsilon.etl.EtlModule.execute[EtlModule.java:122]
at com.mtcflow.engine.epsilon.common.EpsilonExecutor.execute[EpsilonExecutor.java:136]
at com.mtcflow.engine.epsilon.common.EpsilonExecutor.execute[EpsilonExecutor.java:126]
at com.mtcflow.engine.etl.ETLTransformationExecutor.executeTransformation[ETLTransformationExecutor.java:81]
at com.mtcflow.engine.core.MTCChoreographer$1.run[MTCChoreographer.java:628]
at java.util.concurrent.Executors$RunnableAdapter.call[Executors.java:511]
at java.util.concurrent.FutureTask.run[FutureTask.java:266]
at java.util.concurrent.ThreadPoolExecutor.runWorker[ThreadPoolExecutor.java:1149]
at java.util.concurrent.ThreadPoolExecutor$Worker.run[ThreadPoolExecutor.java:624]
at java.lang.Thread.run[Thread.java:748]
(/home/ponce/Downloads/eclipse/plugins/emf-rest_1.0.3.201503272048/transformations/M2M/Ecore2GenModel.etl@8:81)
at java.lang.String.substring(String.java:1963)
at org.eclipse.epsilon.eol.execute.operations.contributors.StringOperationContributor.firstToUpperCase(StringOperationContributor.java:41)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.eclipse.epsilon.eol.util.ReflectionUtil.executeMethod(ReflectionUtil.java:175)
at org.eclipse.epsilon.eol.util.ReflectionUtil.executeMethod(ReflectionUtil.java:157)
at org.eclipse.epsilon.eol.execute.PointExecutor.executeOperation(PointExecutor.java:154)
at org.eclipse.epsilon.eol.execute.PointExecutor.execute(PointExecutor.java:75)
at org.eclipse.epsilon.eol.execute.PointExecutor.execute(PointExecutor.java:44)
at org.eclipse.epsilon.eol.execute.PointExecutor.execute(PointExecutor.java:90)
at org.eclipse.epsilon.eol.execute.ExecutorFactory.executeAST(ExecutorFactory.java:226)
at org.eclipse.epsilon.eol.execute.ParametersExecutor.execute(ParametersExecutor.java:29)
at org.eclipse.epsilon.eol.execute.ExecutorFactory.executeAST(ExecutorFactory.java:226)
at org.eclipse.epsilon.eol.execute.PointExecutor.executeOperation(PointExecutor.java:131)
at org.eclipse.epsilon.eol.execute.PointExecutor.execute(PointExecutor.java:75)
at org.eclipse.epsilon.eol.execute.PointExecutor.execute(PointExecutor.java:44)
at org.eclipse.epsilon.eol.execute.PointExecutor.execute(PointExecutor.java:90)
at org.eclipse.epsilon.eol.execute.ExecutorFactory.executeAST(ExecutorFactory.java:226)
at org.eclipse.epsilon.eol.execute.AssignExecutor.execute(AssignExecutor.java:48)
at org.eclipse.epsilon.eol.execute.ExecutorFactory.executeAST(ExecutorFactory.java:226)
at org.eclipse.epsilon.eol.execute.ExecutorFactory.executeAST(ExecutorFactory.java:196)
at org.eclipse.epsilon.eol.execute.StatementBlockExecutor.execute(StatementBlockExecutor.java:26)
at org.eclipse.epsilon.eol.execute.ExecutorFactory.executeAST(ExecutorFactory.java:226)
at org.eclipse.epsilon.erl.ErlModule.execute(ErlModule.java:88)
at org.eclipse.epsilon.etl.EtlModule.execute(EtlModule.java:122)
at com.mtcflow.engine.epsilon.common.EpsilonExecutor.execute(EpsilonExecutor.java:136)
at com.mtcflow.engine.epsilon.common.EpsilonExecutor.execute(EpsilonExecutor.java:126)
at com.mtcflow.engine.etl.ETLTransformationExecutor.executeTransformation(ETLTransformationExecutor.java:81)
at com.mtcflow.engine.core.MTCChoreographer$1.run(MTCChoreographer.java:628)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.StringIndexOutOfBoundsException: String index out of range: 1
... 36 more
Hello
While trying to generate from the below .ecore model no code was generated, and the following exceptions occurred:
Model