2016-03-01 14 views
11

oluşturmak deneniyor ve ben girişimi nasıl olursa olsun her zaman birApache Küratör Uygulanmayan Hataları Ben dockerized Yaupon örneğiyle Apache Küratör kullanmak çalışılıyor zNodes

org.apache.zookeeper.KeeperException$UnimplementedException: KeeperErrorCode = Unimplemented for...

hata ile sona bağlamak için zaman. Belgeleri anlamayı denedim ama hiçbir yere gitmiyorum. Ben Yaupon CLI giriş yapmış ve doğru thusly olan port numarasını sağladık: Ben söyleyebilirim kadarıyla

public class App { 
    public static void main(String[] args) { 
     CuratorFramework client = CuratorFrameworkFactory.newClient("0.0.0.0:32770", new RetryUntilElapsed(3000, 1000)); 
     client.start(); 

      try { 
       client.create().forPath("/larry-smells/foop", "tuna?".getBytes()); 
      } catch (Exception e) { 
       System.out.println(e.toString()); 
      } 

    } 
} 

: Burada

[email protected]:~$ docker ps CONTAINER ID  IMAGE    COMMAND    CREATED    STATUS    PORTS NAMES 31f1093495ba  compose_zookeeper "/opt/zookeeper/bin/ 3 weeks ago   Up About a minute 0.0.0.0:32770->2181/tcp, 
0.0.0.0:32769->2888/tcp, 0.0.0.0:32768->3888/tcp zookeeper 

ben kullanmaya çalışıyorum kodudur Curator getting started page, bu işe yaramalı. Neyi kaçırıyorum?

edit1 Sadece thusly Yaupon topluluk dışarı veri çekmek mümkün olduğumu anladım:

System.out.println(new String(curatorFramework.getData().forPath("/larry-smells"))); 

ama oluşturmak komut hala esiyor. Hatanın

edit2

StackTrace:

org.apache.zookeeper.KeeperException$UnimplementedException: KeeperErrorCode = Unimplemented for /larry-smells/foop at org.apache.zookeeper.KeeperException.create(KeeperException.java:103) at org.apache.zookeeper.KeeperException.create(KeeperException.java:51) at org.apache.zookeeper.ZooKeeper.create(ZooKeeper.java:1297) at org.apache.curator.framework.imps.CreateBuilderImpl$17.call(CreateBuilderImpl.java:1040) at org.apache.curator.framework.imps.CreateBuilderImpl$17.call(CreateBuilderImpl.java:1023) at org.apache.curator.connection.StandardConnectionHandlingPolicy.callWithRetry(StandardConnectionHandlingPolicy.java:67) at org.apache.curator.RetryLoop.callWithRetry(RetryLoop.java:99) at org.apache.curator.framework.imps.CreateBuilderImpl.pathInForeground(CreateBuilderImpl.java:1020) at org.apache.curator.framework.imps.CreateBuilderImpl.protectedPathInForeground(CreateBuilderImpl.java:501) at org.apache.curator.framework.imps.CreateBuilderImpl.forPath(CreateBuilderImpl.java:491) at org.apache.curator.framework.imps.CreateBuilderImpl$4.forPath(CreateBuilderImpl.java:367) at org.apache.curator.framework.imps.CreateBuilderImpl$4.forPath(CreateBuilderImpl.java:309) at com.mycompany.app.App.main(App.java:35)

cevap

27

Düzenleme: Eğer Zookeeper ile birlikte Küratör yanlış kombinasyonunu kullanarak eğer Görünüşe göre bu hata oluşabilir. curator.apache.org Gönderen:

Curator 2.x.x - compatible with both ZooKeeper 3.4.x and ZooKeeper 3.5.x

Curator 3.x.x - compatible only with ZooKeeper 3.5.x and includes support for new features such as dynamic reconfiguration, etc.


Sadece o hata kodu ve bir yığın izleme ile sorunu saptamak zordur, ancak bazı improvments senin Aplikasyon daha kararlı hale getirmek için öneririm geçerli:

public class App { 
    public static void main(String[] args) { 
     CuratorFramework client = CuratorFrameworkFactory.newClient("0.0.0.0:32770", new RetryUntilElapsed(3000, 1000)); 
     client.start(); 

     try { 
      //make sure you're connected to zookeeper. 
      client.blockUntilConnected(); 

      //Make sure the parants are created. 
      client.create().creatingParentsIfNeeded().forPath("/larry-smells/foop", "tuna?".getBytes()); 
     } catch (Exception e) { 
      System.out.println(e.toString()); 
      } 

    } 
} 
+0

önerdiğiniz değişikliği yapılmış ve aynı sonucu aldık. Ayrıca yığın izini soru metnine ekledim. –

+0

doots - bir dink olduğumu ortaya çıkıyor. Bu konu, küratörün ana sayfasının alt kısmında, sadece <3.5.x zookeeper sürümleri olan v2 kullanımıyla ilgili bir uyarıda açıkça belirtilmiştir. Temel olarak RTFM'ye başarısız oldum. Eğer bir cevap şeklinde koyarsanız bunu kabul edeceğim en azından sorunlarınız için bir miktar kredi alacaksınız :-) –

0

Sorun, uyumsuzluktan kaynaklanır.
https://curator.apache.org/zk-compatibility.html

bu işe yaramazsa sadece (a 3.4.x Yaupon sürümüne bağlıdır en yeni küratörü sürümü arayın: burada anlatılmış gibi

Bunu düzeltmek için, sürüm değiştirmeniz gerekir şu anda '2.12.0').

0

@Massimo Da Ros çözüm çalışır, ancak yeni sürümü Küratör 4.0.0 inTransaction o transaction yöntemi, aşağıdaki gibi kullanılmasını recommented oluyor itiraz edildi:

CuratorOp op = client.transactionOp().create() 
      .withMode(CreateMode.PERSISTENT) 
      .withACL(Ids.OPEN_ACL_UNSAFE) 
      .forPath("/test", "Data".getBytes()); 
result = client.transaction().forOperations(op).get(0).toString();