You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@karaf.apache.org by "Tommy Svensson (JIRA)" <ji...@apache.org> on 2017/07/09 13:05:00 UTC

[jira] [Created] (KARAF-5242) Classloading not compliant with java .class structure/content

Tommy Svensson created KARAF-5242:
-------------------------------------

             Summary: Classloading not compliant with java .class structure/content
                 Key: KARAF-5242
                 URL: https://issues.apache.org/jira/browse/KARAF-5242
             Project: Karaf
          Issue Type: Bug
    Affects Versions: 4.1.1
         Environment: Linux run in Vagrant.
/usr/lib/jvm/java-8-openjdk-amd64/bin/java
            Reporter: Tommy Svensson


I get the following stack trace in the log:

{{
Caused by: java.lang.ClassNotFoundException: Unable to load class 'se.natusoft.osgi.aps.web.adminweb.WebContentServer$_closure1$_closure5' because the bundle wiring for aps-admin-web-a2 is no longer valid.
        at org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1515) ~[?:?]
        at org.apache.felix.framework.BundleWiringImpl.access$200(BundleWiringImpl.java:79) ~[?:?]
        at org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:1958) ~[?:?]
        at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ~[?:?]
        ... 44 more
}}

Note that '_closure1' is an inner class and that '_closure5' is in inner class of '_closure_1'.  

Bytecode wise they both reside in WebContentServer.class, and there is no such thing as "se.natusoft.osgi.aps.web.adminweb.WebContentServer$_closure1.class" nor "se.natusoft.osgi.aps.web.adminweb.WebContentServer$_closure1$_closure5.class"! 

From decompiled WebContentServer.class:

{{

public class WebContentServer extends VertxConsumer implements Consumer<Vertx>, Constants {
...
    public class _closure1 extends Closure implements GeneratedClosure {
        public _closure1(Object _thisObject) {
            super(WebContentServer.this, _thisObject);
        }

        public Object doCall(Consumed<Router> router) {
            WebContentServer.pfaccess$01((WebContentServer)this.getThisObject(), router);
            class _closure5 extends Closure implements GeneratedClosure {
                public _closure5(Object _thisObject) {
                    super(_closure1.this, _thisObject);
                }
...

}}

This is compiled from Groovy code with is still compatible with java5 byte code standard. I have not read anywhere that java8 is not capable of running java5 byte code, and when the code is run in unit tests with java8 there is no problem. So I conclude that this problem resides in Karaf or more probably Felix which is at the bottom as I understand it. It is with Karaf I have the problem so it is here I report this. 




--
This message was sent by Atlassian JIRA
(v6.4.14#64029)