Trying to use the bitbucket hook and so far as I can tell, I guess that it is sending a JSON body without specifying a user. I wasn't able to retrieve the JSON that it was sending, but it seems like that field is not a guaranteed field.
Error while serving http://18.104.22.168/bitbucket-hook/
Caused by: net.sf.json.JSONException: JSONObject["user"] not found.
The offending line:
String user = payload.getString("user");