Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » e(fx)clipse » Exception starting sample application(NPE loading most recent model)
Exception starting sample application [message #1774141] Wed, 11 October 2017 01:16 Go to next message
Marcelo Ruiz is currently offline Marcelo RuizFriend
Messages: 80
Registered: April 2017
Member
Hi,
My application does not start due to a NullPointerException. I though I broke things when trying to use the Reactor 3 library.
To be sure I did something wrong, I created a new application using the wizard and following the steps of Tutorial 4, where I edited the Application.e4xmi and added a trimmed window (defining its size and position on the screen) and added also an empty part.
To my surprise, I still get the same exception and the application does not start:

!ENTRY org.eclipse.equinox.app 4 0 2017-10-10 21:05:35.210
!MESSAGE Exception in Application start method
!STACK 0
java.lang.RuntimeException: Exception in Application start method
	at com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:917)
	at com.sun.javafx.application.LauncherImpl.lambda$launchApplication$155(LauncherImpl.java:182)
	at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.NullPointerException
	at org.eclipse.fx.ui.workbench.base.internal.EFX_ResourceHandler.loadMostRecentModel(EFX_ResourceHandler.java:176)
	at org.eclipse.fx.ui.workbench.base.AbstractE4Application.loadApplicationModel(AbstractE4Application.java:422)
	at org.eclipse.fx.ui.workbench.base.AbstractE4Application.createE4Workbench(AbstractE4Application.java:267)
	at org.eclipse.fx.ui.workbench.fx.E4Application.initE4Workbench(E4Application.java:358)
	at org.eclipse.fx.ui.workbench.fx.E4Application$1.run(E4Application.java:215)
	at org.eclipse.fx.ui.workbench.fx.E4Application.jfxStart(E4Application.java:253)
	at org.eclipse.fx.ui.workbench.fx.DefaultJFXApp.start(DefaultJFXApp.java:57)
	at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$162(LauncherImpl.java:863)
	at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$175(PlatformImpl.java:326)
	at com.sun.javafx.application.PlatformImpl.lambda$null$173(PlatformImpl.java:295)
	at java.security.AccessController.doPrivileged(Native Method)
	at com.sun.javafx.application.PlatformImpl.lambda$runLater$174(PlatformImpl.java:294)
	at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
	at com.sun.glass.ui.gtk.GtkApplication._runLoop(Native Method)
	at com.sun.glass.ui.gtk.GtkApplication.lambda$null$49(GtkApplication.java:139)
	... 1 more



Any idea of what might be the cause for this? I thought this problem was caused by having Java 9 running on my system, but I uninstalled it and reinstalled Java 8 and it is still there.
Maybe a good addition to the sample app, will be to make it at least display an empty window without requiring the developer to touch anything. Once that window is displayed, proving the configuration is correct, development could start on a sound base.
Thanks!

[Updated on: Thu, 12 October 2017 16:23]

Report message to a moderator

Re: Exception starting sample application [message #1774317 is a reply to message #1774141] Thu, 12 October 2017 18:28 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
Is this on the nightly or 3.0.0?
Re: Exception starting sample application [message #1774319 is a reply to message #1774317] Thu, 12 October 2017 19:10 Go to previous messageGo to next message
Marcelo Ruiz is currently offline Marcelo RuizFriend
Messages: 80
Registered: April 2017
Member
Hi Tom,

Thanks for your answer. It is happening in both.
This is what I found out:

EFX_ResourceHandler has a private variable:

private ResourceSetImpl resourceSetImpl;


that should be initialized in:

@PostConstruct
void init() {
	this.resourceSetImpl = new ResourceSetImpl();
        ....
}


but the method seems to be never called (I set a debug breakpoint there but it is never reached). So the execution of:

private Resource getResource(URI uri) throws Exception {
	Resource resource;
	if (this.saveAndRestore) {
		resource = this.resourceSetImpl.getResource(uri, true);   //NPE HERE
	} else {
		// Workaround for java.lang.IllegalStateException: No instance data can be specified
		// thrown by org.eclipse.core.internal.runtime.DataArea.assertLocationInitialized
		// The DataArea.assertLocationInitialized is called by ResourceSetImpl.getResource(URI,
		// boolean)
		resource = this.resourceSetImpl.createResource(uri);
		resource.load(new URL(uri.toString()).openStream(), this.resourceSetImpl.getLoadOptions());
	}

	return resource;
}


throws the NullPointerException.

I hope that information can give you a better hint of what might be going on.
Thanks!

Re: Exception starting sample application [message #1774394 is a reply to message #1774319] Fri, 13 October 2017 15:42 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
This sounds like you have multiple versions of javax.annotation in your runtime
Re: Exception starting sample application [message #1795361 is a reply to message #1774394] Thu, 20 September 2018 22:46 Go to previous messageGo to next message
Henri Boucher is currently offline Henri BoucherFriend
Messages: 56
Registered: September 2015
Member
I'm having the same problem (@PostConstruct not executed).
I suspect your diagnosis in the previous post applies, but I just don't know how to fix it.
I'm running Eclipse IDE Version: 2018-09 (4.9.0), fx runtime 3.4.0, and java version "1.8.0_171."
Would you please tell me how.
Thank-you.
Re: Exception starting sample application [message #1795418 is a reply to message #1795361] Fri, 21 September 2018 15:18 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
What javax.annotation bundle is loaded when you launch the osgi env?
Re: Exception starting sample application [message #1795690 is a reply to message #1795418] Wed, 26 September 2018 23:26 Go to previous messageGo to next message
Henri Boucher is currently offline Henri BoucherFriend
Messages: 56
Registered: September 2015
Member
Initially I was running a POJO, but I get the same result when it is run from a product "Launch an ecipse application." I don't see in either run configurations (including "show command line") any references to javax.annotation.

The eclipse platform plug-ins tab has
javax.annotation bundle 1.2.0v201602091430

How do I determine what bundles are loaded when launching? How can I add it for both cases?
Re: Exception starting sample application [message #1795977 is a reply to message #1795690] Wed, 03 October 2018 13:16 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
Well you start with -console the important commands are: "ss" and "inspect"
Re: Exception starting sample application [message #1796085 is a reply to message #1795977] Thu, 04 October 2018 23:24 Go to previous messageGo to next message
Henri Boucher is currently offline Henri BoucherFriend
Messages: 56
Registered: September 2015
Member
Thanks Thomas. Here's what I get:

osgi> inspect bundle capability javax.annotation
javax.annotation_1.2.0.v201602091430 [5] is required by:
--------------------------------------------------------
Nothing
osgi> inspect bundle requirement javax.annotation 
javax.annotation_1.2.0.v201602091430 [5] requires bundles:
----------------------------------------------------------
osgi.wiring.bundle; bundle-version:Version="2.6.0.v201404270220"; osgi.wiring.bundle="org.apache.commons.lang"
osgi> 


Re: Exception starting sample application [message #1796118 is a reply to message #1796085] Fri, 05 October 2018 13:10 Go to previous message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
More important is what e4.core.di and your own bundle wire to
Previous Topic:Cannot complete the install because of a conflicting dependency
Next Topic:MVN OSGI-Launcher cannot start
Goto Forum:
  


Current Time: Fri Apr 19 10:34:18 GMT 2024

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

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

Back to the top