问答详情
源自:3-1 Shiro认证

问下老师这个异常是什么情况

4383 [main] WARN org.apache.shiro.authc.AbstractAuthenticator - Authentication failed for token submission [org.apache.shiro.authc.UsernamePasswordToken - mark, rememberMe=true].  Possible unexpected error? (Typical or expected login exceptions should extend from AuthenticationException).

java.lang.IllegalStateException: Configuration error:  No realms have been configured!  One or more realms must be present to execute an authentication attempt.

at org.apache.shiro.authc.pam.ModularRealmAuthenticator.assertRealmsConfigured(ModularRealmAuthenticator.java:161)

at org.apache.shiro.authc.pam.ModularRealmAuthenticator.doAuthenticate(ModularRealmAuthenticator.java:264)

at org.apache.shiro.authc.AbstractAuthenticator.authenticate(AbstractAuthenticator.java:198)

at org.apache.shiro.mgt.AuthenticatingSecurityManager.authenticate(AuthenticatingSecurityManager.java:106)

subject.login(token);//这一行报错


提问者:qq_善念与远方_0 2018-06-06 10:29

个回答

  • qq_防暑降温_0
    2018-07-15 18:32:50

    正解,完美的解决了我的问题,感谢,好像是要先把 realm注入进来

  • 须木一瓜
    2018-06-07 17:07:04

    defaultSecurityManager.setRealm(simpleAccountRealm);