OData SharePoint list ERROR "System.NullReferenceException: Object reference not set to an instance of an object."

OData SharePoint list ERROR "System.NullReferenceException: Object reference not set to an instance of an object."

book

Article ID: KB0076696

calendar_today

Updated On:

Products Versions
Spotfire Analyst 7.0 and higher

Description

When using an OData data connector to connect to a SharePoint list, you may see the following ERROR from the TIBCO Spotfire installed client:

An exception was thrown by the data connection. Exception text: System.NullReferenceException: Object reference not set to an instance of an object. at Spotfire.Dxp.Data.Access.CancellationHelper.Execute(CancellationToken token, Action action) at Spotfire.Dxp.Data.Access.CancellationHelper.Execute[T](CancellationToken token, Func`1 function) at Spotfire.Dxp.Data.Adapters.OData.ODataAdapterConnection.GetSchemaCore(CancellationToken cancellationToken, ReadOnlyCollection`1 tableSelection, AdapterDataSchema& adapterSchema) at Spotfire.Dxp.Data.Access.Adapters.DataAdapterConnection.GetSchema(CancellationToken cancellationToken, ReadOnlyCollection`1 tableSelection, AdapterDataSchema& adapterSchema) at Spotfire.Dxp.Data.Access.Adapters.DataAdapter.TryGetSchema(IDataAdapterExecutionContext executionContext, AdapterCredentialsValue credentials, CancellationToken cancellationToken, ReadOnlyCollection`1 tableSelection, AdapterDataSchema& adapterDataSchema) at Spotfire.Dxp.Data.Access.Adapters.DataAccessDataSourceLink.<>c__DisplayClass38.<GetSchema>b__35(CancellationToken token) at Spotfire.Dxp.Data.Access.Adapters.DataAccessDataSourceLink.ExecuteAdapterMethod(ImpersonationPolicy impersonationPolicy, AdapterMethodDelegate method, Nullable`1 cancellationToken)

Issue/Introduction

Error: "System.NullReferenceException: Object reference not set to an instance of an object."

Resolution

First, enable DEBUG logging in the TIBCO Spotfire client to be able to see the detailed error message:
  1. Open Spotfire Client
  2. Browse to "Help > Support Diagnostics and Logging" > Logging tab
  3. Set the Log level to "Debug" and make a note of the "Log file" location
  4. Click on OK
Then replicate the issue again. From the log file, see if you get the following:
2017-02-24T10:14:22,578-07:00, , data_connector_pro, create_source, True, , , Spotfire.ODataAdapter, Connection type: OData
Service URL: http://Tibco/Test/_vti_bin/ListData.svc
Authentication method: Windows Authentication
, , , .
...
2017-02-24T10:14:24,168-07:00 2017-02-24 17:14:24,168 user@tibco.com [13] DEBUG Spotfire.Dxp.Framework.HttpClient.HttpClient [(null)] - Create non Spotfire request http://Tibco/Test/_vti_bin/ListData.svc/$metadata
2017-02-24T10:14:22,877-07:00 2017-02-24 17:14:22,877 user@tibco.com [27] DEBUG Spotfire.Dxp.Framework.HttpClient.HttpClient [(null)] - Create Spotfire request to non spotfire server http://Tibco/Test/_vti_bin/ListData.svc/$metadata
2017-02-24T10:14:23,785-07:00 2017-02-24 17:14:23,785 user@tibco.com [ProgressOperationThread] DEBUG Spotfire.Dxp.Data.Adapters.OData.ODataAdapterConnection [(null)] - ListTables executed in 926 ms.
..
2017-02-24T10:14:24,768-07:00 2017-02-24 17:14:24,768 user@tibco.com [ProgressOperationThread] DEBUG Spotfire.Dxp.Data.Access.CancellationHelper [(null)] - System.AggregateException: One or more errors occurred. ---> System.NullReferenceException: Object reference not set to an instance of an object.
   at Spotfire.Dxp.Data.Adapters.OData.ODataAdapterConnection.GetSchemaCoreImpl(MutableDataSchema schema, ReadOnlyCollection`1 tableSelection, Dictionary`2 mapping, Dictionary`2 hrefMapping)
   at Spotfire.Dxp.Data.Adapters.OData.ODataAdapterConnection.<>c__DisplayClass4.<GetSchemaCore>b__3()
   at Spotfire.Dxp.Data.Access.CancellationHelper.<>c__DisplayClass1`1.<Execute>b__0()
   at Spotfire.Dxp.Data.Access.CancellationHelper.<>c__DisplayClass4.<Execute>b__3()
   at System.Threading.Tasks.Task.Execute()
   --- End of inner exception stack trace ---
   at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
   at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
   at Spotfire.Dxp.Data.Access.CancellationHelper.Execute(CancellationToken token, Action action)
---> (Inner Exception #0) System.NullReferenceException: Object reference not set to an instance of an object.
   at Spotfire.Dxp.Data.Adapters.OData.ODataAdapterConnection.GetSchemaCoreImpl(MutableDataSchema schema, ReadOnlyCollection`1 tableSelection, Dictionary`2 mapping, Dictionary`2 hrefMapping)
   at Spotfire.Dxp.Data.Adapters.OData.ODataAdapterConnection.<>c__DisplayClass4.<GetSchemaCore>b__3()
   at Spotfire.Dxp.Data.Access.CancellationHelper.<>c__DisplayClass1`1.<Execute>b__0()
   at Spotfire.Dxp.Data.Access.CancellationHelper.<>c__DisplayClass4.<Execute>b__3()
   at System.Threading.Tasks.Task.Execute()<---
   ...

 
If so, enter the URL logged in the error, for example "http://Tibco/Test/_vti_bin/ListData.svc/$metadata" in the error above, in a web browser. If you get the following output:
<error xmlns="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">
  <code/>
  message xml:lang="en-US">An error occurred while processing this request.</message>
</error>
Then this means that the URL (http://<address>/ListData.svc/$metadata) you are connecting to is broken, or is no longer a valid ODATA URL, and the issue is not within Spotfire's control. One possible issue is the list name starts with a number. If so, rename the list and start with a letter. Work with your SharePoint admin to address the issue to ensure the list URL is valid.