我正在尝试将应用程序更改为Maven。 我正在使用NetBeans和GlassFish 3.1.2.2。 有一个我无法解决的问题。我一直在寻找,我没有找到任何解决方案。 我的问题是Shiro。 GlassFish控制台显示:
Grave:java.lang.IllegalArgumentException:配置错误。具有属性[loginUrl]的指定对象[anyofroles],而不首先定义该对象的类。请先指定class属性,例如myObject = fully_qualified_class_name然后定义其他属性。 在org.apache.shiro.config.ReflectionBuilder.applySingleProperty(ReflectionBuilder.java:361) 在org.apache.shiro.config.ReflectionBuilder.applyProperty(ReflectionBuilder.java:325)
我的Shiro版本在之前的项目中是相同的: * shiro-cas - > 1.2.0 * shiro-core - > 1.3.0 * shiro-web - > 1.3.0
我的shiri.ini包含:
[main]
anyofroles.loginUrl = /login.xhtml
# realm to be used
secundaryRealm=com.asesoreslocales.security.SecondaryRealm
anyofroles = com.asesoreslocales.security.AnyRolesAuthorizationFilter
builtInCacheManager = org.apache.shiro.cache.MemoryConstrainedCacheManager
securityManager.cacheManager = $builtInCacheManager
[users]
[urls]
/mantenimientos/** = anyofroles["administrador,editor"]
/remesas/** = anyofroles["administrador,editor"]
/alegaciones/** = anyofroles["administrador,editor"]
/notificaciones/** = anyofroles["administrador,editor"]
/expedientes/expedientes.xhtml = anyofroles["administrador,editor"]
/expedientes/busquedaExpedientes.xhtml = anyofroles["administrador,editor,consultor"]
在上一个项目中,Shiro正常工作。
感谢您的帮助,对不起我的英语。
答案 0 :(得分:0)
错误消息显示您应首先声明对象:
anyofroles = com.asesoreslocales.security.AnyRolesAuthorizationFilter
然后定义它的属性:
anyofroles.loginUrl = /login.xhtml
[main]
# realm to be used
secundaryRealm=com.asesoreslocales.security.SecondaryRealm
anyofroles = com.asesoreslocales.security.AnyRolesAuthorizationFilter
anyofroles.loginUrl = /login.xhtml
builtInCacheManager = org.apache.shiro.cache.MemoryConstrainedCacheManager
securityManager.cacheManager = $builtInCacheManager
[users]
[urls]
/mantenimientos/** = anyofroles["administrador,editor"]
/remesas/** = anyofroles["administrador,editor"]
/alegaciones/** = anyofroles["administrador,editor"]
/notificaciones/** = anyofroles["administrador,editor"]
/expedientes/expedientes.xhtml = anyofroles["administrador,editor"]
/expedientes/busquedaExpedientes.xhtml = anyofroles["administrador,editor,consultor"]