1、保证代码数据库连接正确。课程里application.properties里的数据库配置要保证换成了自己可以连接的。 2、用户名密码是否正确。课程默认sql里给的可登陆账户为:用户名admin,密码123 3、如果用户名密码没问题,需要确认一下CredentialMatcher里是否也是使用明文做的等值检查,这是如果修改也可能出现问题。 public class CredentialMatcher extends SimpleCredentialsMatcher {
<select id="findByUsername" parameterType="string" resultMap="userMap"> SELECT u.*, r.*, p.* FROM user u INNER JOIN user_role ur on ur.uid = u.uid INNER JOIN role r on r.rid = ur.rid INNER JOIN permission_role pr on pr.rid = r.rid INNER JOIN permission p on pr.pid = p.pid WHERE u.username = #{username} </select> </mapper>
Authentication failed for token submission [org.apache.shiro.authc.UsernamePasswordToken - 11, rememberMe=false]. Possible unexpected error? (Typical or expected login exceptions should extend from AuthenticationException).