|Re: Java exception when generating code [message #1799267 is a reply to message #1799211]
||Mon, 03 December 2018 17:54
| Ernesto Posse
Registered: March 2011
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.
Powered by FUDForum
. Page generated in 0.01782 seconds