>>>>> Steinar Bang <sb-1rlz5cwd...@public.gmane.org>:

> 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)

I have to correct myself here: alternative 1 probably won't work because
the thread context classloader will possibly be null inside an OSGi bundle:
 https://stackoverflow.com/a/23186987

So that leaves alternative 2 and that doesn't work either, because the
shiro-lang bundle ClassUtils reside in, doesn't import-package the
packages it tries finding classes in.

Reply via email to