Skip to main content



      Home
Home » Eclipse Projects » Kura » CamelRunner.Builder() null pointer exception
CamelRunner.Builder() null pointer exception [message #1799456] Fri, 07 December 2018 01:25 Go to next message
Eclipse UserFriend
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 05:07 Go to previous messageGo to next message
Eclipse UserFriend
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 09:47 Go to previous message
Eclipse UserFriend
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 Jun 20 14:01:32 EDT 2025

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

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

Back to the top