Bug #16228

NullPointerException while uploading file using Java SDK

Added by Krzysztof Majewski almost 2 years ago.

Status:
New
Priority:
High
Assigned To:
-
Category:
-
Target version:
-
Start date:
Due date:
% Done:

0%

Estimated time:
Story points:
-

Description

When trying to upload a files using Java SDK I get the following error:

2020-03-10 08:07:23 ERROR - Cannot upload file to Keep server.
org.arvados.client.exception.ArvadosApiException: java.net.ConnectException: Failed to connect to keep1.ardev.roche.com/10.115.164.103:25107
    at org.arvados.client.api.client.BaseApiClient.getResponseBody(BaseApiClient.java:76)
    at org.arvados.client.api.client.BaseApiClient.newCall(BaseApiClient.java:49)
    at org.arvados.client.api.client.KeepServerApiClient.upload(KeepServerApiClient.java:42)
    at org.arvados.client.logic.keep.FileTransferHandler.put(FileTransferHandler.java:35)
    at org.arvados.client.logic.keep.KeepClient.lambda$put$1(KeepClient.java:110)
    at java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1590)
    at java.util.concurrent.CompletableFuture$AsyncSupply.exec(CompletableFuture.java:1582)
    at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)
    at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056)
    at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692)
    at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157)
Caused by: java.net.ConnectException: Failed to connect to keep1.ardev.roche.com/10.115.164.103:25107
    at okhttp3.internal.connection.RealConnection.connectSocket(RealConnection.kt:270)
    at okhttp3.internal.connection.RealConnection.connect(RealConnection.kt:176)
    at okhttp3.internal.connection.ExchangeFinder.findConnection(ExchangeFinder.kt:236)
    at okhttp3.internal.connection.ExchangeFinder.findHealthyConnection(ExchangeFinder.kt:109)
    at okhttp3.internal.connection.ExchangeFinder.find(ExchangeFinder.kt:77)
    at okhttp3.internal.connection.Transmitter.newExchange$okhttp(Transmitter.kt:162)
    at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.kt:35)
    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:112)
    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:87)
    at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.kt:82)
    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:112)
    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:87)
    at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.kt:84)
    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:112)
    at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.kt:71)
    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:112)
    at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:87)
    at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.kt:184)
    at okhttp3.RealCall.execute(RealCall.kt:66)
    at org.arvados.client.api.client.BaseApiClient.getResponseBody(BaseApiClient.java:63)
    ... 10 more
Caused by: java.net.ConnectException: Connection refused: connect
    at java.net.DualStackPlainSocketImpl.waitForConnect(Native Method)
    at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:85)
    at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
    at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
    at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
    at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172)
    at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
    at java.net.Socket.connect(Socket.java:589)
    at okhttp3.internal.platform.Platform.connectSocket(Platform.kt:126)
    at okhttp3.internal.connection.RealConnection.connectSocket(RealConnection.kt:268)
    ... 29 more

The keep1 server is taken from: https://api.ardev.roche.com/arvados/v1/keep_services/accessible. If I manipulate the response and remove it, leaving just keep2 everything works fine.

This is my code used for this example:

String serverUrl = "ardev.roche.com";
ExternalConfigProvider config = ExternalConfigProvider.builder()
        .apiToken("api_token")
        .apiHost(format("api.%s", serverUrl))
        .apiPort(443)
        .keepWebHost(format("collections.%s", serverUrl))
        .keepWebPort(443)
        .apiProtocol("https")
        .apiHostInsecure(true)
        .fileSplitSize(64)
        .fileSplitDirectory(new File("C:\\file-split"))
        .numberOfCopies(2)
        .numberOfRetries(0)
        .build();

List<File> files = asList(new File("C:\\samples\\sample.fcs"));
Collection collection = new CollectionsApiClient(config).get("collection_uuid");
new ArvadosFacade(config).uploadToExistingCollection(files, collection.getUuid());

Also available in: Atom PDF