Query is wrong. You should use all the selected columns in the group by operation to get the result. For better understanding whether the query is working or not, please run the query in DB then try to implement it in JSP.
What exactly are you trying to do with the query? From the looks of it, there is no reason to use a GROUP BY clause since you are not performing any aggregate function in the query. I think you might want to use an ORDER BY clause instead.