OpenLiberty / open-liberty

Open Liberty is a highly composable, fast to start, dynamic application server runtime environment
https://openliberty.io
Eclipse Public License 2.0
1.14k stars 587 forks source link

Exception when calling default methods on MicroProfile REST client #12087

Open NottyCode opened 4 years ago

NottyCode commented 4 years ago

Describe the bug The Open Liberty website has the following REST client class: https://github.com/OpenLiberty/openliberty.io/blob/master/src/main/java/io/openliberty/website/dheclient/BuildStore.java

It is failing in production with this error:

Stack Dump = java.lang.NoSuchMethodException: java.lang.invoke.MethodHandles.privateLookupIn(java.lang.Class, java.lang.invoke.MethodHandles$Lookup)
    at java.lang.Class.newNoSuchMethodException(Unknown Source)rivateLookup(ClientProxyImpl.java:243)
    at org.apache.cxf.jaxrs.client.ClientProxyImpl.access$000(ClientProxyImpl.java:102)
    at org.apache.cxf.jaxrs.client.ClientProxyImpl$1.run(ClientProxyImpl.java:218)
    at java.security.AccessController.doPrivileged(Unknown Source)
    at org.apache.cxf.jaxrs.client.ClientProxyImpl.invokeDefaultMethod(ClientProxyImpl.java:184)
    at org.apache.cxf.jaxrs.client.ClientProxyImpl.invoke(ClientProxyImpl.java:277)
    at org.apache.cxf.microprofile.client.proxy.MicroProfileClientProxyImpl.invokeActual(MicroProfileClientProxyImpl.java:463)
    at org.apache.cxf.microprofile.client.proxy.MicroProfileClientProxyImpl.access$000(MicroProfileClientProxyImpl.java:76)
    at org.apache.cxf.microprofile.client.proxy.MicroProfileClientProxyImpl.invoke(MicroProfileClientProxyImpl.java:458)
    at org.apache.cxf.microprofile.client.proxy.MicroProfileClientProxyImpl.invoke(MicroProfileClientProxyImpl.java:458)
    at com.sun.proxy.$Proxy50.getBuildListInfo(Unknown Source)
    at io.openliberty.website.dheclient.DHEBuildParser$RetrieveBuildList.run

Java version is:

java.version = 1.8.0_241
java.runtime = Java(TM) SE Runtime Environment (8.0.6.7 - pxa6480sr6fp7-20200312_01(SR6 FP7) Small Footprint)

This is running in IBM Cloud - Cloud Foundry.

Liberty version is 20.0.0.3.

This is an intermittent issue, it doesn't happen every time.

Steps to Reproduce Steps to reproduce the bug

Expected behavior A clear and concise description of what you expected to happen.

Diagnostic information:

Additional context Add any other context about the problem here.

andymc12 commented 4 years ago

Strange that it is intermittent... I've seen something similar to this with the IBM JDK 8. This is dealing with the invocation of default interface methods on the dynamic proxy instance. In Java SE 9, there is a new MethodHandles.Lookup method called privateLookupIn that can access default interface methods. In Java SE 8, it is not possible to invoke default interface methods on a proxy object reflectively without using internal JDK methods. My guess is that the IBM JDK changed their internal JDK method somewhat which is throwing this code off.

Reference for the failing code: https://github.com/OpenLiberty/open-liberty/blob/0ae641f7e0d0bf858635d78c9589877ae6c96b8b/dev/com.ibm.ws.org.apache.cxf.cxf.rt.rs.client.3.2/src/org/apache/cxf/jaxrs/client/ClientProxyImpl.java#L193