onvif-java-lib
onvif-java-lib copied to clipboard
Null Pointer Exception generated at 'new new OnvifDevice(Url,username, password)
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 ?
Please write your stack trace.
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.
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.
Hey please tell me about the issue in detail. I'm up.
I do have a better solution for these types of problems.
Hey, I'm facing the same issue. Does anyone know how to resolve it? Thanks.