java.lang.RuntimeException: java.util.concurrent.TimeoutException

Couchbase JIRA | Arun Gupta | 7 months ago
tip
Your exception is missing from the Samebug knowledge base.
Here are the best solutions we found on the Internet.
Click on the to mark the helpful solution and get rewards for you help.
  1. 0

    Start Docker container as: {noformat} docker run -p 8091-8093:8091-8093 couchbase/server:sandbox {noformat} Use the following code to connect to the server: {code} package org.example.pipeline; import com.couchbase.client.java.Bucket; import com.couchbase.client.java.document.JsonDocument; import com.couchbase.client.java.document.json.JsonObject; /** * @arungupta */ public class Main { public static void main(String[] args) { Bucket bucket = Database.getBucket("travel-sample"); JsonObject jsonObject = JsonObject.create(); jsonObject.put("isbn", "978-1-4919-1889-0"); jsonObject.put("name", "Minecraft Modding with Forge"); jsonObject.put("cost", "29.99"); JsonDocument document = JsonDocument.create("minecraft", jsonObject); bucket.upsert(document); JsonDocument doc = bucket.get("minecraft"); System.out.println(doc.content()); System.out.println("Hello World!"); } } {code} Database.java is: {code} package org.example.pipeline; import com.couchbase.client.java.Bucket; import com.couchbase.client.java.CouchbaseCluster; import com.couchbase.client.java.env.CouchbaseEnvironment; import com.couchbase.client.java.env.DefaultCouchbaseEnvironment; /** * @author arungupta */ public class Database { static CouchbaseCluster cluster; static Bucket bucket; public static final CouchbaseCluster getCluster() { if (null == cluster) { CouchbaseEnvironment env = DefaultCouchbaseEnvironment.builder() .connectTimeout(10000) //10000ms = 10s, default is 5s .build(); cluster = CouchbaseCluster.create(env, "localhost"); } return cluster; } public static Bucket getBucket(String bucketName) { if (null == bucket) { bucket = getCluster().openBucket(bucketName); } return bucket; } } {code} This is consistently throwing the following error: {noformat} Aug 26, 2016 10:57:32 PM com.couchbase.client.core.CouchbaseCore <init> INFO: CouchbaseEnvironment: {sslEnabled=false, sslKeystoreFile='null', sslKeystorePassword=false, sslKeystore=null, bootstrapHttpEnabled=true, bootstrapCarrierEnabled=true, bootstrapHttpDirectPort=8091, bootstrapHttpSslPort=18091, bootstrapCarrierDirectPort=11210, bootstrapCarrierSslPort=11207, ioPoolSize=4, computationPoolSize=4, responseBufferSize=16384, requestBufferSize=16384, kvServiceEndpoints=1, viewServiceEndpoints=1, queryServiceEndpoints=1, searchServiceEndpoints=1, ioPool=NioEventLoopGroup, coreScheduler=CoreScheduler, eventBus=DefaultEventBus, packageNameAndVersion=couchbase-java-client/2.3.1 (git: 2.3.1, core: 1.3.1), dcpEnabled=false, retryStrategy=BestEffort, maxRequestLifetime=75000, retryDelay=ExponentialDelay{growBy 1.0 MICROSECONDS, powers of 2; lower=100, upper=100000}, reconnectDelay=ExponentialDelay{growBy 1.0 MILLISECONDS, powers of 2; lower=32, upper=4096}, observeIntervalDelay=ExponentialDelay{growBy 1.0 MICROSECONDS, powers of 2; lower=10, upper=100000}, keepAliveInterval=30000, autoreleaseAfter=2000, bufferPoolingEnabled=true, tcpNodelayEnabled=true, mutationTokensEnabled=false, socketConnectTimeout=1000, dcpConnectionBufferSize=20971520, dcpConnectionBufferAckThreshold=0.2, dcpConnectionName=dcp/core-io, callbacksOnIoPool=false, disconnectTimeout=25000, requestBufferWaitStrategy=com.couchbase.client.core.env.DefaultCoreEnvironment$2@45c8e616, queryTimeout=75000, viewTimeout=75000, kvTimeout=2500, connectTimeout=10000, dnsSrvEnabled=false} Exception in thread "main" java.lang.RuntimeException: java.util.concurrent.TimeoutException at com.couchbase.client.java.util.Blocking.blockForSingle(Blocking.java:71) at com.couchbase.client.java.CouchbaseCluster.openBucket(CouchbaseCluster.java:290) at com.couchbase.client.java.CouchbaseCluster.openBucket(CouchbaseCluster.java:271) at com.couchbase.client.java.CouchbaseCluster.openBucket(CouchbaseCluster.java:260) at com.couchbase.client.java.CouchbaseCluster.openBucket(CouchbaseCluster.java:250) at org.example.pipeline.Database.getBucket(Database.java:30) at org.example.pipeline.Main.main(Main.java:13) Caused by: java.util.concurrent.TimeoutException ... 7 more {noformat} This is a basic Java sample and should work. Complete workspace is at: https://github.com/arun-gupta/docker-jenkins-pipeline/tree/master/webapp The error reporting is not helpful at all. This may be related to https://issues.couchbase.com/browse/JVMCBC-362.

    Couchbase JIRA | 7 months ago | Arun Gupta
    java.lang.RuntimeException: java.util.concurrent.TimeoutException
  2. 0

    Unable to connect to DB - java.util.concurrent.TimeoutException - Java SDK - Couchbase Forums

    couchbase.com | 4 weeks ago
    java.lang.RuntimeException: java.util.concurrent.TimeoutException
  3. 0

    Couchbase connection timeout with Java SDK

    Stack Overflow | 2 years ago | Shinline
    java.lang.RuntimeException: java.util.concurrent.TimeoutException
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    couchbase connection time out with java sdk - BlogoSfera

    co.uk | 2 years ago
    java.lang.RuntimeException: java.util.concurrent.TimeoutException
  6. 0

    nosql - Couchbase connection timeout with Java SDK - Stack Overflow

    xluat.com | 2 years ago
    java.lang.RuntimeException: java.util.concurrent.TimeoutException

    3 unregistered visitors
    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. java.util.concurrent.TimeoutException

      No message provided

      at com.couchbase.client.java.util.Blocking.blockForSingle()
    2. com.couchbase.client
      CouchbaseCluster.openBucket
      1. com.couchbase.client.java.util.Blocking.blockForSingle(Blocking.java:71)
      2. com.couchbase.client.java.CouchbaseCluster.openBucket(CouchbaseCluster.java:290)
      3. com.couchbase.client.java.CouchbaseCluster.openBucket(CouchbaseCluster.java:271)
      4. com.couchbase.client.java.CouchbaseCluster.openBucket(CouchbaseCluster.java:260)
      5. com.couchbase.client.java.CouchbaseCluster.openBucket(CouchbaseCluster.java:250)
      5 frames
    3. org.example.pipeline
      Main.main
      1. org.example.pipeline.Database.getBucket(Database.java:30)
      2. org.example.pipeline.Main.main(Main.java:13)
      2 frames