Search code examples
shiro

Latest shiro release broke my webapp [ shiro-all-1.5.1.jar ]


I upgraded my webapp with the latest shiro release 1.5.1 and suddenly it doesn't work anymore. Here the log error:

GRAVE: Shiro environment initialization failed java.lang.NoClassDefFoundError: org/apache/shiro/cache/CacheManagerAware

and here's my shiro.ini that seems to be the culprit:

[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==

When I go back to the shiro-all-1.4.2.jar version everything is working fine again.

I have even tried to add these 2 lines to my shiro.ini main section but they didn't fix the problem

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

Solution

  • I can confirm the issue, this should be fixed in the next release.

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

    In addition, the "all" module will likely be deprecated in the future, I'd strongly advise against using them but instead using just the modules you need (for example maybe you just need shiro-web.

    The temporary fix is: a.) also add a dependency to shiro-cache b.) remove the usage of shiro-all by using the module you need (shiro-web, shiro-guice, etc)

    Either way, thanks for the report, we well get this fixed soon!