Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Papyrus for Real Time » Java exception when generating code
Java exception when generating code [message #1799211] Sun, 02 December 2018 12:05 Go to next message
Twan Dieltjes is currently offline Twan DieltjesFriend
Messages: 22
Registered: September 2018
Junior Member
I've started a totally new project for a trafficlight controller.
When I want to (re)generate all code, nothing happens and an exception appears in the error log.

I've also added a Top capsule and marked it as Top but that's not the solution.

What could I have done wrong ?
My other project still work so it has to do something with the project



org.eclipse.e4.core.di.InjectionException: java.lang.NullPointerException
at org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:65)
at org.eclipse.e4.core.internal.di.InjectorImpl.invokeUsingClass(InjectorImpl.java:305)
at org.eclipse.e4.core.internal.di.InjectorImpl.invoke(InjectorImpl.java:239)
at org.eclipse.e4.core.contexts.ContextInjectionFactory.invoke(ContextInjectionFactory.java:132)
at org.eclipse.e4.core.commands.internal.HandlerServiceHandler.execute(HandlerServiceHandler.java:152)
at org.eclipse.core.commands.Command.executeWithChecks(Command.java:494)
at org.eclipse.core.commands.ParameterizedCommand.executeWithChecks(ParameterizedCommand.java:487)
at org.eclipse.e4.core.commands.internal.HandlerServiceImpl.executeHandler(HandlerServiceImpl.java:210)
at org.eclipse.e4.ui.workbench.renderers.swt.HandledContributionItem.executeItem(HandledContributionItem.java:431)
at org.eclipse.e4.ui.workbench.renderers.swt.AbstractContributionItem.handleWidgetSelection(AbstractContributionItem.java:446)
at org.eclipse.e4.ui.workbench.renderers.swt.AbstractContributionItem.lambda$2(AbstractContributionItem.java:472)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:86)
at org.eclipse.swt.widgets.Display.sendEvent(Display.java:5252)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1348)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4522)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:4107)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$5.run(PartRenderingEngine.java:1155)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:336)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1044)
at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:153)
at org.eclipse.ui.internal.Workbench.lambda$3(Workbench.java:680)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:336)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:594)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:148)
at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:151)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:388)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:243)
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.equinox.launcher.Main.invokeFramework(Main.java:653)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:590)
at org.eclipse.equinox.launcher.Main.run(Main.java:1499)
at org.eclipse.equinox.launcher.Main.main(Main.java:1472)
Caused by: java.lang.NullPointerException

[Updated on: Sun, 02 December 2018 12:08]

Report message to a moderator

Re: Java exception when generating code [message #1799236 is a reply to message #1799211] Mon, 03 December 2018 08:05 Go to previous messageGo to next message
Twan Dieltjes is currently offline Twan DieltjesFriend
Messages: 22
Registered: September 2018
Junior Member
Hmm, I had 1 port connected to 2 other capsules but did not replicate the port.
My idea was to send 1 message to 2 capsules.. Probable that was my mistake.

Unfortunately the tool generated the Java exception which did not sended me into the right direction.

I also tried the "validate model" option and assumed, it would show me the mistake. The "Validation" tab did now show any text.
Should the validate model option be helpful in these situations?
Re: Java exception when generating code [message #1799267 is a reply to message #1799211] Mon, 03 December 2018 17:54 Go to previous messageGo to next message
Ernesto Posse is currently offline Ernesto PosseFriend
Messages: 381
Registered: March 2011
Senior Member
There is a codegen error in your model (explained below), but the exception trace you sent has nothing to do with it, since, as you can see, the trace does not mention any 'org.eclipse.papyrusrt.*' plugins.

I'll explain the error below, but for future reference, if you have problems with Papyrus-RT (or with any Eclipse-based product), here's what you should be doing to report a problem:

1) Open the Error Log view (Window > Show View... > Error Log)
2) Click the red [X] icon in the top-right of the Error Log view to delete existing errors, so the only errors that will show up will be those related to the problem.
3) Restart Papyrus-RT (or whichever Eclipse installation you are running)
4) Reopen the Error Log view. It should be empty, or showharmless info or warning messages (e.g. conflicting key bindings)
5) Try to reproduce the problem. (For example, open the model in question and try to regenerate code)
6) When the error occurs, go to the Error Log view, and new entries marked as errors should appear.
7) Click the first icon in the top-right of the Error Log view to export the Error Log. If you are unsure which icon is it, hover over the icons. The tooltip will say "Export Log". This will open up a dialog asking you for a file name and location to export the log. Save the log somewhere, and when reporting the problem, attach this log file.

By the way, by double clicking the "Error" entries in the log, you will get more detailed information. Usually the oldest entry (since you started reproducing the problem) will likely be the most relevant one which causes the subsequent errors.

Also, in general it is useful to have a clear list of the steps that you followed, the expected outcome and the actual outcome. In this particular case it's not necessary, since the steps are simply to open the model and try to generate code, but in more complex cases it is useful to have a clear list of steps.

Ok, the problem with the model: In your top capsule you declared a 'controller' part of type 'IntersectionController' with two ports: 'trafficlightSwSe' and 'trafficlightSnSs', each of which is connected to two parts. The problem is that these ports have replication (or multiplicity) set to one (well, more precisely, by default they are set to "None (1)", i.e. when you don't explicitly set replication, the default is 1). That's the error: if a port's replication is set to one, it can be connected to one other part at most. If you change their replication to 2 (select the port, and set the replication in the Properties View), and save, then you can regenerate correctly.

Unfortunately the validation and code generation do not give useful user-level error messages, but in this case, the hint comes from the first error message, which raised an NPE at org.eclipse.papyrusrt.codegen.instance.model.CapsuleInstance.connect. Whenever there are exceptions raised by this, it is likely that there is something wrong with connections in the model.
Re: Java exception when generating code [message #1799268 is a reply to message #1799236] Mon, 03 December 2018 17:56 Go to previous message
Ernesto Posse is currently offline Ernesto PosseFriend
Messages: 381
Registered: March 2011
Senior Member
Unfortunately the "Validation" feature is very incomplete and it misses a lot of errors.

But yes, that is the problem.
Previous Topic:Can we aggregate 2 Papyrus-RT models in a model
Next Topic:Just curious: Industrial use of Papyrus RT examples?
Goto Forum:
  


Current Time: Sun Nov 17 22:24:11 GMT 2019

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

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

Back to the top