springboot整合shiro用户授权java.lang.ClassCastException: org.apache.shiro.subject.SimplePrincipalCollection cannot be cast to java.lang.String

 

 错误原因:shiro类型和string转换错误,项目启动时加载项目中的类使用的加载器都是 
org.springframework.boot.devtools.restart.classloader.RestartClassLoader 
而从shiro session 取出来的对象(从redis中取出经过反序列化)的类加载器都是 
sun.misc.Launcher.AppClassLoader  

最后排查到使用shiro发生错误 

<@shiro.hasPermission name="user:select">
在我的错误当中,我将它删除即可
posted @ 2020-11-03 09:19  浪里小白龙er  阅读(1982)  评论(1编辑  收藏  举报