I am trying to adopt that example into my existing Spring application. However I get that error:
Error creating bean with name 'mongo': Invocation of init method failed; nested exception is com.mongodb.MongoInternalException: DBPort.findOne failed
I get admin panel with that URL:
http://localhost:28017/
so should I use 28017 or 27017 as port number at my configuration file. I tried to use 2.2 instead of 2.4 as Java connecter but I get different error:
com.mongodb.DBTCPConnector$MyPort error
SEVERE: MyPort.error called
java.io.EOFException
at org.bson.io.Bits.readFully(Bits.java:32)
...
Second error may be related to joda when I searched about it but I don’t know how to solve it.
Any ideas about solving problem?
PS1:
I use that at my configuration file:
<bean id="mongoTemplate" class="org.springframework.data.document.mongodb.MongoTemplate">
<constructor-arg ref="mongo"/>
<constructor-arg value="userMongoDb"/>
<constructor-arg value="mycollection"/>
</bean>
However at the line:
<constructor-arg ref="mongo"/>
It says that:
can no resolve bean mongo
at my Intellij IDEA. Why it does that I didn’t understand because everything seems OK.
PS2:
I use Ubuntu 11.4 on a 64 bit server. First error maybe related to my OS.
PS3:
When I use 2.5.2 as mongo java driver I get that error:
com.mongodb.DBTCPConnector fetchMaxBsonObjectSize
WARNING: null
java.io.EOFException
at org.bson.io.Bits.readFully(Bits.java:37)
...
PS4:
There is another question and I will check if error is related to Ubuntu Software Center or not.
I used 27017 as port to connect. Also that question’s answer is important: MongoDb connection refused I installed my Mongo DB not from Ubuntu Update Center and it works well.