Boris Dainson created CURATOR-488:
-------------------------------------

             Summary: NoSuchMethodError calling client close() in 3.4 
compatibility mode 
                 Key: CURATOR-488
                 URL: https://issues.apache.org/jira/browse/CURATOR-488
             Project: Apache Curator
          Issue Type: Bug
          Components: Client
    Affects Versions: TBD
         Environment: Windows 7 x64
            Reporter: Boris Dainson
         Attachments: pom.xml

Affected version is 4.0.2-SNAPSHOT. Version 4.0.1 is not affected

When closing client it is calling zooKeeper.close(waitForShutdownTimeoutMs) 
This method is only supported starting from ZK 3.5. So when running in 
compatibility mode with ZK 3.4.x it throws NoSuchMethodError.  So for ZK 3.4.x 
need to use  zooKeeper.close() with no arguments. 

 

To reproduce:

Start ZK 3.4 server locally. 

In pom.xml add dependency on zookeeper 3.4.13 and exclude default dependency 
(on 3.5). Full pom.xml is attached. 

 

Run this code snippet: 

public class CloseTest {
   public static void main(String[] args) throws Exception

{     CuratorFramework client = 
CuratorFrameworkFactory.newClient("localhost:2181", new  
ExponentialBackoffRetry(1000, 3));     client.start();     client.close();   }

}

 

It will throw exception: 

Exception in thread "main" java.lang.NoSuchMethodError: 
org.apache.zookeeper.ZooKeeper.close(I)Z
 at org.apache.curator.HandleHolder.internalClose(HandleHolder.java:158)
 at org.apache.curator.HandleHolder.closeAndClear(HandleHolder.java:78)
 at org.apache.curator.ConnectionState.close(ConnectionState.java:125)
 at 
org.apache.curator.CuratorZookeeperClient.close(CuratorZookeeperClient.java:266)
 at 
org.apache.curator.CuratorZookeeperClient.close(CuratorZookeeperClient.java:249)
 at 
org.apache.curator.framework.imps.CuratorFrameworkImpl.close(CuratorFrameworkImpl.java:388)
 at leader.CloseTest.main(CloseTest.java:11)



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

Reply via email to