Shiro 和 Maven 的例外

Exception with Shiro and Maven

我正在尝试将应用程序更改为 Maven。 我正在使用 NetBeans 和 GlassFish 3.1.2.2。 有个问题我解决不了。我一直在寻找,但没有找到任何解决方案。 我的问题是四郎。 GlassFish 控制台显示:

Grave: java.lang.IllegalArgumentException: Configuration error. Specified object [anyofroles] with property [loginUrl] without first defining that object's class. Please first specify the class property first, e.g. myObject = fully_qualified_class_name and then define additional properties. at org.apache.shiro.config.ReflectionBuilder.applySingleProperty(ReflectionBuilder.java:361) at 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正常工作。

感谢您的帮助,对不起我的英语。

错误消息说您应该首先声明对象:

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"]