[ 
https://issues.apache.org/jira/browse/ARIES-1342?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14610446#comment-14610446
 ] 

Declan Cox commented on ARIES-1342:
-----------------------------------

BTW the exception that you will see that heralded all of this was as follows:
*java.lang.ClassFormatError: Absent Code attribute in method that is not native 
or abstract in class file Proxy82522026_baad_4ad4_a237_03b60effcd46*

{{noformat}}
2015-07-01 17:16:10,348 | ERROR | pool-43-thread-1 | BlueprintContainerImpl     
      | 12 - org.apache.aries.blueprint.core - 1.4.3 | Unable to start 
blueprint container for bundle org.deklanowski.aries.consumer
org.osgi.service.blueprint.container.ComponentDefinitionException: 
org.apache.aries.proxy.UnableToProxyException: java.lang.ClassFormatError: 
Absent Code attribute in method that is not native or abstract in class file 
Proxy82522026_baad_4ad4_a237_03b60effcd46
        at 
org.apache.aries.blueprint.container.ReferenceRecipe.internalCreate(ReferenceRecipe.java:122)[12:org.apache.aries.blueprint.core:1.4.3]
        at 
org.apache.aries.blueprint.di.AbstractRecipe$1.call(AbstractRecipe.java:79)[12:org.apache.aries.blueprint.core:1.4.3]
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)[:1.8.0_45]
        at 
org.apache.aries.blueprint.di.AbstractRecipe.create(AbstractRecipe.java:88)[12:org.apache.aries.blueprint.core:1.4.3]
        at 
org.apache.aries.blueprint.container.BlueprintRepository.createInstances(BlueprintRepository.java:245)[12:org.apache.aries.blueprint.core:1.4.3]
        at 
org.apache.aries.blueprint.container.BlueprintRepository.createAll(BlueprintRepository.java:183)[12:org.apache.aries.blueprint.core:1.4.3]
        at 
org.apache.aries.blueprint.container.BlueprintContainerImpl.instantiateEagerComponents(BlueprintContainerImpl.java:682)[12:org.apache.aries.blueprint.core:1.4.3]
        at 
org.apache.aries.blueprint.container.BlueprintContainerImpl.doRun(BlueprintContainerImpl.java:377)[12:org.apache.aries.blueprint.core:1.4.3]
        at 
org.apache.aries.blueprint.container.BlueprintContainerImpl.run(BlueprintContainerImpl.java:269)[12:org.apache.aries.blueprint.core:1.4.3]
        at 
org.apache.aries.blueprint.container.BlueprintExtender.createContainer(BlueprintExtender.java:294)[12:org.apache.aries.blueprint.core:1.4.3]
        at 
org.apache.aries.blueprint.container.BlueprintExtender.createContainer(BlueprintExtender.java:263)[12:org.apache.aries.blueprint.core:1.4.3]
        at 
org.apache.aries.blueprint.container.BlueprintExtender.modifiedBundle(BlueprintExtender.java:253)[12:org.apache.aries.blueprint.core:1.4.3]
        at 
org.apache.aries.util.tracker.hook.BundleHookBundleTracker$Tracked.customizerModified(BundleHookBundleTracker.java:500)[21:org.apache.aries.util:1.1.0]
        at 
org.apache.aries.util.tracker.hook.BundleHookBundleTracker$Tracked.customizerModified(BundleHookBundleTracker.java:433)[21:org.apache.aries.util:1.1.0]
        at 
org.apache.aries.util.tracker.hook.BundleHookBundleTracker$AbstractTracked.track(BundleHookBundleTracker.java:725)[21:org.apache.aries.util:1.1.0]
        at 
org.apache.aries.util.tracker.hook.BundleHookBundleTracker$Tracked.bundleChanged(BundleHookBundleTracker.java:463)[21:org.apache.aries.util:1.1.0]
        at 
org.apache.aries.util.tracker.hook.BundleHookBundleTracker$BundleEventHook.event(BundleHookBundleTracker.java:422)[21:org.apache.aries.util:1.1.0]
        at 
org.apache.felix.framework.util.SecureAction.invokeBundleEventHook(SecureAction.java:1179)[org.apache.felix.framework-5.0.1.jar:]
        at 
org.apache.felix.framework.util.EventDispatcher.createWhitelistFromHooks(EventDispatcher.java:730)[org.apache.felix.framework-5.0.1.jar:]
        at 
