-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Description
Search before asking
- I had searched in the issues and found no similar issues.
Environment
OpenJDK Java 17, debian 12.5 "bookworm", amd64, apache karaf 4.4.5 (running on apache felix)
Shiro version
SNAPSHOT built from shiro main between 2.0.0 and 2.0.1 (to get the fix for #1383 )
What was the actual outcome?
I get the following stack trace for all Shiro filters:
https://gist.github.com/steinarb/faa44f384b330ae0259cc051036885db
The error message is:
org.apache.shiro.config.ConfigurationException: Unable to instantiate class [org.apache.shiro.web.filter.authc.PassThruAuthenticationFilter] for object named 'authc'. Please ensure you've specified the fully qualified class name correctly.
This is the code parsing the INI file:
https://github.com/steinarb/oldalbum/blob/master/oldalbum.web.security/src/main/java/no/priv/bang/oldalbum/web/security/OldAlbumShiroFilter.java#L42
This is the INI file being parsed:
https://github.com/steinarb/oldalbum/blob/master/oldalbum.web.security/src/main/resources/shiro.ini
This being OSGi, I suspected a classloader issue.
Shiro tries several classloaders:
https://github.com/apache/shiro/blob/main/lang/src/main/java/org/apache/shiro/lang/util/ClassUtils.java#L153
The classloaders tried, are:
- Thread.currentThread().getContextClassLoader()
- ClassUtils.class.getClassLoader()
- ClassLoader.getSystemClassLoader()
Alternative 1. probably won't work since OSGi doesn't define context class loader behaviour and the context class loader may be null
Alternative 2, could have worked if the shiro-lang bundle had imported package org.apache.shiro.web.filter.authc (which it doesn't)
Alternative 3 won't find anything in OSGi.
What was the expected outcome?
That the shiro.ini file had been parsed without error and the shiro filter had been started normally (it worked with shiro 1.13)
How to reproduce
I haven't pushed my shiro 2.x changes yet.
I'm waiting for shiro 2.0.1 to be released (shiro 2.0.0 will fail in a different part of the build because of #1383 )
Debug logs
No response