【问题标题】:Latest shiro release broke my webapp [ shiro-all-1.5.1.jar ]最新的 shiro 版本破坏了我的 webapp [shiro-all-1.5.1.jar]
【发布时间】:2020-06-26 10:55:34
【问题描述】:

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

GRAVE: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


    【解决方案1】:

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

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

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

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

    无论如何,感谢您的报告,我们很快就会解决这个问题!

    【讨论】:

    • 谢谢 Brain!,我已经将 shiro-all.1-5-1 更改为 shiro-web.1.5.1 和 shiro-core.1.5.1。现在一切正常。
    猜你喜欢
    • 2020-07-02
    • 2021-12-30
    • 1970-01-01
    • 1970-01-01
    • 2012-04-07
    • 1970-01-01
    • 2021-05-19
    • 2020-12-11
    • 2016-12-26
    相关资源
    最近更新 更多