org.apache.felix.framework.util.EventDispatcher.fireBundleEvent(EventDispatcher.java:485)[org.apache.felix.framework-5.0.1.jar:]
        at 
org.apache.felix.framework.Felix.fireBundleEvent(Felix.java:4544)[org.apache.felix.framework-5.0.1.jar:]
        at 
org.apache.felix.framework.Felix.startBundle(Felix.java:2166)[org.apache.felix.framework-5.0.1.jar:]
        at 
org.apache.felix.framework.BundleImpl.start(BundleImpl.java:977)[org.apache.felix.framework-5.0.1.jar:]
        at 
org.apache.felix.framework.BundleImpl.start(BundleImpl.java:964)[org.apache.felix.framework-5.0.1.jar:]
        at 
org.apache.karaf.features.internal.service.FeaturesServiceImpl.startBundle(FeaturesServiceImpl.java:1189)[8:org.apache.karaf.features.core:4.0.0]
        at 
org.apache.karaf.features.internal.service.Deployer.deploy(Deployer.java:830)[8:org.apache.karaf.features.core:4.0.0]
        at 
org.apache.karaf.features.internal.service.FeaturesServiceImpl.doProvision(FeaturesServiceImpl.java:1079)[8:org.apache.karaf.features.core:4.0.0]
        at 
org.apache.karaf.features.internal.service.FeaturesServiceImpl$1.call(FeaturesServiceImpl.java:975)[8:org.apache.karaf.features.core:4.0.0]
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)[:1.8.0_45]
        at 
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)[:1.8.0_45]
        at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)[:1.8.0_45]
        at java.lang.Thread.run(Thread.java:745)[:1.8.0_45]
Caused by: org.apache.aries.proxy.UnableToProxyException: 
java.lang.ClassFormatError: Absent Code attribute in method that is not native 
or abstract in class file Proxy82522026_baad_4ad4_a237_03b60effcd46
        at 
org.apache.aries.proxy.impl.interfaces.ProxyClassLoader.createProxyClass(ProxyClassLoader.java:170)[20:org.apache.aries.proxy.impl:1.0.4]
        at 
org.apache.aries.proxy.impl.interfaces.InterfaceProxyGenerator.getProxyInstance(InterfaceProxyGenerator.java:95)[20:org.apache.aries.proxy.impl:1.0.4]
        at 
org.apache.aries.proxy.impl.AsmProxyManager.createNewProxy(AsmProxyManager.java:80)[20:org.apache.aries.proxy.impl:1.0.4]
        at 
org.apache.aries.proxy.impl.AbstractProxyManager.createDelegatingInterceptingProxy(AbstractProxyManager.java:75)[20:org.apache.aries.proxy.impl:1.0.4]
        at 
org.apache.aries.proxy.impl.AbstractProxyManager.createDelegatingProxy(AbstractProxyManager.java:40)[20:org.apache.aries.proxy.impl:1.0.4]
        at 
org.apache.aries.blueprint.container.AbstractServiceReferenceRecipe.createProxy(AbstractServiceReferenceRecipe.java:338)[12:org.apache.aries.blueprint.core:1.4.3]
        at 
org.apache.aries.blueprint.container.ReferenceRecipe.internalCreate(ReferenceRecipe.java:106)[12:org.apache.aries.blueprint.core:1.4.3]
        ... 31 more
Caused by: java.lang.ClassFormatError: Absent Code attribute in method that is 
not native or abstract in class file Proxy82522026_baad_4ad4_a237_03b60effcd46
        at java.lang.ClassLoader.defineClass1(Native Method)[:1.8.0_45]
        at java.lang.ClassLoader.defineClass(ClassLoader.java:760)[:1.8.0_45]
        at 
org.apache.aries.proxy.impl.interfaces.ProxyClassLoader.createProxyClass(ProxyClassLoader.java:162)
        ... 37 more

{{noformat}}

> Aries Proxy Impl fails to proxy a service with covariant type hierarchy in 
> Java 8
> ---------------------------------------------------------------------------------
>
>                 Key: ARIES-1342
>                 URL: https://issues.apache.org/jira/browse/ARIES-1342
>             Project: Aries
>          Issue Type: Bug
>          Components: Blueprint
>    Affects Versions: proxy-impl-1.0.3
>         Environment: Karaf 3.0.3/Karaf 4.0.0, JDK 1.8.0_u45
>            Reporter: Declan Cox
>            Priority: Critical
>              Labels: proxy-impl-1.0.4
>         Attachments: aries-proxy-issue.rar
>
>
> I have a simple type hierarchy with a base interface and an extending 
> interface with method overriding (covariant return types). A service 
> implements the derived interface (ColumnDAO - see attached test case). The 
> attached test case illustrates the scenario. In certain situations AriesProxy 
> Impl (more specifically the InterfaceCombiningClassAdapter) fails to properly 
> synthesize the proxy code. In particular it is a combination of the lexical 
> naming of the classes in the hierarchy and Java 8 method access flags that 
> does it. The naming of the classes determines the order in which they are 
> processed since the ProxyClassLoader receives a sorted set of classes when 
> building the proxy. If that order happens to be such that the types are 
> processed in hierarchy order starting with the base type, then all is cool. 
> If not then trouble arises. 
> Why ? Well if a more derived type is processed then it instruments base 
> methods which are marked (in Java 8) with Synthetic and Bridge access flags. 
> In this case the {{visitMethod()}} in {{AbstractWovenProxyAdapter}} does not 
> generate any code but records the fact that this method has been visited. 
> When it subsequently visits the base type, the methods are skipped since they 
> are considered already visited. 
> In the test case running {{javap -verbose ColumnDAO.class}} yields the 
> following (note the base type is named ZanyDAO to force the lexical ordering 
> and thus the error) : 
> {noformat}
> public abstract org.deklanowski.aries.dao.ColumnBatch<R, C, V> prepareBatch();
>     flags: ACC_PUBLIC, ACC_ABSTRACT
>     Signature: #9                           // 
> ()Lorg/deklanowski/aries/dao/ColumnBatch<TR;TC;TV;>;
>   public abstract org.deklanowski.aries.dao.ColumnQuery<R, C, V> 
> createQuery();
>     flags: ACC_PUBLIC, ACC_ABSTRACT
>     Signature: #12                          // 
> ()Lorg/deklanowski/aries/dao/ColumnQuery<TR;TC;TV;>;
>   public org.deklanowski.aries.dao.Batch prepareBatch();
>     flags: ACC_PUBLIC, ACC_BRIDGE, ACC_SYNTHETIC
>     Code:
>       stack=1, locals=1, args_size=1
>          0: aload_0
>          1: invokeinterface #1,  1            // InterfaceMethod 
> prepareBatch:()Lorg/deklanowski/aries/dao/ColumnBatch;
>          6: areturn
>       LineNumberTable:
>         line 3: 0
>       LocalVariableTable:
>         Start  Length  Slot  Name   Signature
>                0       7     0  this   Lorg/deklanowski/aries/dao/ColumnDAO;
>       LocalVariableTypeTable:
>         Start  Length  Slot  Name   Signature
>             0       7     0  this   
> Lorg/deklanowski/aries/dao/ColumnDAO<TR;TC;TV;>;
>   public org.deklanowski.aries.dao.Query createQuery();
>     flags: ACC_PUBLIC, ACC_BRIDGE, ACC_SYNTHETIC
>     Code:
>       stack=1, locals=1, args_size=1
>          0: aload_0
>          1: invokeinterface #2,  1            // InterfaceMethod 
> createQuery:()Lorg/deklanowski/aries/dao/ColumnQuery;
>          6: areturn
>       LineNumberTable:
>         line 3: 0
>       LocalVariableTable:
>         Start  Length  Slot  Name   Signature
>                0       7     0  this   Lorg/deklanowski/aries/dao/ColumnDAO;
>       LocalVariableTypeTable:
>         Start  Length  Slot  Name   Signature
>             0       7     0  this   
> Lorg/deklanowski/aries/dao/ColumnDAO<TR;TC;TV;>;
> {noformat}
> The logic in the aforementioned {{AbstractWovenProxyAdapter.visitMethod()}} 
> on line 341 is as follows:
> {noformat}
>     if ((access & (ACC_STATIC | ACC_PRIVATE | ACC_SYNTHETIC 
>         | ACC_NATIVE | ACC_BRIDGE)) == 0 && !!!name.equals("<init>") && 
>         !!!name.equals("<clinit>")) {
> <snip>
> {noformat}
> The if statement evaluates to false and no code is generated though the 
> methods are recorded as having been visited.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to