解决方法:使用resultSet.getString()之前一定要调用resultSet.next()
ResultSet resultSet = statement1.executeQuery();
while (resultSet.next()){
String username1 = resultSet.getString("username");
int id1 = resultSet.getInt("id");
String password2 = resultSet.getString("password");
String name = resultSet.getString("name");
int age1 = resultSet.getInt("age");
logger.info("id:{},username:{},password:{},name:{},age:{}",id1,username1,password2,name,age1);
}