Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NullPointerException when generating code #2

Closed
Reinhold- opened this issue Oct 21, 2013 · 5 comments
Closed

NullPointerException when generating code #2

Reinhold- opened this issue Oct 21, 2013 · 5 comments
Assignees
Labels

Comments

@Reinhold-
Copy link

Hello,

first of all thanks for the effort you put into emf-rest. It could be very helpful for us. We want to create web front-ends for our legacy applications whose configuration data is modeled with EMF.

So I followed the instructions at http://emf-rest.com/install.html to get the sample running on my machine:

  • Downloaded the J2EE Eclipse Kepler distribution (eclipse-jee-kepler-R-win32-x86_64)
  • Installed the emf-rest plugins from your update site
  • Created a new Dynamic Web Project
  • created a folder called "model" and put your example model (downloaded from http://emf-rest.com/Example.ecore) into the folder

When I now do a right click on Example.ecore / EMF-REST / Generate All + Copy Libraries nothing happens.

In the Eclipse console log I get the following output:

!ENTRY org.eclipse.ui 4 0 2013-10-21 10:11:11.078
!MESSAGE Unhandled event loop exception
!STACK 0
org.eclipse.e4.core.di.InjectionException: java.lang.NullPointerException
at org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:63)
at org.eclipse.e4.core.internal.di.InjectorImpl.invokeUsingClass(InjectorImpl.java:243)
at org.eclipse.e4.core.internal.di.InjectorImpl.invoke(InjectorImpl.java:224)
at org.eclipse.e4.core.contexts.ContextInjectionFactory.invoke(ContextInjectionFactory.java:132)
at org.eclipse.e4.core.commands.internal.HandlerServiceHandler.execute(HandlerServiceHandler.java:167)
at org.eclipse.core.commands.Command.executeWithChecks(Command.java:499)
at org.eclipse.core.commands.ParameterizedCommand.executeWithChecks(ParameterizedCommand.java:508)
at org.eclipse.e4.core.commands.internal.HandlerServiceImpl.executeHandler(HandlerServiceImpl.java:213)
at org.eclipse.e4.ui.workbench.renderers.swt.HandledContributionItem.executeItem(HandledContributionItem.java:85
0)
at org.eclipse.e4.ui.workbench.renderers.swt.HandledContributionItem.handleWidgetSelection(HandledContributionIt
em.java:743)
at org.eclipse.e4.ui.workbench.renderers.swt.HandledContributionItem.access$7(HandledContributionItem.java:727)
at org.eclipse.e4.ui.workbench.renderers.swt.HandledContributionItem$4.handleEvent(HandledContributionItem.java:
662)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1057)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4170)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3759)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.run(PartRenderingEngine.java:1113)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:997)
at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:138)
at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:610)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:567)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:150)
at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:124)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:354)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:181)
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 org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:636)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:591)
at org.eclipse.equinox.launcher.Main.run(Main.java:1450)
at org.eclipse.equinox.launcher.Main.main(Main.java:1426)
Caused by: java.lang.NullPointerException
at com.emf.rest.eclipse.GenerateRestEMFCommand.execute(GenerateRestEMFCommand.java:118)
at org.eclipse.ui.internal.handlers.HandlerProxy.execute(HandlerProxy.java:290)
at org.eclipse.ui.internal.handlers.E4HandlerProxy.execute(E4HandlerProxy.java:90)
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 org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:56)
... 37 more

Any suggestions what I could do to fix this issue?

Regards,
Reinhold

emf-rest-clipboard01
emf-rest-clipboard02

@jlcanovas
Copy link
Member

Hi Reinhold-

Thanks for your report. I acknowledge the problem as I could reproduce it.

We will work to fix this, I'll let you know asap.

@jlcanovas
Copy link
Member

Hi again,

the problem is in the documentation. It is said that you have to create a folder called model and it should be models. I will change now the documentation.

Please, try to change the name of the folder and then do the generation. Let us know if it works.

In any case, we will change this requirement for future versions.

Thanks again for playing with the tool.

@ghost ghost assigned jlcanovas Oct 21, 2013
@jlcanovas
Copy link
Member

Just to be clear, the problem is that the code generator needs a models folder in the WebContent folder of the Web Dynamic project. It does not matter where you put the ecore file, but the WebContent/models folder must be created.

I hope this clarifies the problem.

@Reinhold-
Copy link
Author

With the updated installation documentation I was able to get the code generation running for your example model. Thanks for that Javier!

Maybe you should also clarify in the documentation that a model instance (e.g. the Simpsons.xmi file) should be placed into the WebContent/models/ folder in order to test the REST service:

"By default the generated code will search for your data (i.e., the instances of the classes in the model) in the WebContent/models folder. So you have to create the folder 'models' in the WebContent folder and copy your model instance files (.xmi files) into it. .."

As next step I will try to generate code for our fairly more complex model (~150 classes).

@jlcanovas
Copy link
Member

Ok, I've changed the documentation to include the example ecore and xmi files.

Do not hesitate to contact us if you find any other problem.

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants