steinarb opened a new issue, #1500:
URL: https://github.com/apache/shiro/issues/1500

   ### Search before asking
   
   - [X] I had searched in the 
[issues](https://github.com/apache/shiro/issues?q=is%3Aissue) 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 
https://github.com/apache/shiro/issues/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:
    1. Thread.currentThread().getContextClassLoader()
    2. ClassUtils.class.getClassLoader()
    3. 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 
https://github.com/apache/shiro/issues/1383 )
   
   ### Debug logs
   
   _No response_


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to