ERROR: null" or "null pointer exception while invoking FlowService - Storage get operation

In this post, we’ll talk about a problem that developers face when multiple “get” operations are involved in a FlowService.

The typical scenario is as follows: the first “get” operation is successful during runtime, but subsequent “get” operations result in a null pointer exception. This still occurs even if a list operation shows that both keys are being fetched from the same data store. The error message “ERROR: null” or “null pointer exception” will appear on the screen if the user tries to use more than one storage “get.”

For a better understanding, let’s learn some facts about the “get” operation:

The “get” operation retrieves a value from a data store and locks the entry and the data store on behalf of the thread that invoked the operation.

Why does the operation lock the data store along with the entry?
This is done when the thread has the entry locked to prevent another thread from deleting the data store and the entries it contains.

This operation does not automatically release the lock on the data store or entry after performing the “get” operation. You need to ensure that the lock is released by calling the put or unlock operations. If you do not release the lock, Integration will release the lock at the end of the FlowService execution.

The solution to the problem of not being able to use several “get” operations in a single flow is as follows:

If you unlock the data store just after using the “get” operation, you should be able to use multiple “get” operations in a single flow.

You need to make sure to unlock the entry just after each “get” call so that it does not give that error. This will allow you to use “get” calls on other entries in the same store. By unlocking the entry, you’ll also unlock the datastore, allowing you to use “get” calls on other entries.

In a nutshell, if you’re facing an issue with the Storage “get” action failing during runtime, the solution is to explicitly unlock the entry just after each “get” operation by using the “unlock” operation. This way, you’ll be able to use multiple “get” operations in a single flow without encountering null pointer exceptions or other errors.

To know more about Storage services please follow below link:
FlowServices - Integration

Hope this helps.

1 Like