public UserBean authenticate(String username,String password){
PostGresDAO pg=new PostGresDAO(); //creates new connection
Connection conn=pg.getConnecion()
Because I got the message even when I called next() on resultSet I'll tell my solution.
The solution is NOT to call resultSet.get* on your resultSet if it's empty. So do a check if(resultSet.next()){ ...
Instead of
if(rs!=null)
You need to check for
if(rs.next())
This will return the first row, if there are any matching rows.
The error is telling you exactly what's wrong - you're not calling next() on your ResultSet to get to the first row of the results.
This line:
if(rs!=null)
is pointless as far as I know; I don't believe executeQuery will ever return null. If there's a problem in your query, an exception will be thrown. If there are no results, it will return an empty result set. To see if there's a row, you should call next() and check the return value:
if (rs.next())
Additionally: