MongoTimeoutException

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 {java.net.ConnectException: No route to host}}]
at com.mongodb.BaseCluster.getDescription(BaseCluster.java:128)
at com.mongodb.DBTCPConnector.getClusterDescription(DBTCPConnector.java:394)
at com.mongodb.DBTCPConnector.getType(DBTCPConnector.java:571)
at com.mongodb.DBTCPConnector.createServerSelector(DBTCPConnector.java:554)
at com.mongodb.DBTCPConnector.access$100(DBTCPConnector.java:40)
at com.mongodb.DBTCPConnector$MyPort.get(DBTCPConnector.java:448)
at com.mongodb.DBTCPConnector.getPrimaryPort(DBTCPConnector.java:407)
at com.mongodb.DBCollectionImpl.createIndex(DBCollectionImpl.java:378)
at com.mongodb.DBCollection.createIndex(DBCollection.java:597)
at com.mongodb.DBCollection.ensureIndex(DBCollection.java:726)
at com.mongodb.DBCollection.ensureIndex(DBCollection.java:700)
at org.axonframework.eventstore.mongo.DocumentPerCommitStorageStrategy.ensureIndexes(DocumentPerCommitStorageStrategy.java:112)
at org.axonframework.eventstore.mongo.MongoEventStore.ensureIndexes(MongoEventStore.java:122)

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

Michael

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

${mongodb.host} ${mongodb.port}

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

${mongodb.host} ${mongodb.port}