Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » e(fx)clipse » @PostConsturct not always called(javax.annotation mismatch Problem??)
@PostConsturct not always called [message #1768238] Sat, 15 July 2017 10:48 Go to next message
Ali Karimi is currently offline Ali KarimiFriend
Messages: 36
Registered: October 2015
Member
Hey there,

currenty i am running in a strange problem, which is really frustrating.
I have a rather simple E4 javafx application developed in eclipse neon 3 and efxclipse 2.2.0.
I have created the application with the Eclipse wizard and added two plugins. This is my Project structure:
-- de.test.app
-- de.test.feature
-- de.test.product
-- de.test.releng
-- de.test.perspective
-- de.test.part1
-- de.test.part2

My Application.e4xmi in the de.test.app project defines a Perspective Stack as follows:
-- Application
---- Windows And Dialogs
------ Controls
-------- Perspective Stack

A Perspective is defined in the fragment file of the project de.test.perspective:
-- Model Fragment
---- Perspective
------ Controls
-------- Part Stash Container 1
-------- Part Stash Container 2

The plugin de.test.part1 contributes a Part class Part1 annotated with @PostConstruct to Part Stash Container 1
The plugin de.test.part2 contributes a Part class Part2 annotated with @PostConstruct to Part Stash Container 2

Every then and now one or both annotated @PostConstruct methods are not called and the view does not show up.
There is no exception thrown. There is nothing else injected/annotated in the part besides the @PostConstruct methods.
Sometimes running the Application from within eclipse in debug mode or run mode helps, but not always.
What kind of problem is this? This is really strange.
I already read this FAQ:
https://wiki.eclipse.org/Eclipse4/RCP/FAQ#Why_aren.27t_my_.40Inject-able.2F.40PostConstruct_methods_being_injected.3F
At first i though this must be the problem, but it dident helped to import the javax.annotation package with or without a version supplied.
Furthermore is also dident help to add org.eclipse.core.runtime to the required bundles for the plugins in questions.

Can anyone help me with this, i am clueless what else i can do to further analyze the problem?
Any help would be greatly apprechiated.
Re: @PostConsturct not always called [message #1768240 is a reply to message #1768238] Sat, 15 July 2017 11:05 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
So what bundles with javax.annotation are available in your target-configuration? There should be only javax.annotation.jre, is that right? How do the methods you annotated with @PostConstruct look like?
Re: @PostConsturct not always called [message #1768241 is a reply to message #1768240] Sat, 15 July 2017 11:11 Go to previous messageGo to next message
Ali Karimi is currently offline Ali KarimiFriend
Messages: 36
Registered: October 2015
Member
Hey,
thanks for the ast response

Quote:
So what bundles with javax.annotation are available in your target-configuration?


How can i see this?

This is the target-platform definition i have setup as my target plattform:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?pde version="3.8"?><target includeMode="feature" name="de.test" sequenceNumber="73">
<locations>
<location includeAllPlatforms="false" includeConfigurePhase="true" includeMode="slicer" includeSource="true" type="InstallableUnit">
<unit id="org.eclipse.equinox.executable.feature.group" version="0.0.0"/>
<repository location="http://download.eclipse.org/eclipse/updates/4.5"/>
</location>
<location includeAllPlatforms="false" includeConfigurePhase="true" includeMode="slicer" includeSource="true" type="InstallableUnit">
<unit id="org.eclipse.fx.ide.converter.feature.feature.group" version="2.2.0.201512111004"/>
<unit id="org.eclipse.fx.ide.css.feature.feature.group" version="2.2.0.201512111004"/>
<unit id="org.eclipse.fx.ide.basic.feature.feature.group" version="2.2.0.201512111004"/>
<unit id="org.eclipse.fx.ide.fxgraph.feature.feature.group" version="2.2.0.201512111004"/>
<unit id="org.eclipse.fx.ide.ldef.feature.feature.group" version="2.2.0.201512111004"/>
<unit id="org.eclipse.fx.ide.feature.feature.group" version="2.2.0.201512111004"/>
<unit id="org.eclipse.fx.ide.gmod.feature.feature.group" version="2.2.0.201512111004"/>
<unit id="org.eclipse.fx.ide.pde.feature.feature.group" version="2.2.0.201512111004"/>
<unit id="org.eclipse.fx.ide.rrobot.feature.feature.group" version="2.2.0.201512111004"/>
<unit id="org.eclipse.fx.ide.fxml.feature.feature.group" version="2.2.0.201512111004"/>
<unit id="org.eclipse.fx.ide.l10n.feature.feature.group" version="2.2.0.201512111004"/>
<repository location="http://download.eclipse.org/efxclipse/updates-released/2.2.0/site/"/>
</location>
<location includeAllPlatforms="false" includeConfigurePhase="true" includeMode="slicer" includeSource="true" type="InstallableUnit">
<unit id="org.eclipse.fx.slf4j.target.feature.feature.group" version="2.2.0.201512110704"/>
<unit id="org.eclipse.fx.target.feature.feature.group" version="2.2.0.201512110704"/>
<unit id="org.eclipse.fx.target.rcp.feature.feature.group" version="2.2.0.201512110704"/>
<unit id="org.eclipse.fx.runtime.min.feature.feature.group" version="2.2.0.201512110602"/>
<unit id="org.eclipse.fx.target.rcp4.feature.feature.group" version="2.2.0.201512110704"/>
<unit id="org.eclipse.fx.code.target.feature.feature.group" version="2.2.0.201512110704"/>
<repository location="http://download.eclipse.org/efxclipse/runtime-released/2.2.0/site/"/>
</location>
</locations>
</target>


The code for the @PostConstruct Methods does nothing other than this:

public class Part1 {
	
	
	@PostConstruct
    public void postConstruct(final BorderPane p) {
		System.out.println("MapPart.postConstruct()");
    }
}


This is not always printed, sometimes it is visible in the console, sometimes not. Sometime visible from Part 1 and sometimes visible from Part 2 and so on...
Re: @PostConsturct not always called [message #1768243 is a reply to message #1768241] Sat, 15 July 2017 13:27 Go to previous messageGo to next message
Ali Karimi is currently offline Ali KarimiFriend
Messages: 36
Registered: October 2015
Member
Hey,

switching to release 2.4.0 of efxclipe seems to fix this issue. Wow, this was pain.

Cheers,
Re: @PostConsturct not always called [message #1768249 is a reply to message #1768243] Sat, 15 July 2017 20:12 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
Why did you have the eclipse update site in your target - this one i think is the problem because it contains javax.annotation bundle there's no guarantee that the problem will not reoccur as long as you reference the 4.5 update site. BTW you know we released 3.0.0 already!
Re: @PostConsturct not always called [message #1768268 is a reply to message #1768249] Sun, 16 July 2017 11:08 Go to previous messageGo to next message
Ali Karimi is currently offline Ali KarimiFriend
Messages: 36
Registered: October 2015
Member
The reason for this is, that i am not able to setup a target definition file without including the eclipse update site.
Without the the eclipse update site, i am getting the following error, when trying to add the efxclipse update site to my target definition:
https://image.ibb.co/coiSkF/efxclipse_target_error.png

Here are the steps i have done:


  1. Download eclipse oxygen
  2. Install efxclipse IDE using Install new Software and selecting efxclipse from the Oxygen Release
  3. Generated a new E4 efxclipse project
  4. Trying to setup up a new target definition file,
    by adding the update site of efxclipse (http://download.eclipse.org/efxclipse/updates-released/3.0.0/site)
  5. This results in the error message seen in the image above


Am i missing something? Only when i start the target defintiion file with the eclipse update site, i am able to add efxclipse update site without any error.

[Updated on: Sun, 16 July 2017 11:10]

Report message to a moderator

Re: @PostConsturct not always called [message #1768276 is a reply to message #1768268] Sun, 16 July 2017 17:35 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
You point to the wrong update-site you should use http://download.eclipse.org/efxclipse/runtime-released/3.0.0/site to setup a target
Re: @PostConsturct not always called [message #1768277 is a reply to message #1768276] Sun, 16 July 2017 17:57 Go to previous messageGo to next message
Ali Karimi is currently offline Ali KarimiFriend
Messages: 36
Registered: October 2015
Member
Sorry, copied wrong screenshot but it doesnt matter, there is a similar error, when pointing to the correct update site.
https://image.ibb.co/dOC4za/efxclipse_target_error.png
Re: @PostConsturct not always called [message #1768278 is a reply to message #1768277] Sun, 16 July 2017 18:06 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
You forgot to uncheck "include required software"
Re: @PostConsturct not always called [message #1768279 is a reply to message #1768278] Sun, 16 July 2017 19:16 Go to previous message
Ali Karimi is currently offline Ali KarimiFriend
Messages: 36
Registered: October 2015
Member
Yes indeed, this was the problem. Thanks for clarifying.
Previous Topic:Proper way of consuming third party javafx components in Efxclipse RCP
Next Topic:Requirements to use FXCanvas in Eclipse plugins?
Goto Forum:
  


Current Time: Thu Mar 28 14:43:44 GMT 2024

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

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

Back to the top