Even thought it says SqlException, I don't think the code is getting that far. You can test that theory by using this simplified program instead. it should fail. Now look at URL. Which of the two methods do you expect it to call? Why? Frommy point of view, both look the same. /recipes/5 would match both so Java doesn't know which to call.