idea抛出异常:org.apache.shiro.authc.AuthenticationException

继续在ubuntu下折腾,终于将web项目的所有的东西配置好了,然后运行项目,满怀期待的心情登录系统的时候,突然出现了这个bug,吓得我差点从椅子上跳起来,这两天遇到的bug实在是太多了。。。。

DEBUG [http-nio-8080-exec-5] - Returning JDBC Connection to DataSource
DEBUG [http-nio-8080-exec-5] - Unable to translate SQLException with Error code '1449', will now try the fallback translator
DEBUG [http-nio-8080-exec-5] - Extracted SQL state class 'HY' from value 'HY000'
DEBUG [http-nio-8080-exec-5] - Added HttpServletResponse Cookie [rememberMe=deleteMe; Path=/; Max-Age=0; Expires=Sat, 10-Mar-2018 09:38:31 GMT]
DEBUG [http-nio-8080-exec-5] - DispatcherServlet with name 'DispatcherServlet' processing POST request for [/login.action]
DEBUG [http-nio-8080-exec-5] - Looking up handler method for path /login.action
DEBUG [http-nio-8080-exec-5] - Returning handler method [public java.lang.String com.hebeu.keyan.controller.LoginController.loginSubmit(org.springframework.ui.Model,javax.servlet.http.HttpServletRequest) throws java.lang.Exception]
DEBUG [http-nio-8080-exec-5] - Returning cached instance of singleton bean 'loginController'
这里是login方法
org.apache.shiro.authc.AuthenticationException
org.apache.shiro.authc.AuthenticationException
DEBUG [http-nio-8080-exec-5] - Rendering view [org.springframework.web.servlet.view.JstlView: name 'login'; URL [/WEB-INF/jsp/login.jsp]] in DispatcherServlet with name 'DispatcherServlet'
DEBUG [http-nio-8080-exec-5] - Added model object 'loginResult' of type [java.lang.String] to request in view with name 'login'
DEBUG [http-nio-8080-exec-5] - Forwarding to resource [/WEB-INF/jsp/login.jsp] in InternalResourceView 'login'
DEBUG [http-nio-8080-exec-5] - Successfully completed request

我的解决办法

熟悉我的朋友都知道,我写博客,废话并不多(个人认为=_=)。所以直接给出我的解决办法。

大家注意到第一行的错误信息了吗?(细心很重要)

一开始我并没有看到这个,所以走了很多的弯路,这句话才是最重要的。

mysql错误:1449!!!!!

这就是权限的问题啊!!万恶的权限。。。

  • 解决办法:授权 给 root 所有sql 权限
mysql> grant all privileges on *.* to root@"%" identified by ".";
mysql> flush privileges;

问题很快就解决了。

如果你的不是这种情况,那么看看我搜索到的结果能不能帮到你。

搜索的结果

其他错误:org.apache.shiro.authc.AuthenticationException

这篇文章作者问题出现的原因是mysql数据库没有设置不区分大小写,一般这个问题是出现在linux平台下的。解决办法就是设置个大小写的区分,写的很详细,不过不是我这个问题出现的原因,以后如果我出现了这个问题,我回详细地写一篇文章来总结一下,毕竟是第一次见,经验不足。

Spring Security教程外篇(1)—- AuthenticationException异常详解

还有就是这篇文章,详细的介绍了这个异常出现的原因,很有价值。