onvif-java-lib icon indicating copy to clipboard operation
onvif-java-lib copied to clipboard

Null Pointer Exception generated at 'new new OnvifDevice(Url,username, password)

Open lsteelandt opened this issue 4 years ago • 6 comments

Hi, I try to use ipcamera binding for openhab develop by Skinah. It is about one week that I turn around without any progress about an issue. By trying to debug step by step the add-on ipcamera, I see that the constructor new OnvifDevice(Url,username, password) throw an NPE exception.

Is anybody experience the same issue and is it a matter of the age of the library ?

lsteelandt avatar Nov 27 '19 17:11 lsteelandt

Please write your stack trace.

milg0 avatar Nov 28 '19 17:11 milg0

I get the same error. NPE occurs in: de.onvif.soap.OnvifDevice:180

With some cameras, "capabilities.getEvents()" returns null. I just tweaked the code to test for null first before attemping to "getXAddr" from the returned events object, that fixed the issue for me.

Camera is PTZ Optics SDI Gen 2.

localdevjs avatar Mar 18 '20 21:03 localdevjs

When trying to run the following command using the latest JAR in the release directory: OnvifDevice cam = new OnvifDevice("192.168.1.111:8899", "user", "password");

I get the following error: 2021-04-08 17:16:42.981 9887-10795/au.com.australiandroid.rcbappnative E/AndroidRuntime: FATAL EXCEPTION: Thread-8 Process: au.com.australiandroid.rcbappnative, PID: 9887 java.lang.NullPointerException: Attempt to invoke virtual method 'void javax.xml.soap.SOAPConnection.close()' on a null object reference at de.onvif.soap.SOAP.createSOAPRequest(SOAP.java:132) at de.onvif.soap.devices.InitialDevices.getCapabilities(InitialDevices.java:141) at de.onvif.soap.OnvifDevice.init(OnvifDevice.java:148) at de.onvif.soap.OnvifDevice.<init>(OnvifDevice.java:89) at au.com.australiandroid.rcbappnative.utils.RobotControl.run(RobotControl.java:94) at java.lang.Thread.run(Thread.java:919)

I believe it can be somewhat related to this issue.

JohanJarvi avatar Apr 08 '21 07:04 JohanJarvi

Hey please tell me about the issue in detail. I'm up.

ayabhishek avatar Aug 29 '21 18:08 ayabhishek

I do have a better solution for these types of problems.

ayabhishek avatar Aug 29 '21 18:08 ayabhishek

Hey, I'm facing the same issue. Does anyone know how to resolve it? Thanks.

riya-maan avatar Apr 28 '22 12:04 riya-maan