Software Development Kit (SDK) and API Discussions

Occasional NullPointerException with use of some of the ZAPI APIs in nmsdk-runtime-5.7

harsh_singh
1,447 Views

Hi,

We are using nmsdk-runtime-5.7 java library in our application, with Woodstox STAX library in classpath for parsing ZAPI XML responses. Occasionally we see NullPointerException in some of the ZAPI calls while parsing the responses. Please see below example for net-interface-get-iter request. The XML response string below looks proper, but we still get NPE in XmlApiInvocation class.

 

NOTE:

The issue is intermittent, and the same API works fine in subsequent call. So not sure what could be causing this.

2021-02-02T21:29:04,044 [DEBUG] - Executing API request net-interface-get-iter to 10.197.138.169:
<?xml version='1.0' encoding='UTF-8'?><!DOCTYPE netapp SYSTEM 'file:/etc/netapp_filer.dtd'><netapp xmlns="http://www.netapp.com/filer/admin" version="1.0" nmsdk_version="5.4" nmsdk_platform="Linux unknown" nmsdk_language="Java" nmsdk_bindings="1"><net-interface-get-iter><desired-attributes><net-interface-info><address></address><address-family></address-family><administrative-status></administrative-status><data-protocols><data-protocol></data-protocol></data-protocols><operational-status></operational-status><role></role></net-interface-info></desired-attributes><max-records>500</max-records></net-interface-get-iter></netapp>
2021-02-02T21:29:04,071 [DEBUG] - Received API response for net-interface-get-iter from 10.197.138.169:
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE netapp SYSTEM 'file:/etc/netapp_gx.dtd'>
<netapp version='1.150' xmlns='http://www.netapp.com/filer/admin'>
<results status="passed"><attributes-list><net-interface-info><address>10.197.138.169</address><address-family>ipv4</address-family><administrative-status>up</administrative-status><data-protocols><data-protocol>nfs</data-protocol><data-protocol>cifs</data-protocol><data-protocol>fcache</data-protocol></data-protocols><interface-name>svm_raisa_cifs</interface-name><operational-status>up</operational-status><role>data</role><vserver>svm_raisa</vserver></net-interface-info></attributes-list><num-records>1</num-records></results></netapp>
2021-02-02T21:29:04,089 [ERROR]  - null
java.lang.NullPointerException: null
	at com.netapp.nmsdk.client.XmlApiInvocation.readResponse(XmlApiInvocation.java:197) ~[nmsdk-runtime-5.7.jar:5.7]
	at com.netapp.nmsdk.client.ApiInvocation.processResponse(ApiInvocation.java:218) ~[nmsdk-runtime-5.7.jar:5.7]
	at com.netapp.nmsdk.client.ApiInvocation.invoke(ApiInvocation.java:112) ~[nmsdk-runtime-5.7.jar:5.7]
	at com.netapp.nmsdk.client.XmlApiInvocation.invoke(XmlApiInvocation.java:42) ~[nmsdk-runtime-5.7.jar:5.7]
	at com.netapp.nmsdk.client.ApiRunner.run(ApiRunner.java:135) ~[nmsdk-runtime-5.7.jar:5.7]
	at com.netapp.nmsdk.client.ApiRunner.run(ApiRunner.java:105) ~[nmsdk-runtime-5.7.jar:5.7]
	at com.netapp.nmsdk.client.ApiIteratorSupport$GetIterStyleIterator.retrieveNextBatch(ApiIteratorSupport.java:182) ~[nmsdk-runtime-5.7.jar:5.7]
	at com.netapp.nmsdk.client.ApiIteratorSupport$ApiIterator.retrieveNextBatchIfNecessary(ApiIteratorSupport.java:125) ~[nmsdk-runtime-5.7.jar:5.7]
	at com.netapp.nmsdk.client.ApiIteratorSupport$ApiIterator.hasNext(ApiIteratorSupport.java:102) ~[nmsdk-runtime-5.7.jar:5.7]
	

 

1 ACCEPTED SOLUTION

harsh_singh
1,379 Views

This is resolved now. It ended up as a misconfiguration from our end. Issue was, we are sharing same STAX XML factory for our own XML parsing, as nmsdk ZAPI library (using JaxpContext.stax().xmlInputFactory()).

And we had set IS_NAMESPACE_AWARE property to false in the factory. As a result of STAX XML factory being singleton, when NMSDK was trying to pull out namespace string(xmlns='http://www.netapp.com/filer/admin' ) from ZAPI XML response, it came out as null, resulting in NPE eventually in com.netapp.nmsdk.client.XmlApiInvocation.readResponse.

 

We have now removed the IS_NAMESPACE_AWARE configuration from our end, and let it use default true. So we are no longer getting this exception.

View solution in original post

1 REPLY 1

harsh_singh
1,380 Views

This is resolved now. It ended up as a misconfiguration from our end. Issue was, we are sharing same STAX XML factory for our own XML parsing, as nmsdk ZAPI library (using JaxpContext.stax().xmlInputFactory()).

And we had set IS_NAMESPACE_AWARE property to false in the factory. As a result of STAX XML factory being singleton, when NMSDK was trying to pull out namespace string(xmlns='http://www.netapp.com/filer/admin' ) from ZAPI XML response, it came out as null, resulting in NPE eventually in com.netapp.nmsdk.client.XmlApiInvocation.readResponse.

 

We have now removed the IS_NAMESPACE_AWARE configuration from our end, and let it use default true. So we are no longer getting this exception.

Public