When a REST endpoint in APS is deleted, the entries are not deleted from the DB. Instead they are marked as deleted and the entry is kept in the database. However it is removed from the endpoint UI in APS.
Since a deleted entry is not show in the UI, a user is not aware of the existence of an endpoint with that name! So, if another endpoint is created with the same name, APS processes are returning the exception "javax.persistence.NonUniqueResultException: result returns more than one elements" in the REST call and processes get stuck at the REST call task!
The code where this is failing is EndpointServiceImpl.java -> getConfigurationByName(name)
Steps to reproduce the issue
- Create a simple process with a REST call task.
- Configure the REST call task to use an endpoint defined under Identity Management -> Tenants -> Endpoints
- Publish the app and run the process. Make sure that the process runs end-end
- Now delete the endpoint by going to Identity Management -> Tenants -> Endpoints
- Re-create the endpoint using the same name
- Go back to the process and select the endpoint, save and republish the app
- Run the process once more
Process runs to the end without any issues and errors in logs.
Process is stuck at the REST call task with an error "javax.persistence.NonUniqueResultException: result returns more than one elements"
Delete the entry that is marked as "deleted" from the database table ENDPOINT_CONFIGURATION so that the endpoint is unique in the database.