Hi Steinar

I gonna take a look.

Regards
JB

On Fri, May 24, 2024 at 7:35 PM Steinar Bang <s...@dod.no> wrote:
>
> 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. looks like it should work, if the parsing code is called
> from an OSGi bundle that imports package org.apache.shiro.web.filter.authc
> (and where there is another bundle that exports that package).
>
> 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.
>
> None of my filter bundles imported package org.apache.shiro.web.filter.authc
> so the first thing I've done is to explicitly add that package to the
> bundles' import-packages:
>  
> https://gist.github.com/steinarb/e70d8f4247998344b601c88fdbe27c41#file-pom-xml-L150
>
> But that didn't help: I still get the error messages like 
> https://gist.github.com/steinarb/faa44f384b330ae0259cc051036885db
>
> But I see that all shiro filter bundles are in Waiting
>  
> https://gist.github.com/steinarb/a203fff8fdc183abe97dbe64ccffb012#file-gistfile1-txt-L77
>
> As far as I can tell, the package org.apache.shiro.web.filter.authc
> was resolved...?
>  
> https://gist.github.com/steinarb/9c4454baad69e4762ebeb1d05a9db89c#file-gistfile1-txt-L36
>
> I don't know why the bundles are in Waiting? Is it because SCR
> components couldn't be started? (because they crashed)
>
> Tips and hints and ideas appreciated!
>
> Thanks!
>
>
> - Steinar

Reply via email to