Skip to content

MinioClient: java.net.ConnectException: Failed to connect to localhost/127.0.0.1:9000 #2

@dwhitejazz

Description

@dwhitejazz

I have been looking for an Microservice example that uses docker and kubernetes with minikube.

Working through this example I am stuck trying to run the microservice. The docker containers start up and run for mongodb and knote but the microservice always fails to connect with following exception:

Minio Reconnect: true
java.net.ConnectException: Failed to connect to localhost/127.0.0.1:9000
at okhttp3.internal.connection.RealConnection.connectSocket(RealConnection.java:265)
at okhttp3.internal.connection.RealConnection.connect(RealConnection.java:183)
at okhttp3.internal.connection.ExchangeFinder.findConnection(ExchangeFinder.java:224)
at okhttp3.internal.connection.ExchangeFinder.findHealthyConnection(ExchangeFinder.java:108)
at okhttp3.internal.connection.ExchangeFinder.find(ExchangeFinder.java:88)
at okhttp3.internal.connection.Transmitter.newExchange(Transmitter.java:169)
at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.java:41)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:142)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:117)
at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.java:94)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:142)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:117)
at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.java:93)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:142)
at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.java:88)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:142)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:117)
at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:229)
at okhttp3.RealCall.execute(RealCall.java:81)
at io.minio.MinioClient.executeReq(MinioClient.java:1111)
at io.minio.MinioClient.execute(MinioClient.java:1070)
at io.minio.MinioClient.updateRegionCache(MinioClient.java:1219)
at io.minio.MinioClient.getRegion(MinioClient.java:1264)
at io.minio.MinioClient.executeHead(MinioClient.java:1312)
at io.minio.MinioClient.bucketExists(MinioClient.java:3286)
at io.learnk8s.demo.KNoteController.initMinio(KnoteJavaApplication.java:169)
at io.learnk8s.demo.KNoteController.init(KnoteJavaApplication.java:118)

This is probably a configuration issue on my end but I am unable to determine why this is happening and how to the resolve it. Perhaps related to localhost and a difference between 127.0.0.1 and 0.0.0.0?

My docker image is deployed:
knote-java latest ce9109e6c6df About an hour ago 393MB

Mongodb is running in a docker container:
2020-06-02T01:04:34.139+0000 I NETWORK [listener] Listening on 0.0.0.0
2020-06-02T01:04:34.139+0000 I NETWORK [listener] waiting for connections on port 27017

docker ps looks right too:
docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
c7b4df5e8318 knote-java "/bin/sh -c 'exec ja…" 32 seconds ago Up 30 seconds 0.0.0.0:8080->8080/tcp knote-java
23d5ed2a1fc5 mongo "docker-entrypoint.s…" 2 minutes ago Up 2 minutes 27017/tcp mongo
482ae31f5632 gcr.io/k8s-minikube/kicbase:v0.0.10 "/usr/local/bin/entr…" 6 days ago Up 4 minutes 127.0.0.1:32787->22/tcp, 127.0.0.1:32786->2376/tcp, 127.0.0.1:32785->5000/tcp, 127.0.0.1:32784->8443/tcp minikube

Any assistance is greatly appreciated. Thank you.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions