我在web - inf:
下的网页下添加了这个shir.ini
。[main]
# Objects and their properties are defined here,
# Such as the securityManager, Realms and anything
# else needed to build the SecurityManager
shiro.loginUrl = /index.jsp
[users]
root = 12345,admin
guest = 12345,guest
[roles]
admin = *
[urls]
/index.xhtml = authc
/login.xhtml = authc
/info.xhtml = anon
/logout = logout
/admin/** = authc, roles[admin]
但是在glassfish server 4.1窗口,我得到了这个错误:
SEVERE: [admin-listener(5)] INFO org.apache.shiro.web.env.EnvironmentLoader - Starting Shiro environment initialization.
SEVERE: [admin-listener(5)] ERROR org.apache.shiro.web.env.EnvironmentLoader - Shiro environment initialization failed
SEVERE: org.apache.shiro.config.ConfigurationException: Shiro INI configuration was either not found or discovered to be empty/unconfigured.
你知道是什么原因或者如何解决它吗?
不一定,
扩展ResourceBasedWebEnvironment
的IniWebEnvironment
类指定/WEB-INF/shiro.ini
和classpath:shiro.ini
的默认配置位置
我找到原因了:shiro.ini必须添加到源代码包下,而不是网页下