I’m getting a MongoTimeoutException when bootstrapping the event store. The weird thing is I can connect to the instance fine both from the command line and when executing a simple MongoClient test. All of this is running on the same machine (meaning the MongoDB instance and Axon). Here is the stack:

Caused by: com.mongodb.MongoTimeoutException: Timed out after 10000 ms while waiting to connect. Client view of cluster state is {type=Unknown, servers=[{address=27017:27017, type=Unknown, state=Connecting, exception={com.mongodb.MongoException$Network: Exception opening the socket}, caused by { No route to host}}]
at com.mongodb.BaseCluster.getDescription(
at com.mongodb.DBTCPConnector.getClusterDescription(
at com.mongodb.DBTCPConnector.getType(
at com.mongodb.DBTCPConnector.createServerSelector(
at com.mongodb.DBTCPConnector.access$100(
at com.mongodb.DBTCPConnector$MyPort.get(
at com.mongodb.DBTCPConnector.getPrimaryPort(
at com.mongodb.DBCollectionImpl.createIndex(
at com.mongodb.DBCollection.createIndex(
at com.mongodb.DBCollection.ensureIndex(
at com.mongodb.DBCollection.ensureIndex(
at org.axonframework.eventstore.mongo.DocumentPerCommitStorageStrategy.ensureIndexes(
at org.axonframework.eventstore.mongo.MongoEventStore.ensureIndexes(

Anyone run into this or know what may be going on?


Solved. For anyone interested, the problem was in how I was wiring up the Mongo object in my Spring XML. I had this:

${} ${mongodb.port}

Because I wasn’t specifying the type of the constructor arguments, the wrong Mongo constructor was being invoked. This fixed it:

${} ${mongodb.port}