Could be the problem of extracting the parameters from the request. what printStackTrace() is printed? Try to print "e" as it is when e.getMessage() is null. Debug would be the best option to find the exact problem you encountered.
The very first chance of getting the null value is at the following location in your code
If the request does not contain the parameter P_ID, then the above code will throw a NPE.
Also why are you calling toString() on a string ??
Does not make sense.