`
m635674608
  • 浏览: 5052942 次
  • 性别: Icon_minigender_1
  • 来自: 南京
社区版块
存档分类
最新评论

[shiro] Wildcard string cannot be null or empty. Make sure permission strings ar

    博客分类:
  • java
 
阅读更多

访问某页面时,出现了这个异常:

java.lang.IllegalArgumentException: Wildcard string cannot be null or empty. Make sure permission strings are properly formatted.
	at org.apache.shiro.authz.permission.WildcardPermission.setParts(WildcardPermission.java:154)
	at org.apache.shiro.authz.permission.WildcardPermission.<init>(WildcardPermission.java:143)
	at org.apache.shiro.authz.permission.WildcardPermission.<init>(WildcardPermission.java:139)
	at org.apache.shiro.authz.permission.WildcardPermissionResolver.resolvePermission(WildcardPermissionResolver.java:41)
	at org.apache.shiro.realm.AuthorizingRealm.resolvePermissions(AuthorizingRealm.java:434)
	at org.apache.shiro.realm.AuthorizingRealm.getPermissions(AuthorizingRealm.java:410)
	at org.apache.shiro.realm.AuthorizingRealm.isPermitted(AuthorizingRealm.java:468)
	at org.apache.shiro.realm.AuthorizingRealm.isPermitted(AuthorizingRealm.java:463)
	at org.apache.shiro.realm.AuthorizingRealm.isPermitted(AuthorizingRealm.java:458)
	at org.apache.shiro.authz.ModularRealmAuthorizer.isPermitted(ModularRealmAuthorizer.java:223)
	at org.apache.shiro.mgt.AuthorizingSecurityManager.isPermitted(AuthorizingSecurityManager.java:113)
	at org.apache.shiro.subject.support.DelegatingSubject.isPermitted(DelegatingSubject.java:158)
	at org.apache.shiro.web.tags.PermissionTag.isPermitted(PermissionTag.java:66)
	at org.apache.shiro.web.tags.HasPermissionTag.showTagBody(HasPermissionTag.java:32)
	at org.apache.shiro.web.tags.PermissionTag.onDoStartTag(PermissionTag.java:57)
	at org.apache.shiro.web.tags.SecureTag.doStartTag(SecureTag.java:53)
	at org.apache.jsp.WEB_002dINF.view.common.sysPermission.sysPermission_jsp._jspx_meth_shiro_005fhasPermission_005f0(sysPermission_jsp.java:486)
	at org.apache.jsp.WEB_002dINF.view.common.sysPermission.sysPermission_jsp._jspService(sysPermission_jsp.java:147)
	at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:723)
	at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:388)
	at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
	at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:723)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
	at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:646)
	at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:436)
	at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:374)
	at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:302)
	at org.springframework.web.servlet.view.InternalResourceView.renderMergedOutputModel(InternalResourceView.java:168)
	at org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:303)
	at org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1244)
	at org.springframework.web.servlet.DispatcherServlet.processDispatchResult(DispatcherServlet.java:1027)
	at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:971)
	at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:893)
	at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:966)
	at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:857)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
	at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:842)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:723)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
	at org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:61)
	at org.apache.shiro.web.servlet.AdviceFilter.executeChain(AdviceFilter.java:108)
	at org.apache.shiro.web.servlet.AdviceFilter.doFilterInternal(AdviceFilter.java:137)
	at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125)
	at org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:66)
	at org.apache.shiro.web.servlet.AbstractShiroFilter.executeChain(AbstractShiroFilter.java:449)
	at org.apache.shiro.web.servlet.AbstractShiroFilter$1.call(AbstractShiroFilter.java:365)
	at org.apache.shiro.subject.support.SubjectCallable.doCall(SubjectCallable.java:90)
	at org.apache.shiro.subject.support.SubjectCallable.call(SubjectCallable.java:83)
	at org.apache.shiro.subject.support.DelegatingSubject.execute(DelegatingSubject.java:383)
	at org.apache.shiro.web.servlet.AbstractShiroFilter.doFilterInternal(AbstractShiroFilter.java:362)
	at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125)
	at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:344)
	at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:261)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
	at com.alibaba.druid.support.http.WebStatFilter.doFilter(WebStatFilter.java:123)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
	at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:85)
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
	at org.apache.catalina.filters.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:107)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
	at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:879)
	at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:617)
	at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1778)
	at java.lang.Thread.run(Thread.java:745)

  

查看一下WildcardPermission.java源代码:

  protected void setParts(String wildcardString, boolean caseSensitive) {
        wildcardString = StringUtils.clean(wildcardString);
        if(wildcardString != null && !wildcardString.isEmpty()) {
            List parts = CollectionUtils.asList(wildcardString.split(":"));
            this.parts = new ArrayList();
            Iterator i$ = parts.iterator();

            while(i$.hasNext()) {
                String part = (String)i$.next();
                Set subparts = CollectionUtils.asSet(part.split(","));
                if(!caseSensitive) {
                    subparts = this.lowercase(subparts);
                }

                if(subparts.isEmpty()) {
                    throw new IllegalArgumentException("Wildcard string cannot contain parts with only dividers. Make sure permission strings are properly formatted.");
                }

                this.parts.add(subparts);
            }

            if(this.parts.isEmpty()) {
                throw new IllegalArgumentException("Wildcard string cannot contain only dividers. Make sure permission strings are properly formatted.");
            }
        } else {
            throw new IllegalArgumentException("Wildcard string cannot be null or empty. Make sure permission strings are properly formatted.");
        }
    }

  因为不留神将空值插入到权限信息中,结果抛出以上异常。

去掉空值后正常。

java.lang.IllegalArgumentException: Wildcard string cannot be null or empty. Make sure permission strings are properly formatted.at org.apache.shiro.authz.permission.WildcardPermission.setParts(WildcardPermission.java:154)at org.apache.shiro.authz.permission.WildcardPermission.<init>(WildcardPermission.java:143)at org.apache.shiro.authz.permission.WildcardPermission.<init>(WildcardPermission.java:139)at org.apache.shiro.authz.permission.WildcardPermissionResolver.resolvePermission(WildcardPermissionResolver.java:41)at org.apache.shiro.realm.AuthorizingRealm.resolvePermissions(AuthorizingRealm.java:434)at org.apache.shiro.realm.AuthorizingRealm.getPermissions(AuthorizingRealm.java:410)at org.apache.shiro.realm.AuthorizingRealm.isPermitted(AuthorizingRealm.java:468)at org.apache.shiro.realm.AuthorizingRealm.isPermitted(AuthorizingRealm.java:463)at org.apache.shiro.realm.AuthorizingRealm.isPermitted(AuthorizingRealm.java:458)at org.apache.shiro.authz.ModularRealmAuthorizer.isPermitted(ModularRealmAuthorizer.java:223)at org.apache.shiro.mgt.AuthorizingSecurityManager.isPermitted(AuthorizingSecurityManager.java:113)at org.apache.shiro.subject.support.DelegatingSubject.isPermitted(DelegatingSubject.java:158)at org.apache.shiro.web.tags.PermissionTag.isPermitted(PermissionTag.java:66)at org.apache.shiro.web.tags.HasPermissionTag.showTagBody(HasPermissionTag.java:32)at org.apache.shiro.web.tags.PermissionTag.onDoStartTag(PermissionTag.java:57)at org.apache.shiro.web.tags.SecureTag.doStartTag(SecureTag.java:53)at org.apache.jsp.WEB_002dINF.view.common.sysPermission.sysPermission_jsp._jspx_meth_shiro_005fhasPermission_005f0(sysPermission_jsp.java:486)at org.apache.jsp.WEB_002dINF.view.common.sysPermission.sysPermission_jsp._jspService(sysPermission_jsp.java:147)at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)at javax.servlet.http.HttpServlet.service(HttpServlet.java:723)at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:388)at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)at javax.servlet.http.HttpServlet.service(HttpServlet.java:723)at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:646)at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:436)at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:374)at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:302)at org.springframework.web.servlet.view.InternalResourceView.renderMergedOutputModel(InternalResourceView.java:168)at org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:303)at org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1244)at org.springframework.web.servlet.DispatcherServlet.processDispatchResult(DispatcherServlet.java:1027)at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:971)at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:893)at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:966)at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:857)at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:842)at javax.servlet.http.HttpServlet.service(HttpServlet.java:723)at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)at org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:61)at org.apache.shiro.web.servlet.AdviceFilter.executeChain(AdviceFilter.java:108)at org.apache.shiro.web.servlet.AdviceFilter.doFilterInternal(AdviceFilter.java:137)at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125)at org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:66)at org.apache.shiro.web.servlet.AbstractShiroFilter.executeChain(AbstractShiroFilter.java:449)at org.apache.shiro.web.servlet.AbstractShiroFilter$1.call(AbstractShiroFilter.java:365)at org.apache.shiro.subject.support.SubjectCallable.doCall(SubjectCallable.java:90)at org.apache.shiro.subject.support.SubjectCallable.call(SubjectCallable.java:83)at org.apache.shiro.subject.support.DelegatingSubject.execute(DelegatingSubject.java:383)at org.apache.shiro.web.servlet.AbstractShiroFilter.doFilterInternal(AbstractShiroFilter.java:362)at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125)at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:344)at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:261)at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)at com.alibaba.druid.support.http.WebStatFilter.doFilter(WebStatFilter.java:123)at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:85)at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)at org.apache.catalina.filters.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:107)at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:879)at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:617)at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1778)at java.lang.Thread.run(Thread.java:745)

[shiro] Wildcard string cannot be null or empty. Make sure permission strings are properly formatted.

标签:

分享到:
评论

相关推荐

    shiro连接redis集群 根据org.crazycake.shiro包改造源码

    Apache Shiro是一个强大的Java安全框架,它提供了身份验证、授权、会话管理和加密等功能。在分布式系统中,尤其是在使用Redis作为缓存或session存储时,Shiro的原生支持可能无法直接与Redis集群配合工作。这里提到的...

    毕设源码-基于SpringBoot +Shiro+ Layui 构建的商城商店系统.zip

    毕设源码-基于SpringBoot +Shiro+ Layui 构建的商城商店系统.zip毕设源码-基于SpringBoot +Shiro+ Layui 构建的商城商店系统.zip毕设源码-基于SpringBoot +Shiro+ Layui 构建的商城商店系统.zip毕设源码-基于...

    shiro1.7.1.zip

    在使用Shiro 1.7.1时,开发者可以根据具体需求选择合适的模块进行集成,例如,Web应用可能会主要依赖`shiro-core`、`shiro-web`和`shiro-spring`,而需要进行复杂加密操作的应用可能需要`shiro-crypto-hash`和`shiro...

    shiro(shiro-all-1.8.0.jar)

    shiro(shiro-all-1.8.0.jar)

    jedis-3.3.0.jar

    at org.crazycake.shiro.WorkAloneRedisManager.keys(WorkAloneRedisManager.java:149) at org.crazycake.shiro.RedisCache.values(RedisCache.java:249) at org.apache.shiro.session.mgt.eis.CachingSessionDAO...

    基于Springboot+shiro框架的仿电商后端项目源码.zip

    基于Springboot+shiro框架的仿电商后端项目源码.zip 基于Springboot+shiro框架的仿电商后端项目源码.zip 基于Springboot+shiro框架的仿电商后端项目源码.zip 基于Springboot+shiro框架的仿电商后端项目源码.zip

    shiro_tool.zip

    Apache Shiro 是一个强大且易用的Java安全框架,提供了认证、授权、加密和会话管理功能,可以非常轻松地开发出足够安全的应用。在"shiro_tool.zip"这个压缩包中,我们可以推测可能包含了一些关于Shiro使用的工具类、...

    shiro-jar-1.7.0.zip相关资源包

    解决:升級1.7后附件中文路径报400错误的问题 压缩包中包含: shiro-cas-1.7.0.jar shiro-core-1.7.0.jar shiro-ehcache-1.7.0.jar shiro-spring-1.7.0.jar ...spring-context-shiro.xml 修改说明.txt

    shiro-jar.zip

    shiro-all-1.7.1.jar,shiro-aspectj-1.7.1.jar,shiro-cache-1.7.1.jar,shiro-config-core-1.7.1.jar,shiro-config-ogdl-1.7.1.jar,shiro-core-1.7.1.jar,shiro-crypto-cipher-1.7.1.jar,shiro-crypto-core-1.7.1.jar...

    Shiro根据用户权限显示不同的菜单.Shiro根据权限显示指定菜单

    在Shiro中,权限分为角色(Role)和权限(Permission)。角色是一组权限的集合,权限则具体描述了用户可以执行的操作。例如,"admin"角色可能包含了"editUser"和"deleteUser"等权限。用户被分配角色,角色再赋予相应...

    shiro-crypto-hash-1.4.0-API文档-中文版.zip

    赠送jar包:shiro-crypto-hash-1.4.0.jar; 赠送原API文档:shiro-crypto-hash-1.4.0-javadoc.jar; 赠送源代码:shiro-crypto-hash-1.4.0-sources.jar; 赠送Maven依赖信息文件:shiro-crypto-hash-1.4.0.pom; ...

    shiro 安全框架 最全中文配置文档.docx

    在`applicationContext-shiro.xml`中,你需要配置`SecurityManager`和`ShiroFilterFactoryBean`。 **动态`filterChainDefinitions`**: `filterChainDefinitions`用于定义过滤器链,即哪些URL应该匹配哪个过滤器。...

    shiro-cache-1.4.0-API文档-中英对照版.zip

    赠送jar包:shiro-cache-1.4.0.jar; 赠送原API文档:shiro-cache-1.4.0-javadoc.jar; 赠送源代码:shiro-cache-1.4.0-sources.jar; 赠送Maven依赖信息文件:shiro-cache-1.4.0.pom; 包含翻译后的API文档:shiro-...

    springmvc+shiro实现记住我功能以及权限缓存.rar

    这个压缩包内的文件可能包括了相关的配置文件(如shiro.ini或XML配置)、Java源代码(如自定义的Filter、Realm实现)以及可能的测试用例。通过研究这些文件,开发者可以了解并实现类似的功能。 总之,Spring MVC和...

    毕业设计使用springboot+mybatis+shiro+activity的企业办公Oa系统.zip

    毕业设计使用springboot+mybatis+shiro+activity的企业办公Oa系统.zip 项目介绍 基于 springboot+myvatis_+ mvc + activiti+quarts+quartz 写的一个办公企业管理系统 OA 软件架构 springboot+myvatis_+ mvc + ...

    springboot+shiro+vue实现的简易教务系统.zip

    《基于SpringBoot、Shiro和Vue的简易教务系统实现详解》 教务管理系统是教育机构信息化建设的重要组成部分,它能够有效地管理和优化教学资源,提高工作效率。本项目以"springboot+shiro+vue实现的简易教务系统.zip...

    从实例入手Shiro并实现HellloWorld示例源码.zip

    Factory&lt;SecurityManager&gt; factory = new IniSecurityManagerFactory("classpath:shiro.ini"); // 通过工厂创建 SecurityManager SecurityManager securityManager = factory.getInstance(); // 将 ...

    Apache Shiro API(Apache Shiro开发文档).CHM

    Apache Shiro。 官网 Apache Shiro API。 Apache Shiro开发文档。

    SpringBoot整合Shiro完整源码(含sql脚本).rar

    《SpringBoot整合Shiro的深度解析与实战指南》 在当今的Web开发领域,Spring Boot以其简洁、高效的特性,已经成为主流的开发框架。而Shiro作为一款轻量级的安全管理框架,提供了用户认证、授权、会话管理和安全加密...

Global site tag (gtag.js) - Google Analytics