netbeans 8.0.1无法找到shiro.ini

时间:2015-08-04 08:38:57

标签: java netbeans glassfish shiro

我在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服务器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.

你是什么原因或如何解决它?

2 个答案:

答案 0 :(得分:1)

不一定,

扩展IniWebEnvironment

ResourceBasedWebEnvironment类将默认配置位置指定为/WEB-INF/shiro.iniclasspath:shiro.ini

答案 1 :(得分:0)

我找到了原因:shiro.ini必须添加到源包而不是网页