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 <[email protected]> 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 = 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 <[email protected]> > 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 <[email protected]> >> 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 <[email protected] >>> > 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 <[email protected]> >>>> wrote: >>>> >>>>> i did try adding a sleep and got the same result >>>>> cache.start(); >>>>> Thread.sleep(5000); >>>>> 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 < >>>>> [email protected]> 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 <[email protected]> >>>>>> wrote: >>>>>> >>>>>>> sure >>>>>>> >>>>>>> main class >>>>>>> RetryPolicy retryPolicy = new ExponentialBackoffRetry(1000, 3); >>>>>>> client = CuratorFrameworkFactory.newClient("10.x.x.x", >>>>>>> retryPolicy); >>>>>>> client.start(); >>>>>>> SyncData sd = new SyncData(client); >>>>>>> sd.run(); >>>>>>> >>>>>>> the class that calls cache >>>>>>> >>>>>>> private static final String PATH = "/zktest"; >>>>>>> >>>>>>> public void run () throws Exception >>>>>>> { >>>>>>> try { >>>>>>> >>>>>>> cache = new PathChildrenCache(client, PATH, true); >>>>>>> cache.start(); >>>>>>> >>>>>>> list(cache); >>>>>>> >>>>>>> >>>>>>> for(;;) { >>>>>>> try { >>>>>>> Thread.sleep(50000); >>>>>>> } catch(InterruptedException e) { >>>>>>> } >>>>>>> } >>>>>>> >>>>>>> } >>>>>>> finally { >>>>>>> CloseableUtils.closeQuietly(cache); >>>>>>> } >>>>>>> } >>>>>>> >>>>>>> On Wed, Mar 9, 2016 at 1:30 PM, Cameron McKenzie < >>>>>>> [email protected]> 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 <[email protected]> >>>>>>>> wrote: >>>>>>>> >>>>>>>>> >>>>>>>>> ---------- Forwarded message ---------- >>>>>>>>> From: s influxdb <[email protected]> >>>>>>>>> Date: Wed, Mar 9, 2016 at 10:36 AM >>>>>>>>> Subject: Re: curator pathcache >>>>>>>>> To: Jordan Zimmerman <[email protected]> >>>>>>>>> Cc: [email protected] >>>>>>>>> >>>>>>>>> >>>>>>>>> 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() == 0 ) >>>>>>>>> { >>>>>>>>> System.out.println("* empty *"); >>>>>>>>> } >>>>>>>>> else >>>>>>>>> { >>>>>>>>> for ( ChildData data : cache.getCurrentData() ) >>>>>>>>> { >>>>>>>>> System.out.println(data.getPath() + " = " + new >>>>>>>>> String(data.getData())); >>>>>>>>> } >>>>>>>>> } >>>>>>>>> } >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> On Wed, Mar 9, 2016 at 9:44 AM, Jordan Zimmerman < >>>>>>>>> [email protected]> wrote: >>>>>>>>> >>>>>>>>>> Moving this to Curator’s list… >>>>>>>>>> >>>>>>>>>> Where do you get the NPE? Please send the stacktrace. >>>>>>>>>> >>>>>>>>>> -Jordan >>>>>>>>>> >>>>>>>>>> > On Mar 8, 2016, at 8:27 PM, s influxdb <[email protected]> >>>>>>>>>> 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 = 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 = 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() == 0 ) >>>>>>>>>> > { >>>>>>>>>> > System.out.println("* empty *"); >>>>>>>>>> > } >>>>>>>>>> > else >>>>>>>>>> > { >>>>>>>>>> > for ( ChildData data : cache.getCurrentData() ) >>>>>>>>>> > { >>>>>>>>>> > System.out.println(data.getPath() + " = " + >>>>>>>>>> new >>>>>>>>>> > String(data.getData())); >>>>>>>>>> > } >>>>>>>>>> > } >>>>>>>>>> > } >>>>>>>>>> >>>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>> >>>>>>> >>>>>> >>>>> >>>> >>> >> >
