2

We are trying to upgrade Gravitee from 1.2 to 3.15 using Docker. Mongodb version is 4.2. While trying to use access management api getting 504 response. In Gravitee access management API logs getting the below error :

io.reactivex.exceptions.OnErrorNotImplementedException: The exception was not handled due to missing onError handler in the subscribe() method call. Further reading: https://github.com/ReactiveX/RxJava/wiki/Error-Handling | com.mongodb.MongoTimeoutException: Timed out after 30000 ms while waiting for a server that matches WritableServerSelector. Client view of cluster state is {type=UNKNOWN, servers=[{address=localhost:27017, type=UNKNOWN, state=CONNECTING, exception={com.mongodb.MongoSocketOpenException: Exception opening socket}, caused by {java.net.ConnectException: Connection refused}}]
        at io.reactivex.internal.functions.Functions$OnErrorMissingConsumer.accept(Functions.java:704)
        at io.reactivex.internal.functions.Functions$OnErrorMissingConsumer.accept(Functions.java:701)
        at io.reactivex.internal.observers.LambdaObserver.onError(LambdaObserver.java:77)
        at io.reactivex.internal.operators.observable.ObservableFromPublisher$PublisherSubscriber.onError(ObservableFromPublisher.java:51)
        at reactor.core.publisher.StrictSubscriber.onError(StrictSubscriber.java:106)
        at reactor.core.publisher.FluxConcatArray$ConcatArraySubscriber.onError(FluxConcatArray.java:207)
        at reactor.core.publisher.MonoIgnoreElements$IgnoreElementsSubscriber.onError(MonoIgnoreElements.java:84)
        at reactor.core.publisher.MonoFlatMap$FlatMapMain.secondError(MonoFlatMap.java:192)
        at reactor.core.publisher.MonoFlatMap$FlatMapInner.onError(MonoFlatMap.java:259)
        at reactor.core.publisher.MonoPeekTerminal$MonoTerminalPeekSubscriber.onError(MonoPeekTerminal.java:258)
        at reactor.core.publisher.MonoCreate$DefaultMonoSink.error(MonoCreate.java:194)
        at com.mongodb.reactivestreams.client.internal.MongoOperationPublisher.lambda$sinkToCallback$30(MongoOperationPublisher.java:545)
        at com.mongodb.reactivestreams.client.internal.OperationExecutorImpl.lambda$execute$8(OperationExecutorImpl.java:107)
        at com.mongodb.internal.async.ErrorHandlingResultCallback.onResult(ErrorHandlingResultCallback.java:48)
        at com.mongodb.internal.operation.CreateIndexesOperation$2.call(CreateIndexesOperation.java:214)
        at com.mongodb.internal.operation.OperationHelper$AsyncCallableWithConnectionCallback.onResult(OperationHelper.java:689)
        at com.mongodb.internal.operation.OperationHelper$AsyncCallableWithConnectionCallback.onResult(OperationHelper.java:681)
        at com.mongodb.internal.async.ErrorHandlingResultCallback.onResult(ErrorHandlingResultCallback.java:48)
        at com.mongodb.internal.binding.AsyncClusterBinding$1.onResult(AsyncClusterBinding.java:117)
        at com.mongodb.internal.binding.AsyncClusterBinding$1.onResult(AsyncClusterBinding.java:113)
        at com.mongodb.internal.connection.BaseCluster$ServerSelectionRequest.onResult(BaseCluster.java:430)
        at com.mongodb.internal.connection.BaseCluster.handleServerSelectionRequest(BaseCluster.java:306)
        at com.mongodb.internal.connection.BaseCluster.access$800(BaseCluster.java:62)
        at com.mongodb.internal.connection.BaseCluster$WaitQueueHandler.run(BaseCluster.java:476)
        at java.base/java.lang.Thread.run(Unknown Source)
Caused by: com.mongodb.MongoTimeoutException: Timed out after 30000 ms while waiting for a server that matches WritableServerSelector. Client view of cluster state is {type=UNKNOWN, servers=[{address=localhost:27017, type=UNKNOWN, state=CONNECTING, exception={com.mongodb.MongoSocketOpenException: Exception opening socket}, caused by {java.net.ConnectException: Connection refused}}]
        at com.mongodb.internal.connection.BaseCluster.createTimeoutException(BaseCluster.java:405)
        ... 4 more
Peterrabbit
  • 2,166
  • 1
  • 3
  • 19

1 Answers1

1

How do you deploy AM and Mongo, using docker-compose or by starting containers one by one ?

According to the error, the AM service is trying to connect the MongoDB on Localhost:27017. If you are running AM and Mongo into containers, you probably have to adapt the gravitee.yaml file of AM to connect to MongoDB with the right parameters.

In addition, as you are talking of upgrade, remenber to follow the migration guides : https://docs.gravitee.io/am/current/am_installguide_migration.html

Leleu Eric
  • 31
  • 3
  • We have followed all the migration steps required and we have used docker-compose to run gravitee. – Java Developer Mar 17 '22 at 07:48
  • Is it the same docker-compose file you used with the v2 of AM? If so, how did you configure the MongoDB connection settings, using the gravitee.yaml on through env vars ? In lastest versions of docker images, the env var don't support the "." anymore maybe the reason why your are targeting the default value for mongo. So the format should looks like `gravitee_management_mongodb_dbname=myDatabase` instead of `gravitee.management.mongodb.dbname=myDatabase` – Leleu Eric Mar 17 '22 at 08:23
  • We have used env vars for MongoDB connection settings. we are getting the same error with both "_" and "." – Java Developer Mar 17 '22 at 12:52
  • Can you please publish you issue on our community forum https://community.gravitee.io/ ? It will be more simple to share configuration through our forum than here. – Leleu Eric Mar 17 '22 at 18:59
  • For reference, here is the thread on the [community forum](https://community.gravitee.io/t/getting-com-mongodb-mongotimeoutexception-in-gravitee-access-management-api/303) – Leleu Eric Apr 05 '22 at 06:45