Return-Path: X-Original-To: apmail-curator-user-archive@minotaur.apache.org Delivered-To: apmail-curator-user-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 3CDB719D8C for ; Thu, 10 Mar 2016 02:09:57 +0000 (UTC) Received: (qmail 6445 invoked by uid 500); 10 Mar 2016 02:09:57 -0000 Delivered-To: apmail-curator-user-archive@curator.apache.org Received: (qmail 6406 invoked by uid 500); 10 Mar 2016 02:09:57 -0000 Mailing-List: contact user-help@curator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@curator.apache.org Delivered-To: mailing list user@curator.apache.org Received: (qmail 6396 invoked by uid 99); 10 Mar 2016 02:09:57 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd4-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 10 Mar 2016 02:09:57 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd4-us-west.apache.org (ASF Mail Server at spamd4-us-west.apache.org) with ESMTP id 424C0C0EC3 for ; Thu, 10 Mar 2016 02:09:56 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd4-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 1.28 X-Spam-Level: * X-Spam-Status: No, score=1.28 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, HTML_MESSAGE=2, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01] autolearn=disabled Authentication-Results: spamd4-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=jordanzimmerman-com.20150623.gappssmtp.com Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd4-us-west.apache.org [10.40.0.11]) (amavisd-new, port 10024) with ESMTP id 3t7tTq8Vf93k for ; Thu, 10 Mar 2016 02:09:52 +0000 (UTC) Received: from mail-wm0-f53.google.com (mail-wm0-f53.google.com [74.125.82.53]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTPS id 6D84C5F33D for ; Thu, 10 Mar 2016 02:09:52 +0000 (UTC) Received: by mail-wm0-f53.google.com with SMTP id l68so10174853wml.0 for ; Wed, 09 Mar 2016 18:09:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jordanzimmerman-com.20150623.gappssmtp.com; s=20150623; h=from:message-id:mime-version:subject:date:references:to:in-reply-to; bh=aLqyE34svUjMrHajbL2XMGgXQeZcrMr+ma4x7alNx5k=; b=eVXzeacq/rJi9n2AqRpgeJP4T60u4IgicZKaaDtAv/KATngX6wZKFHwDBW9/kzdFmN 4S2ETazc+kBaks6r98857jGfTS4ixlFlRLqTzxYQMmU9jfwywDWjr3K0gEKBJWC9hjLq zRa+Cc6Q8phKcylUZaRAg+t72pabTg3cScMFC6ZHrp0revrM5di9efsrB7gTaY0FICBh y9njP/CUFkH9RTG7QjJlF236X5IwaLqXyYVlrm0si3booEesmE+FoVU1Xq+V3s+L+sV0 Ppm2U036x4zIDlDFSai76jl1R4yV5+/+yRyt5bzszNMaN+Ya2Uxb1zkmd/Ibl48SHlbS u0hg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:message-id:mime-version:subject:date :references:to:in-reply-to; bh=aLqyE34svUjMrHajbL2XMGgXQeZcrMr+ma4x7alNx5k=; b=ljSmcrLnuKSqg2+O2d+Y1wVjWUH0RhaA+saVdMyQ16UkPucf9zkKoUaILk+l0plvYc szb/IqgjVMZEAZe2D1smb8QBudi5tVOP0CVw3oLWFjh9JXQFpSVdCITuobMH4PXwA0D1 QRwG0dhJwVnVrCIUFhXiNBMHzMos1OexWhTYX2dzkXM6UlfNcO76or82zNzMq76evHZy cXMzJ9YhX8ShkwtWC54Yzg1E/Nk7gUaJR2DAKmLwCfYcMomAgV/XaBVnYbtzKDWVA1dS KeuLPMkDAAlFAoXaXuL/oQQjKbMWE1zIOlvFKoFPPjUwWXPNjSj09royud1zYzjVZp3J iPhQ== X-Gm-Message-State: AD7BkJJ9rbZn9gbPn/WulgGifw36RwNLWXicrDYkyVgF6U1LLzPMjXUD8CCGGYQY0T+8ug== X-Received: by 10.28.217.146 with SMTP id q140mr742119wmg.85.1457575791135; Wed, 09 Mar 2016 18:09:51 -0800 (PST) Received: from [10.0.1.78] ([186.188.195.79]) by smtp.gmail.com with ESMTPSA id up6sm1183817wjc.6.2016.03.09.18.09.49 for (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 09 Mar 2016 18:09:50 -0800 (PST) From: Jordan Zimmerman Content-Type: multipart/alternative; boundary="Apple-Mail=_6197A583-EEAC-4897-A182-B17CF016B8B0" Message-Id: <55164825-C8BF-4087-BD86-93F27EC684F7@jordanzimmerman.com> Mime-Version: 1.0 (Mac OS X Mail 9.2 \(3112\)) Subject: Re: curator pathcache Date: Wed, 9 Mar 2016 21:09:45 -0500 References: <8D219520-B984-48BB-9E66-C55A9D2B3175@jordanzimmerman.com> To: user@curator.apache.org In-Reply-To: X-Mailer: Apple Mail (2.3112) --Apple-Mail=_6197A583-EEAC-4897-A182-B17CF016B8B0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 Post your code along with whatever build scripts you=E2=80=99re using to = Github or something similar and we=E2=80=99ll have a look. Are you using = Maven? Gradle? How are you putting your dependencies together?=20 > On Mar 9, 2016, at 9:04 PM, s influxdb wrote: >=20 > i tried all the curator libraries . still same result . TestingServer = or the PathCache isn't working >=20 > On Wed, Mar 9, 2016 at 5:22 PM, s influxdb > wrote: > Ok let me try that.=20 >=20 > On another note this piece of nodecache code works >=20 > final NodeCache nodeCache =3D new NodeCache(client, PATH); > nodeCache.getListenable().addListener(new = NodeCacheListener() { > @Override > public void nodeChanged() throws Exception { > ChildData currentData =3D = nodeCache.getCurrentData(); > System.out.println("data change watched, and = current data =3D " + new String(currentData.getData())); > } > }); > nodeCache.start(); > Thread.sleep(50000); >=20 > On Wed, Mar 9, 2016 at 5:20 PM, Cameron McKenzie = > wrote: > You must have some old Curator stuff on your classpath. All of the = curator stuff has an org.apache package prefix. It was ported from = Netflix some time ago. >=20 > On Thu, Mar 10, 2016 at 12:15 PM, s influxdb > wrote: > I see the TestingServer class in import = com.netflix.curator.test.TestingServer; >=20 > In the sample file i see it as import = org.apache.curator.test.TestingServer; >=20 > Even then i get the below error while instantiating a TestingServer = Class > Default constructor cannot handle exception type Exception thrown by = implicit super constructor. Must define an explicit constructor >=20 > Then i tried the TestingCluster class > static TestingCluster server =3D new TestingCluster(); >=20 > That gives me a class not found exception > Exception in thread "main" java.lang.NoClassDefFoundError: = javassist/NotFoundException > at = com.netflix.curator.test.TestingCluster.(TestingCluster.java:40) >=20 >=20 > On Wed, Mar 9, 2016 at 4:16 PM, Cameron McKenzie = > wrote: > The TestingServer class is definitely in the curator-test jar, so you = must have some issue with your build / IDE environment. >=20 > On Thu, Mar 10, 2016 at 11:13 AM, s influxdb > wrote: > I tried importing the curator-test artifcactid and it this import = org.apache.curator.test.TestingServer; doesn't resolve >=20 > On Wed, Mar 9, 2016 at 2:58 PM, Cameron McKenzie = > wrote: > Can you try running the PathCacheExample unmodified? It uses a testing = ZK server. But can you just confirm that this much works for you? Then = maybe try and modify the sample so that it connects to your real ZK = instance? >=20 > On Thu, Mar 10, 2016 at 9:53 AM, s influxdb > wrote: > i did try adding a sleep and got the same result > cache.start(); > Thread.sleep(5000); > list(cache); >=20 > I am using curator libraries version 2.10 and zookeeper version 3..4.6 >=20 > On Wed, Mar 9, 2016 at 2:19 PM, Cameron McKenzie = > wrote: > I think that you have a race condition between calling start() on your = cache and calling list(). Calling list() just checks the current state = of the cache. If it hasn't communicated with ZK yet, it won't have any = data. Try putting in a sleep after the cache.start() call, before you = call list(). >=20 > On Thu, Mar 10, 2016 at 9:16 AM, s influxdb > wrote: > sure=20 >=20 > main class > RetryPolicy retryPolicy =3D new ExponentialBackoffRetry(1000, 3); > client =3D CuratorFrameworkFactory.newClient("10.x.x.x", = retryPolicy); > client.start(); > SyncData sd =3D new SyncData(client); > sd.run(); > =20 > the class that calls cache >=20 > private static final String PATH =3D "/zktest"; >=20 > public void run () throws Exception=20 > { > try { > =20 > cache =3D new PathChildrenCache(client, PATH, true); > cache.start(); >=20 > list(cache); > =20 > =20 > for(;;) { > try { > Thread.sleep(50000); > } catch(InterruptedException e) { > } > } > =20 > } > finally { > CloseableUtils.closeQuietly(cache); > } > } >=20 > On Wed, Mar 9, 2016 at 1:30 PM, Cameron McKenzie = > wrote: > I just tried running the example and it seems to work fine for me. I = assume that you modified the code in some way for it to run against a = proper ZK instance? Can you post it somewhere? >=20 > On Thu, Mar 10, 2016 at 5:53 AM, s influxdb > wrote: >=20 > ---------- Forwarded message ---------- > From: s influxdb > > Date: Wed, Mar 9, 2016 at 10:36 AM > Subject: Re: curator pathcache > To: Jordan Zimmerman > > Cc: user@curator.apache.org >=20 >=20 > Sorry for posting this in a wrong forum the first time. >=20 > I recreated a new project and was running the example code here for = cache : http://curator.apache.org/curator-examples/index.html = >=20 >=20 > Today when i try to replicathe NPE i am unable to do that .=20 > However when i call the list(cache) it prints the size of the data in = the node as 0. This works with NodeCache >=20 > Curator libraries are 2.10 and zookeeper version 3.4.6. >=20 > Ideally i would like to use TreeCache but it gave me NPE too. My use = case is setting a watch on the entire znode in the cluster and be = notified about it. Thanks for replying to the mail. >=20 > private static void list(PathChildrenCache cache) > { > if ( cache.getCurrentData().size() =3D=3D 0 ) > { > System.out.println("* empty *"); > } > else > { > for ( ChildData data : cache.getCurrentData() ) > { > System.out.println(data.getPath() + " =3D " + new = String(data.getData())); > } > } > } > =20 >=20 >=20 >=20 > On Wed, Mar 9, 2016 at 9:44 AM, Jordan Zimmerman = > wrote: > Moving this to Curator=E2=80=99s list=E2=80=A6 >=20 > Where do you get the NPE? Please send the stacktrace. >=20 > -Jordan >=20 > > On Mar 8, 2016, at 8:27 PM, s influxdb > wrote: > > > > I am trying to run the path cahce and keep java NPE > > > > Running curator 2.9.0 libraries against a zookeeper 3.4.6 cluster > > Even > > > > The samples are taken from the curator examples . > > > > > > > > public void run () throws Exception > > { > > try { > > > > pcache =3D new PathChildrenCache(client, PATH, true); > > pcache.start(); > > > > addListener(cache); > > > > // list(pcache); > > > > pcache.close(); > > } > > finally { > > CloseableUtils.closeQuietly(cache); > > } > > } > > > > > > private static void addListener(PathChildrenCache cache) > > { > > // a PathChildrenCacheListener is optional. Here, it's used = just > > to log changes > > PathChildrenCacheListener listener =3D new > > PathChildrenCacheListener() > > { > > @Override > > public void childEvent(CuratorFramework client, > > PathChildrenCacheEvent event) throws Exception > > { > > switch ( event.getType() ) > > { > > case CHILD_ADDED: > > { > > System.out.println("Node added: " + > > ZKPaths.getNodeFromPath(event.getData().getPath())); > > break; > > } > > > > case CHILD_UPDATED: > > { > > System.out.println("Node changed: " + > > ZKPaths.getNodeFromPath(event.getData().getPath())); > > break; > > } > > > > case CHILD_REMOVED: > > { > > System.out.println("Node removed: " + > > ZKPaths.getNodeFromPath(event.getData().getPath())); > > break; > > } > > } > > } > > }; > > cache.getListenable().addListener(listener); > > } > > > > > > Here running a list returns empty size all the time > > > > private static void list(PathChildrenCache cache) > > { > > > > if ( cache.getCurrentData().size() =3D=3D 0 ) > > { > > System.out.println("* empty *"); > > } > > else > > { > > for ( ChildData data : cache.getCurrentData() ) > > { > > System.out.println(data.getPath() + " =3D " + new > > String(data.getData())); > > } > > } > > } >=20 >=20 >=20 >=20 >=20 >=20 >=20 >=20 >=20 >=20 >=20 >=20 >=20 >=20 --Apple-Mail=_6197A583-EEAC-4897-A182-B17CF016B8B0 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8
Post your code along with whatever build = scripts you=E2=80=99re using to Github or something similar and we=E2=80=99= ll have a look. Are you using Maven? Gradle? How are you putting your = dependencies together? 

On Mar 9, 2016, at 9:04 PM, s = influxdb <elastic.l.k@gmail.com> wrote:

i tried all the curator libraries . still same result . = TestingServer or the PathCache isn't working

On Wed, = Mar 9, 2016 at 5:22 PM, s influxdb <elastic.l.k@gmail.com> wrote:
Ok let me try that.

On another note this piece of nodecache code works

            = final NodeCache nodeCache =3D new NodeCache(client, PATH);
        =         = nodeCache.getListenable().addListener(new NodeCacheListener() {
        =             = @Override
        =             = public void nodeChanged() throws Exception {
        =             &n= bsp;   ChildData currentData =3D = nodeCache.getCurrentData();
    =     =             &n= bsp;   System.out.println("data change watched, and current = data =3D " + new String(currentData.getData()));
        =             }
        =         });
        =         nodeCache.start();
        =         Thread.sleep(50000);

On Wed, = Mar 9, 2016 at 5:20 PM, Cameron McKenzie <mckenzie.cam@gmail.com> wrote:
You must have some old Curator stuff on your classpath. All = of the curator stuff has an org.apache package prefix. It was ported = from Netflix some time ago.

On Thu, = Mar 10, 2016 at 12:15 PM, s influxdb <elastic.l.k@gmail.com> wrote:
I see the TestingServer class = in  import com.netflix.curator.test.TestingServer;

In the sample file i see it as import = org.apache.curator.test.TestingServer;

Even then i get the below error while instantiating a = TestingServer Class
Default = constructor cannot handle exception type Exception thrown by implicit = super constructor. Must define an explicit constructor

Then i tried the TestingCluster = class
static = TestingCluster       server =3D new = TestingCluster();

That = gives me a class not found exception
Exception in thread = "main" java.lang.NoClassDefFoundError: javassist/NotFoundException
    at = com.netflix.curator.test.TestingCluster.<clinit>(TestingCluster.java= :40)


On Wed, = Mar 9, 2016 at 4:16 PM, Cameron McKenzie <mckenzie.cam@gmail.com> wrote:
The TestingServer class is definitely in the curator-test = jar, so you must have some issue with your build / IDE = environment.

On Thu, = Mar 10, 2016 at 11:13 AM, s influxdb <elastic.l.k@gmail.com> wrote:
I tried importing the curator-test artifcactid and it this = import org.apache.curator.test.TestingServer; doesn't resolve

On Wed, = Mar 9, 2016 at 2:58 PM, Cameron McKenzie <mckenzie.cam@gmail.com> wrote:
Can you try running the PathCacheExample unmodified? It uses = a testing ZK server. But can you just confirm that this much works for = you? Then maybe try and modify the sample so that it connects to your = real ZK instance?

On Thu, = Mar 10, 2016 at 9:53 AM, s influxdb <elastic.l.k@gmail.com> wrote:
i did try adding a sleep and got the same = result
     cache.start();
          &nb= sp; Thread.sleep(5000);
          &nb= sp; list(cache);

I am using curator = libraries version 2.10 and zookeeper version 3..4.6

On Wed, = Mar 9, 2016 at 2:19 PM, Cameron McKenzie <mckenzie.cam@gmail.com> wrote:
I think that you have a race condition between calling = start() on your cache and calling list(). Calling list() just checks the = current state of the cache. If it hasn't communicated with ZK yet, it = won't have any data. Try putting in a sleep after the cache.start() = call, before you call list().

On Thu, = Mar 10, 2016 at 9:16 AM, s influxdb <elastic.l.k@gmail.com> wrote:
sure

main class
    RetryPolicy = retryPolicy =3D new ExponentialBackoffRetry(1000, 3);
            = client =3D CuratorFrameworkFactory.newClient("10.x.x.x", = retryPolicy);
        =     client.start();
    =         SyncData sd =3D new = SyncData(client);
        =     sd.run();
    =        
the class = that calls cache

private static final = String PATH =3D "/zktest";

    public void run () throws Exception
       {
        try {
           =    
          &nb= sp; cache =3D new PathChildrenCache(client, PATH, true);
         &n= bsp;  cache.start();

          &nb= sp; list(cache);
    =             =    
    =            
    =             = for(;;) {
    =             &n= bsp;   try {
    =             &n= bsp;       Thread.sleep(50000);
    =             &n= bsp;   } catch(InterruptedException e) {
    =             &n= bsp;   }
    =             }
           =    
        =     }
       =       finally {
    =             = CloseableUtils.closeQuietly(cache);
    =          }
    =     }

On Wed, Mar 9, 2016 at 1:30 PM, Cameron McKenzie = <mckenzie.cam@gmail.com> = wrote:
I just tried running the example and it seems to work fine = for me. I assume that you modified the code in some way for it to run = against a proper ZK instance? Can you post it somewhere?

On Thu, Mar 10, 2016 at 5:53 AM, s influxdb <elastic.l.k@gmail.com> = wrote:

---------- = Forwarded message ----------
From: s influxdb <elastic.l.k@gmail.com>
Date: Wed, = Mar 9, 2016 at 10:36 AM
Subject: Re: curator pathcache
To: Jordan Zimmerman <jordan@jordanzimmerman.com>
Cc: user@curator.apache.org


Sorry for posting this in a = wrong forum the first time.

I = recreated a new project and was running the example code here for cache = : http://curator.apache.org/curator-examples/index.html


Today when i  try to = replicathe NPE i am unable to do that .
However when i = call the  list(cache) it prints the size of the data in the node as = 0. This works with NodeCache

Curator = libraries are 2.10 and zookeeper version 3.4.6.

Ideally i would like to use TreeCache but it gave me = NPE too. My use case is setting a watch on the entire znode in the = cluster and be notified about it. Thanks for replying to the mail.

    private = static void list(PathChildrenCache cache)
   = {
        if ( = cache.getCurrentData().size() =3D=3D 0 )
        {
          &nb= sp; System.out.println("* empty *");
        }
        else
        {
          &nb= sp; for ( ChildData data : cache.getCurrentData() )
          &nb= sp; {
          &nb= sp;     System.out.println(data.getPath() + " =3D " = + new String(data.getData()));
          &nb= sp; }
        }
    }
      =



On Wed, = Mar 9, 2016 at 9:44 AM, Jordan Zimmerman <jordan@jordanzimmerman.com> = wrote:
Moving this to = Curator=E2=80=99s list=E2=80=A6

Where do you get the NPE? Please send the stacktrace.

-Jordan

> On Mar 8, 2016, at 8:27 PM, s influxdb <elastic.l.k@gmail.com> wrote:
>
> I am trying to run the path cahce and keep java NPE
>
> Running curator 2.9.0 libraries against a zookeeper 3.4.6 = cluster
> Even
>
> The samples are taken from the curator examples .
>
>
>
>  public void run () throws Exception
>       {
>             try {
>
>                pcache =3D = new PathChildrenCache(client, PATH, true);
>             pcache.start();
>
>                = addListener(cache);
>
>           //    = list(pcache);
>
>              =  pcache.close();
>            }
>             finally {
>                = CloseableUtils.closeQuietly(cache);
>             }
>        }
>
>
>      private static void = addListener(PathChildrenCache cache)
>      {
>          // a PathChildrenCacheListener is = optional. Here, it's used just
> to log changes
>          PathChildrenCacheListener = listener =3D new
> PathChildrenCacheListener()
>          {
>              @Override
>              public void = childEvent(CuratorFramework client,
> PathChildrenCacheEvent event) throws Exception
>              {
>                  = switch ( event.getType() )
>                  {
>                  =     case CHILD_ADDED:
>                  =     {
>                  =         System.out.println("Node added: " +
> ZKPaths.getNodeFromPath(event.getData().getPath()));
>                  =         break;
>                  =     }
>
>                  =     case CHILD_UPDATED:
>                  =     {
>                  =         System.out.println("Node changed: " +
> ZKPaths.getNodeFromPath(event.getData().getPath()));
>                  =         break;
>                  =     }
>
>                  =     case CHILD_REMOVED:
>                  =     {
>                  =         System.out.println("Node removed: " +
> ZKPaths.getNodeFromPath(event.getData().getPath()));
>                  =         break;
>                  =     }
>                  }
>              }
>          };
>          = cache.getListenable().addListener(listener);
>      }
>
>
> Here running a list returns empty size all the time
>
>      private static void list(PathChildrenCache = cache)
>        {
>
>            if ( = cache.getCurrentData().size() =3D=3D 0 )
>            {
>                = System.out.println("* empty *");
>            }
>            else
>            {
>                for ( = ChildData data : cache.getCurrentData() )
>                {
>                  =   System.out.println(data.getPath() + " =3D " + new
> String(data.getData()));
>                }
>            }
>        }















= --Apple-Mail=_6197A583-EEAC-4897-A182-B17CF016B8B0--