>>>>> Steinar Bang <[email protected]>:

> I'm setting the security manager adn the filterchain resolver on the
> filter.  I haven't debugged into the method yet, to see if these
> actually get a value, or if they are just null.  I will do that next.

Ok.  When debugging I didn't get past the first line of the activate
method, ie. this one:
>         IniWebEnvironment webenvironment = new IniWebEnvironment();

So I studied the karaf.log a little more closely and found this, ie. the
activator fails:
 2018-11-22T22:21:08,482 | ERROR | features-1-thread-1 | security               
          | 71 - no.priv.bang.ukelonn.web.security - 1.0.0.SNAPSHOT | 
[no.priv.bang.ukelonn.web.security.UkelonnShiroFilter(5)] The activate method 
has thrown an exception
 java.lang.NoClassDefFoundError: 
org/apache/shiro/config/IniSecurityManagerFactory
        at java.lang.ClassLoader.defineClass1(Native Method) ~[?:?]
        at java.lang.ClassLoader.defineClass(ClassLoader.java:763) ~[?:?]
        at 
org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.defineClass(BundleWiringImpl.java:2410)
 ~[?:?]
        at 
org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.findClass(BundleWiringImpl.java:2194)
 ~[?:?]
        at 
org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1607)
 ~[?:?]
        at 
org.apache.felix.framework.BundleWiringImpl.access$200(BundleWiringImpl.java:80)
 ~[?:?]
        at 
org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:2053)
 ~[?:?]
        at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ~[?:?]
        at 
org.apache.shiro.web.env.IniWebEnvironment.<init>(IniWebEnvironment.java:60) 
~[?:?]
        at 
no.priv.bang.ukelonn.web.security.UkelonnShiroFilter.activate(UkelonnShiroFilter.java:64)
 ~[?:?]
        ...

It looks like shiro code uses reflection to load classes by name, and
that can be a problem in an OSGi setting.  See eg. this stack overflow
answer
        https://stackoverflow.com/a/17940090

I wonder if there is a way around this?  Suggestions are welcome.

Thanks!


- Steinar

Reply via email to