Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Registration Failed : java.lang.NullPointerException with PR #7 #8

Open
sbernard31 opened this issue Jan 13, 2023 · 3 comments
Open

Comments

@sbernard31
Copy link
Owner

When running #7 based on Leshan 2.0.0-M10 using , java -jar target/benchmark-clients-0.2.0-SNAPSHOT-jar-with-dependencies.jar -n 2 -u coap://leshan.eclipseprojects.io -e device%08d I get :

2023-01-13 17:31:40,898 DEBUG o.e.l.b.c.BenchClient          - Registration Failed : java.lang.NullPointerException

This doesn't happen with master based on Leshan 1.3.1.

After activating LOG in TRACE I get :

2023-01-13 17:32:59,418 INFO  o.e.l.c.c.LeshanClient         - Starting Leshan client ...
2023-01-13 17:32:59,903 INFO  .c.CaliforniumEndpointsManager - New endpoint created for server coap://leshan.eclipseprojects.io:5683 at coap://0.0.0.0:41041
2023-01-13 17:32:59,905 INFO  .c.e.DefaultRegistrationEngine - Trying to register to coap://leshan.eclipseprojects.io:5683 ...
2023-01-13 17:32:59,907 INFO  o.e.l.c.c.LeshanClient         - Leshan client[endpoint:device00000001] started.
2023-01-13 17:32:59,906 WARN  .c.e.DefaultRegistrationEngine - Unable to send register request
java.lang.NullPointerException: null
	at org.eclipse.leshan.client.servers.ServersInfoExtractor.getDeviceSupportedBindingMode(ServersInfoExtractor.java:281)
	at org.eclipse.leshan.client.engine.DefaultRegistrationEngine.register(DefaultRegistrationEngine.java:319)
	at org.eclipse.leshan.client.engine.DefaultRegistrationEngine.registerWithRetry(DefaultRegistrationEngine.java:295)
	at org.eclipse.leshan.client.engine.DefaultRegistrationEngine.access$600(DefaultRegistrationEngine.java:77)
	at org.eclipse.leshan.client.engine.DefaultRegistrationEngine$RegistrationTask.run(DefaultRegistrationEngine.java:572)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)

Debugging this, it seems that client has no Device Object Enabler and so unable to get SupportedBindingMode.

Adding something like initializer.setInstancesForObject(DEVICE, new Device("manufacturer","modelnumber","serialnumber")); seems to solve the issue.

I need to investigate more to understand why this does happen with previous version of Leshan but I guess SupportedBindingMode is new resource from LWM2M 1.1.

@jvermillard
Copy link

Since an object device is mandatory, it would be nice to trigger a warning if the client starts without one.

@sbernard31
Copy link
Owner Author

Yep agree with that.

@sbernard31
Copy link
Owner Author

sbernard31 commented Jan 16, 2023

Since an object device is mandatory, it would be nice to trigger a warning if the client starts without one.

@jvermillard, I created a PR about that : eclipse-leshan/leshan#1378 , If wanted you could have a look.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants