John Blum created GEODE-6155:
--------------------------------

             Summary: When JSONAssert is on the CLASSPATH of a Geode Server, 
Gfsh `list members` will throw a NoSuchMethodError
                 Key: GEODE-6155
                 URL: https://issues.apache.org/jira/browse/GEODE-6155
             Project: Geode
          Issue Type: Bug
            Reporter: John Blum


If use the Geode API to configure and bootstrap a Geode Server (along with an 
embedded Locator and Manager) from my IDE and happen to have the 
{{org.skyscreamer:jsonassert}} dependency on my CLASSPATH, then upon connecting 
to this server in _Gfsh_ and performing `{{list members}}`, I encounter a 
{{NoSuchMethodError}}:

{code:java}
$ gfsh
    _________________________     __
   / _____/ ______/ ______/ /____/ /
  / /  __/ /___  /_____  / _____  / 
 / /__/ / ____/  _____/ / /    / /  
/______/_/      /______/_/    /_/    1.6.0

Monitor and Manage Apache Geode

gfsh>connect
Connecting to Locator at [host=localhost, port=10334] ..
Connecting to Manager at [host=10.118.19.28, port=1099] ..
Successfully connected to: [host=10.118.19.28, port=1099]


gfsh>list members
Exception in thread "Gfsh Launcher" java.lang.NoSuchMethodError: 
org.json.JSONObject.<init>(Ljava/lang/Object;)V
        at 
org.apache.geode.management.internal.cli.json.GfJsonObject.<init>(GfJsonObject.java:71)
        at 
org.apache.geode.management.internal.cli.CommandResponseBuilder.getCommandResponseJson(CommandResponseBuilder.java:51)
        at 
org.apache.geode.management.internal.cli.CommandResponseBuilder.createCommandResponseJson(CommandResponseBuilder.java:55)
        at 
org.apache.geode.management.internal.beans.MemberMBeanBridge.processCommand(MemberMBeanBridge.java:1515)
        at 
org.apache.geode.management.internal.beans.MemberMBean.processCommand(MemberMBean.java:417)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at sun.reflect.misc.Trampoline.invoke(MethodUtil.java:71)
        at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at sun.reflect.misc.MethodUtil.invoke(MethodUtil.java:275)
        at 
com.sun.jmx.mbeanserver.ConvertingMethod.invokeWithOpenReturn(ConvertingMethod.java:193)
        at 
com.sun.jmx.mbeanserver.ConvertingMethod.invokeWithOpenReturn(ConvertingMethod.java:175)
        at 
com.sun.jmx.mbeanserver.MXBeanIntrospector.invokeM2(MXBeanIntrospector.java:117)
        at 
com.sun.jmx.mbeanserver.MXBeanIntrospector.invokeM2(MXBeanIntrospector.java:54)
        at 
com.sun.jmx.mbeanserver.MBeanIntrospector.invokeM(MBeanIntrospector.java:237)
        at com.sun.jmx.mbeanserver.PerInterface.invoke(PerInterface.java:138)
        at com.sun.jmx.mbeanserver.MBeanSupport.invoke(MBeanSupport.java:252)
        at 
com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819)
        at 
com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801)
        at 
javax.management.remote.rmi.RMIConnectionImpl.doOperation(RMIConnectionImpl.java:1468)
        at 
javax.management.remote.rmi.RMIConnectionImpl.access$300(RMIConnectionImpl.java:76)
        at 
javax.management.remote.rmi.RMIConnectionImpl$PrivilegedOperation.run(RMIConnectionImpl.java:1309)
        at 
javax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation(RMIConnectionImpl.java:1401)
        at 
javax.management.remote.rmi.RMIConnectionImpl.invoke(RMIConnectionImpl.java:829)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:357)
        at sun.rmi.transport.Transport$1.run(Transport.java:200)
        at sun.rmi.transport.Transport$1.run(Transport.java:197)
        at java.security.AccessController.doPrivileged(Native Method)
        at sun.rmi.transport.Transport.serviceCall(Transport.java:196)
        at 
sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:573)
        at 
sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:834)
        at 
sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:688)
        at java.security.AccessController.doPrivileged(Native Method)
        at 
sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:687)
        at 
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at java.lang.Thread.run(Thread.java:748)
Exception in thread "main" java.lang.NullPointerException
        at 
org.apache.geode.management.internal.cli.Launcher.parseOptions(Launcher.java:242)
        at 
org.apache.geode.management.internal.cli.Launcher.parseCommandLine(Launcher.java:250)
        at 
org.apache.geode.management.internal.cli.Launcher.main(Launcher.java:135)

{code}

The problem ends up being that both 
[JSONassert|https://github.com/skyscreamer/JSONassert] and *Apache Geode* make 
use of incompatible versions of the Android JSON API under-the-hood.  Apache 
Geode uses [Open JSON|https://github.com/tdunning/open-json] while JSONassert 
uses [Vaadin's Android JSON 
API|https://github.com/skyscreamer/JSONassert/blob/master/pom.xml#L52-L56], 
both of which were derived from the source, Google Android JSON API.

So, because Apache Geode [imports and maintains this API as part of its own 
source|https://github.com/apache/geode/tree/rel/v1.7.0/geode-json/src/main/java/org/json],
 this incompatibility is likely to happen since JSONassert is a popular API to 
test REST-based Web Services.

The ideal solution in this case would be to complete replace Open JSON with 
Jackson as a dependency.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to