-
Type: Question
-
Resolution: Done
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
None
I have the below bean configured in my application.
<bean id="mongo" class="org.springframework.data.mongodb.core.MongoFactoryBean">
<property name="host" value="<host>.xyz.net" />
<property name="port" value="27130" />
</bean>
<mongo:db-factory dbname="testdb" mongo-ref="mongo" />
<bean id="mongoTemplate" class="org.springframework.data.mongodb.core.MongoTemplate">
<constructor-arg name="mongoDbFactory" ref="mongoDbFactory" />
<constructor-arg name="mongoConverter" ref="mappingMongoConverter" />
</bean>
<bean id="mappingContext" class="org.springframework.data.mongodb.core.mapping.MongoMappingContext" />
<bean id="defaultMongoTypeMapper" class="org.springframework.data.mongodb.core.convert.DefaultMongoTypeMapper">
<constructor-arg name="typeKey"><null/></constructor-arg>
</bean>
<bean id="mappingMongoConverter" class="org.springframework.data.mongodb.core.convert.MappingMongoConverter">
<constructor-arg name="mongoDbFactory" ref="mongoDbFactory" />
<constructor-arg name="mappingContext" ref="mappingContext" />
<property name="typeMapper" ref="defaultMongoTypeMapper" />
</bean>
I am using mongo java driver 3.0.3. We are getting the below error.
Unable to connect to any servers; nested exception is com.mongodb.MongoServerSelectionException: Unable to connect to any servers
com.bnymellon.inp.exceptions.MyIdeaException: Unable to connect to any servers; nested exception is com.mongodb.MongoServerSelectionException: Unable to connect to any servers
Could you please provide me a sample bean ?
Please advise.