首页 > 解决方案 > 最新的 shiro 版本破坏了我的 webapp [shiro-all-1.5.1.jar]

问题描述

我用最新的 shiro 版本 1.5.1 升级了我的 webapp,突然它不再工作了。这里的日志错误:

坟墓: Shiro 环境初始化失败 java.lang.NoClassDefFoundError: org/apache/shiro/cache/CacheManagerAware

这是我的 shiro.ini 似乎是罪魁祸首:

[main]

jdbcRealm = org.apache.shiro.realm.jdbc.JdbcRealm
jdbcRealm.permissionsLookupEnabled = true
ds = com.mysql.cj.jdbc.MysqlDataSource
ps = org.apache.shiro.authc.credential.DefaultPasswordService
pm = org.apache.shiro.authc.credential.PasswordMatcher
jdbcRealmCredentialsMatcher = org.apache.shiro.authc.credential.Sha256CredentialsMatcher

ds.serverName = localhost
ds.serverTimezone=Europe/Berlin
ds.databaseName = ******
ds.user = *******
ds.password = ********

jdbcRealm.credentialsMatcher = $jdbcRealmCredentialsMatcher

jdbcRealm.dataSource = $ds
pm.passwordService = $ps
jdbcRealm.credentialsMatcher = $pm

shiro.loginUrl = /login.jsp

shiro.postOnlyLogout = true

securityManager.realms = $jdbcRealm

securityManager.rememberMeManager.cipherKey = kPH+bIxk5D2deZiIxcaaaA==

当我回到 shiro-all-1.4.2.jar 版本时,一切都恢复正常了。

我什至尝试将这两行添加到我的 shiro.ini 主要部分,但它们没有解决问题

cacheManager = org.apache.shiro.cache.MemoryConstrainedCacheManager
securityManager.cacheManager = $cacheManager

标签: shiro

解决方案


我可以确认这个问题,这应该在下一个版本中修复。

https://issues.apache.org/jira/browse/SHIRO-749

此外,“all”模块将来可能会被弃用,我强烈建议不要使用它们,而是只使用你需要的模块(例如,也许你只需要shiro-web.

临时修复是:a.)还添加对 shiro-cache 的依赖项 b.)通过使用您需要的模块(shiro-web、shiro-guice 等)删除 shiro-all 的使用

无论哪种方式,感谢您的报告,我们很快就会解决这个问题!


推荐阅读