Hi, Rukshan, I guess the easiest way is to just call ClientConfiguration.loadDefault(), which will look for a client.conf file in a bunch of places on the local filesystem. Otherwise, you can set the properties explicitly like,
ClientConfiguration cc = new ClientConfiguration() cc.setProperty(ClientConfiguration.ClientProperty.INSTANCE_ZK_HOST, "localhost:2181") cc.setProperty(ClientConfiguration.ClientProperty.INSTANCE_NAME, "accumulo") ... and so on... On Wed, Jul 15, 2015 at 9:56 AM Rukshan Chathuranga <[email protected]> wrote: > Hi Russ, > > Thanks for the quick response. can you give me sample to create > clientConf? > > Thanks and Regards. > > > *Rukshan Chathuranga.* > > *Department Of Computer Science & Engineering,* > > *Faculty Of Engineering,* > *University Of Moratuwa. **Sri Lanka.* > > *WEB: http://www.rukspot.com/ <http://rukspot.com/>* > > > On Wed, Jul 15, 2015 at 10:10 PM, Russ Weeks <[email protected]> > wrote: > >> Hi, Rukshan, >> >> Are you sure you want to use an AccumuloServerContext? I think a >> ClientContext might be better: >> >> ClientConfiguration clientConf = [...wherever your client configuration >> comes from] >> Instance accInstance = [... your ZooKeeperInstance] >> ClientContext ctx = new ClientContext(accInstance, new >> Credentials(username, new PasswordToken(password), clientConf); >> TabletLocator tl = TabletLocator.getLocator(ctx, new Text(tableId)); // >> NOT table name! >> >> Note that TabletLocator, CientContext, Credentals and KeyExtent are not >> part of the public API. >> >> -Russ >> >> On Wed, Jul 15, 2015 at 9:31 AM Rukshan Chathuranga < >> [email protected]> wrote: >> >>> Hi, >>> >>> i used following code sample, >>> >>> AccumuloServerContext context = new AccumuloServerContext( new >>> ServerConfigurationFactory(conn.getInstance())); >>> TabletLocator.getLocator(context, tableId).locateTablet(context,row, >>> false, false); >>> >>> But it give error as follow. >>> >>> org.apache.accumulo.core.client.AccumuloSecurityException: Error >>> BAD_CREDENTIALS for user !SYSTEM - Username or Password is Invalid >>> at >>> org.apache.accumulo.core.client.impl.ThriftScanner.getBatchFromServer(ThriftScanner.java:121) >>> at >>> org.apache.accumulo.core.metadata.MetadataLocationObtainer.lookupTablet(MetadataLocationObtainer.java:95) >>> at >>> org.apache.accumulo.core.client.impl.TabletLocatorImpl.lookupTabletLocation(TabletLocatorImpl.java:463) >>> at >>> org.apache.accumulo.core.client.impl.TabletLocatorImpl.lookupTabletLocationAndCheckLock(TabletLocatorImpl.java:634) >>> at >>> org.apache.accumulo.core.client.impl.TabletLocatorImpl._locateTablet(TabletLocatorImpl.java:620) >>> at >>> org.apache.accumulo.core.client.impl.TabletLocatorImpl.locateTablet(TabletLocatorImpl.java:439) >>> at >>> mil.nga.giat.geowave.service.healthimpl.GeospatialExtent.getSplits(GeospatialExtent.java:112) >>> at >>> mil.nga.giat.geowave.service.healthimpl.GeospatialExtent.main(GeospatialExtent.java:42) >>> Caused by: ThriftSecurityException(user:!SYSTEM, code:BAD_CREDENTIALS) >>> at >>> org.apache.accumulo.core.tabletserver.thrift.TabletClientService$startScan_result$startScan_resultStandardScheme.read(TabletClientService.java:6696) >>> at >>> org.apache.accumulo.core.tabletserver.thrift.TabletClientService$startScan_result$startScan_resultStandardScheme.read(TabletClientService.java:6673) >>> at >>> org.apache.accumulo.core.tabletserver.thrift.TabletClientService$startScan_result.read(TabletClientService.java:6596) >>> at org.apache.thrift.TServiceClient.receiveBase(TServiceClient.java:78) >>> at >>> org.apache.accumulo.core.tabletserver.thrift.TabletClientService$Client.recv_startScan(TabletClientService.java:232) >>> at >>> org.apache.accumulo.core.tabletserver.thrift.TabletClientService$Client.startScan(TabletClientService.java:208) >>> at >>> org.apache.accumulo.core.client.impl.ThriftScanner.getBatchFromServer(ThriftScanner.java:98) >>> ... 7 more >>> >>> >>> Does any one know how to fix this? >>> >>> Thanks and Regards. >>> >>> *Rukshan Chathuranga.* >>> >>> *Department Of Computer Science & Engineering,* >>> >>> *Faculty Of Engineering,* >>> *University Of Moratuwa. **Sri Lanka.* >>> >>> *WEB: http://www.rukspot.com/ <http://rukspot.com/>* >>> >>> >
