Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Microservice with reactive + MongoDB doesn't start #25548

Closed
mraible opened this issue Mar 19, 2024 · 1 comment · Fixed by #25549
Closed

Microservice with reactive + MongoDB doesn't start #25548

mraible opened this issue Mar 19, 2024 · 1 comment · Fixed by #25549

Comments

@mraible
Copy link
Contributor

mraible commented Mar 19, 2024

Overview of the issue
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [io.mongock.driver.api.driver.ConnectionDriver]: Factory method 'connectionDriver' threw exception with message: Timed out after 30000 ms while waiting for a server that matches ReadPreferenceServerSelector{readPreference=primary}. Client view of cluster state is {type=UNKNOWN, servers=[{address=localhost:27017, type=UNKNOWN, state=CONNECTING, exception={com.mongodb.MongoSocketWriteException: Exception sending message}, caused by {io.netty.channel.StacklessClosedChannelException}}]
        at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:177)
        at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:647)
        ... 31 common frames omitted
Caused by: com.mongodb.MongoTimeoutException: Timed out after 30000 ms while waiting for a server that matches ReadPreferenceServerSelector{readPreference=primary}. Client view of cluster state is {type=UNKNOWN, servers=[{address=localhost:27017, type=UNKNOWN, state=CONNECTING, exception={com.mongodb.MongoSocketWriteException: Exception sending message}, caused by {io.netty.channel.StacklessClosedChannelException}}]
        at com.mongodb.internal.connection.BaseCluster.createTimeoutException(BaseCluster.java:380)
        at com.mongodb.internal.connection.BaseCluster.selectServer(BaseCluster.java:125)
        at com.mongodb.internal.connection.SingleServerCluster.selectServer(SingleServerCluster.java:46)
        at com.mongodb.internal.binding.ClusterBinding.getReadConnectionSource(ClusterBinding.java:116)
        at com.mongodb.client.internal.ClientSessionBinding.getConnectionSource(ClientSessionBinding.java:128)
        at com.mongodb.client.internal.ClientSessionBinding.getReadConnectionSource(ClientSessionBinding.java:92)
        at com.mongodb.internal.operation.SyncOperationHelper.withSuppliedResource(SyncOperationHelper.java:144)
        at com.mongodb.internal.operation.SyncOperationHelper.withSourceAndConnection(SyncOperationHelper.java:125)
        at com.mongodb.internal.operation.ListIndexesOperation.lambda$execute$2(ListIndexesOperation.java:124)
        at com.mongodb.internal.operation.SyncOperationHelper.lambda$decorateReadWithRetries$12(SyncOperationHelper.java:292)
        at com.mongodb.internal.async.function.RetryingSyncSupplier.get(RetryingSyncSupplier.java:67)
        at com.mongodb.internal.operation.ListIndexesOperation.execute(ListIndexesOperation.java:135)
        at com.mongodb.internal.operation.ListIndexesOperation.execute(ListIndexesOperation.java:68)
        at com.mongodb.client.internal.MongoClientDelegate$DelegateOperationExecutor.execute(MongoClientDelegate.java:153)
        at com.mongodb.client.internal.MongoIterableImpl.execute(MongoIterableImpl.java:130)
        at com.mongodb.client.internal.MongoIterableImpl.iterator(MongoIterableImpl.java:90)
        at com.mongodb.client.internal.MongoIterableImpl.iterator(MongoIterableImpl.java:37)
        at java.base/java.lang.Iterable.spliterator(Iterable.java:101)
        at io.mongock.driver.mongodb.sync.v4.repository.MongoSync4RepositoryBase.getResidualKeys(MongoSync4RepositoryBase.java:71)
        at io.mongock.driver.mongodb.sync.v4.repository.MongoSync4RepositoryBase.isIndexFine(MongoSync4RepositoryBase.java:60)
        at io.mongock.driver.mongodb.sync.v4.repository.MongoSync4RepositoryBase.ensureIndex(MongoSync4RepositoryBase.java:47)
        at io.mongock.driver.mongodb.sync.v4.repository.MongoSync4RepositoryBase.initialize(MongoSync4RepositoryBase.java:38)
        at io.mongock.driver.core.driver.ConnectionDriverBase.initialize(ConnectionDriverBase.java:49)
        at io.mongock.driver.mongodb.springdata.v4.config.SpringDataMongoV4ContextBase.connectionDriver(SpringDataMongoV4ContextBase.java:23)
        at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
        at java.base/java.lang.reflect.Method.invoke(Method.java:580)
        at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:140)
        ... 32 common frames omitted
Motivation for or Use Case

A microservice with MongoDB started just fine with 8.1.0.

Reproduce the error

Create an app with jhipster jdl reactive-mf.jdl --monorepository --workspaces. Then, start the relevant Docker containers and the store app with ./gradlew.

Suggest a Fix
JHipster Version(s)

main branch.

@mraible
Copy link
Contributor Author

mraible commented Mar 19, 2024

If I look at the MongoDB container's logs, it says the following, which might mean it's an Apple Silicon issue.

2024-03-19 09:30:58 WARNING: MongoDB 5.0+ requires a CPU with AVX support, and your current system does not appear to have that!
2024-03-19 09:30:58   see https://jira.mongodb.org/browse/SERVER-54407
2024-03-19 09:30:58   see also https://www.mongodb.com/community/forums/t/mongodb-5-0-cpu-intel-g4650-compatibility/116610/2
2024-03-19 09:30:58   see also https://github.com/docker-library/mongo/issues/485#issuecomment-891991814

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants