Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Kura » CamelRunner.Builder() null pointer exception
CamelRunner.Builder() null pointer exception [message #1799456] Fri, 07 December 2018 06:25 Go to next message
Aistis Kaikaris is currently offline Aistis KaikarisFriend
Messages: 33
Registered: March 2018
Member
Hello

I have used the example provided in the "org.eclipse.kura.example.camel.quickstart" bundle for creating camel context in OSGI.

...
final BundleContext ctx = FrameworkUtil.getBundle(DeviceRouteRegistry.class).getBundleContext();
Builder builder = new CamelRunner.Builder();
...


This seemed to work fine in kura version 3.5, but when i tried out kura version 4.0, executing "new CamelRunner.Builder()" throws null pointer exception:

...
!STACK 0
java.lang.NullPointerException
	at java.base/java.util.Objects.requireNonNull(Objects.java:221)
	at org.eclipse.kura.camel.runner.CamelRunner$Builder.<init>(CamelRunner.java:153)
	at org.eclipse.kura.camel.runner.CamelRunner$Builder.<init>(CamelRunner.java:149)
...


causing the service activate method to be called again and again (i counted 7 times) until it creates the builder.

Any idea why this could be happening?

Thank you.
Re: CamelRunner.Builder() null pointer exception [message #1799560 is a reply to message #1799456] Mon, 10 December 2018 10:07 Go to previous messageGo to next message
Matteo Maiero is currently offline Matteo MaieroFriend
Messages: 423
Registered: July 2015
Location: Italy
Senior Member
Hi,
I've tried to reach the original contributor.
Following his reply:

Quote:
looking at the source code, I don't see anything obvious that changed.

The reason for the NPE is that the OSGi Framework didn't return a bundle context. So maybe this has something to do with a different start order, or something like that.

I would suggest to use the explicit constructor, passing in the be bundle context manually.


Best regards,
Matteo
Re: CamelRunner.Builder() null pointer exception [message #1799925 is a reply to message #1799560] Mon, 17 December 2018 14:47 Go to previous message
Aistis Kaikaris is currently offline Aistis KaikarisFriend
Messages: 33
Registered: March 2018
Member
Hi,

I think it was as you pointed out - a problem with ordering. Seems to have gone away for now. Thanks.
Previous Topic:Password field
Next Topic:Connect an IP Camera to Kura
Goto Forum:
  


Current Time: Fri Mar 29 05:16:46 GMT 2024

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

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

Back to the top