Fail to open bucket from Java to CB on AWS

Hi,

My CB server is on AWS cloud. I try to open bucket from Java. It worked fine when the CB was on regular Linux machine, but it fails with CB on AWS cloud. Pls help.
Exception below (sensitive info replaced by XXX):

com.couchbase.client.core.config.ConfigurationException: Could not open bucket.
at com.couchbase.client.core.config.DefaultConfigurationProvider$6.call(DefaultConfigurationProvider.java:304)
at com.couchbase.client.core.config.DefaultConfigurationProvider$6.call(DefaultConfigurationProvider.java:301)
at rx.internal.operators.OperatorOnErrorResumeNextViaFunction$4.onError(OperatorOnErrorResumeNextViaFunction.java:140)
at rx.internal.operators.OnSubscribeDoOnEach$DoOnEachSubscriber.onError(OnSubscribeDoOnEach.java:87)
at rx.internal.operators.OnSubscribeDoOnEach$DoOnEachSubscriber.onError(OnSubscribeDoOnEach.java:87)
at rx.internal.operators.OnSubscribeMap$MapSubscriber.onError(OnSubscribeMap.java:88)
at rx.internal.operators.OnSubscribeDoOnEach$DoOnEachSubscriber.onError(OnSubscribeDoOnEach.java:87)
at rx.internal.operators.OperatorTake$1.onError(OperatorTake.java:66)
at rx.internal.operators.OperatorMerge$MergeSubscriber.reportError(OperatorMerge.java:266)
at rx.internal.operators.OperatorMerge$MergeSubscriber.emitLoop(OperatorMerge.java:658)
at rx.internal.operators.OperatorMerge$MergeSubscriber.emit(OperatorMerge.java:568)
at rx.internal.operators.OperatorMerge$InnerSubscriber.onError(OperatorMerge.java:855)
at rx.internal.operators.OperatorOnErrorResumeNextViaFunction$4$1.onError(OperatorOnErrorResumeNextViaFunction.java:122)
at rx.internal.operators.OnSubscribeMap$MapSubscriber.onError(OnSubscribeMap.java:88)
at rx.internal.operators.OnSubscribeMap$MapSubscriber.onNext(OnSubscribeMap.java:73)
at rx.internal.operators.OperatorMerge$MergeSubscriber.emitScalar(OperatorMerge.java:395)
at rx.internal.operators.OperatorMerge$MergeSubscriber.tryEmit(OperatorMerge.java:355)
at rx.internal.operators.OperatorMerge$InnerSubscriber.onNext(OperatorMerge.java:846)
at rx.internal.operators.OnSubscribeMap$MapSubscriber.onNext(OnSubscribeMap.java:77)
at rx.internal.operators.OperatorMerge$MergeSubscriber.emitScalar(OperatorMerge.java:511)
at rx.internal.operators.OperatorMerge$MergeSubscriber.tryEmit(OperatorMerge.java:466)
at rx.internal.operators.OperatorMerge$MergeSubscriber.onNext(OperatorMerge.java:244)
at rx.internal.operators.OperatorMerge$MergeSubscriber.onNext(OperatorMerge.java:148)
at rx.internal.operators.OnSubscribeMap$MapSubscriber.onNext(OnSubscribeMap.java:77)
at rx.internal.producers.SingleProducer.request(SingleProducer.java:65)
at rx.Subscriber.setProducer(Subscriber.java:211)
at rx.internal.operators.OnSubscribeMap$MapSubscriber.setProducer(OnSubscribeMap.java:102)
at rx.subjects.AsyncSubject.onCompleted(AsyncSubject.java:103)
at com.couchbase.client.core.endpoint.AbstractGenericHandler.completeResponse(AbstractGenericHandler.java:508)
at com.couchbase.client.core.endpoint.AbstractGenericHandler.access$000(AbstractGenericHandler.java:86)
at com.couchbase.client.core.endpoint.AbstractGenericHandler$1.call(AbstractGenericHandler.java:526)
at rx.internal.schedulers.ScheduledAction.run(ScheduledAction.java:55)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: com.couchbase.client.core.CouchbaseException: Could not parse configuration
at com.couchbase.client.core.config.parser.BucketConfigParser.parse(BucketConfigParser.java:55)
at com.couchbase.client.core.config.loader.AbstractLoader$1.call(AbstractLoader.java:204)
at com.couchbase.client.core.config.loader.AbstractLoader$1.call(AbstractLoader.java:200)
at rx.internal.operators.OnSubscribeMap$MapSubscriber.onNext(OnSubscribeMap.java:69)
… 24 more
Caused by: com.couchbase.client.deps.com.fasterxml.jackson.databind.exc.InvalidDefinitionException: Cannot construct instance of com.couchbase.client.core.config.DefaultNodeInfo, problem: Could not analyze hostname from config.
at [Source: (String)"{“rev”:293,“name”:“BYBUCKETNAME”,“uri”:"/pools/default/buckets/BYBUCKETNAME?bucket_uuid=XXXXXXXXXXXXXXXXXXXXX",“streamingUri”:"/pools/default/bucketsStreaming/BYBUCKETNAME?bucket_uuid=XXXXXXXXXXXXXXXXXXXXX",“nodes”:[{“couchApiBase”:“http://ip-XXX-XX-X-XXX.eu-west-1.compute.internal:8092/BYBUCKETNAME%XXXXXXXXXXXXXXXXXXXXX”[truncated 8478 chars]; line: 1, column: 2314] (through reference chain: com.couchbase.client.core.config.DefaultCouchbaseBucketConfig[“nodes”]->java.util.ArrayList[0])
at com.couchbase.client.deps.com.fasterxml.jackson.databind.exc.InvalidDefinitionException.from(InvalidDefinitionException.java:67)
at com.couchbase.client.deps.com.fasterxml.jackson.databind.DeserializationContext.instantiationException(DeserializationContext.java:1608)
at com.couchbase.client.deps.com.fasterxml.jackson.databind.deser.std.StdValueInstantiator.wrapAsJsonMappingException(StdValueInstantiator.java:484)
at com.couchbase.client.deps.com.fasterxml.jackson.databind.deser.std.StdValueInstantiator.rewrapCtorProblem(StdValueInstantiator.java:503)
at com.couchbase.client.deps.com.fasterxml.jackson.databind.deser.std.StdValueInstantiator.createFromObjectWith(StdValueInstantiator.java:285)
at com.couchbase.client.deps.com.fasterxml.jackson.databind.deser.ValueInstantiator.createFromObjectWith(ValueInstantiator.java:229)
at com.couchbase.client.deps.com.fasterxml.jackson.databind.deser.impl.PropertyBasedCreator.build(PropertyBasedCreator.java:195)
at com.couchbase.client.deps.com.fasterxml.jackson.databind.deser.BeanDeserializer._deserializeUsingPropertyBased(BeanDeserializer.java:488)
at com.couchbase.client.deps.com.fasterxml.jackson.databind.deser.BeanDeserializerBase.deserializeFromObjectUsingNonDefault(BeanDeserializerBase.java:1287)
at com.couchbase.client.deps.com.fasterxml.jackson.databind.deser.BeanDeserializer.deserializeFromObject(BeanDeserializer.java:326)
at com.couchbase.client.deps.com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:159)
at com.couchbase.client.deps.com.fasterxml.jackson.databind.deser.std.CollectionDeserializer.deserialize(CollectionDeserializer.java:286)
at com.couchbase.client.deps.com.fasterxml.jackson.databind.deser.std.CollectionDeserializer.deserialize(CollectionDeserializer.java:245)
at com.couchbase.client.deps.com.fasterxml.jackson.databind.deser.std.CollectionDeserializer.deserialize(CollectionDeserializer.java:27)
at com.couchbase.client.deps.com.fasterxml.jackson.databind.deser.SettableBeanProperty.deserialize(SettableBeanProperty.java:530)
at com.couchbase.client.deps.com.fasterxml.jackson.databind.deser.BeanDeserializer._deserializeWithErrorWrapping(BeanDeserializer.java:528)
at com.couchbase.client.deps.com.fasterxml.jackson.databind.deser.BeanDeserializer._deserializeUsingPropertyBased(BeanDeserializer.java:417)
at com.couchbase.client.deps.com.fasterxml.jackson.databind.deser.BeanDeserializerBase.deserializeFromObjectUsingNonDefault(BeanDeserializerBase.java:1287)
at com.couchbase.client.deps.com.fasterxml.jackson.databind.deser.BeanDeserializer.deserializeFromObject(BeanDeserializer.java:326)
at com.couchbase.client.deps.com.fasterxml.jackson.databind.deser.BeanDeserializer._deserializeOther(BeanDeserializer.java:194)
at com.couchbase.client.deps.com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:161)
at com.couchbase.client.deps.com.fasterxml.jackson.databind.jsontype.impl.AsPropertyTypeDeserializer._deserializeTypedForId(AsPropertyTypeDeserializer.java:130)
at com.couchbase.client.deps.com.fasterxml.jackson.databind.jsontype.impl.AsPropertyTypeDeserializer.deserializeTypedFromObject(AsPropertyTypeDeserializer.java:97)
at com.couchbase.client.deps.com.fasterxml.jackson.databind.deser.AbstractDeserializer.deserializeWithType(AbstractDeserializer.java:254)
at com.couchbase.client.deps.com.fasterxml.jackson.databind.deser.impl.TypeWrappedDeserializer.deserialize(TypeWrappedDeserializer.java:68)
at com.couchbase.client.deps.com.fasterxml.jackson.databind.ObjectReader._bindAndClose(ObjectReader.java:1611)
at com.couchbase.client.deps.com.fasterxml.jackson.databind.ObjectReader.readValue(ObjectReader.java:1219)
at com.couchbase.client.core.config.parser.BucketConfigParser.parse(BucketConfigParser.java:53)
… 27 more
Caused by: com.couchbase.client.core.CouchbaseException: Could not analyze hostname from config.
at com.couchbase.client.core.config.DefaultNodeInfo.(DefaultNodeInfo.java:70)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at com.couchbase.client.deps.com.fasterxml.jackson.databind.introspect.AnnotatedConstructor.call(AnnotatedConstructor.java:124)
at com.couchbase.client.deps.com.fasterxml.jackson.databind.deser.std.StdValueInstantiator.createFromObjectWith(StdValueInstantiator.java:283)
… 50 more
Caused by: java.lang.IllegalArgumentException: Could not create NetworkAddress.
at com.couchbase.client.core.utils.NetworkAddress.(NetworkAddress.java:88)
at com.couchbase.client.core.utils.NetworkAddress.(NetworkAddress.java:93)
at com.couchbase.client.core.utils.NetworkAddress.create(NetworkAddress.java:100)
at com.couchbase.client.core.config.DefaultNodeInfo.(DefaultNodeInfo.java:68)
… 56 more
Caused by: java.net.UnknownHostException: ip-XXX-XX-X-XXX.eu-west-1.compute.internal
at java.net.Inet6AddressImpl.lookupAllHostAddr(Native Method)
at java.net.InetAddress$2.lookupAllHostAddr(InetAddress.java:929)
at java.net.InetAddress.getAddressesFromNameService(InetAddress.java:1324)
at java.net.InetAddress.getAllByName0(InetAddress.java:1277)
at java.net.InetAddress.getAllByName(InetAddress.java:1193)
at java.net.InetAddress.getAllByName(InetAddress.java:1127)
at com.couchbase.client.core.utils.NetworkAddress.(NetworkAddress.java:70)
… 59 more

The exception at the bottom shows what’s going on. the SDK cannot reach the hostname - could it be that you are reaching from external but your cluster is setup so that the node hostnames are from internal? https://docs.couchbase.com/server/6.0/cloud/couchbase-aws-best-practices.html

Thanks for response. You mean the problem is that ip-XXX-XX-X-XXX.eu-west-1.compute.internal is not defined in public DNS?

All I can see from that log is that the client host (where the SDK runs on) is not able to reach that hostname. I’m not sure about your exact setup but this is not an SDK issue per se - I assume if you ping that hostname from the command line it will also not be able to resolve it?