Closed shoon closed 10 years ago
Can you try the latest play-morphia 1.5.0 which updates java-mongodb-driver to 2.12.2 version
I upgraded the dep in the dependencies.yml and changed my code with the new namespace:
find . -name "*.java" -print | xargs sed -i 's/com.google.code.morphia/org.mongodb.morphia/g'
But the app fails to start with the following error:
Caused by: com.mongodb.CommandFailureException: { "serverUsed" : "192.168.1.10:27017" , "ok" : 0.0 , "errmsg" : "Index with name: _created_-1 already
exists with different options" , "code" : 85}
at com.mongodb.CommandResult.getException(CommandResult.java:76)
at com.mongodb.CommandResult.throwOnError(CommandResult.java:131)
at com.mongodb.DBCollectionImpl.createIndex(DBCollectionImpl.java:347)
at com.mongodb.DBCollection.createIndex(DBCollection.java:564)
at com.mongodb.DBCollection.ensureIndex(DBCollection.java:663)
at org.mongodb.morphia.DatastoreImpl.ensureIndex(DatastoreImpl.java:314)
at org.mongodb.morphia.DatastoreImpl.processEmbeddedAnnotations(DatastoreImpl.java:393)
at org.mongodb.morphia.DatastoreImpl.ensureIndexes(DatastoreImpl.java:372)
at org.mongodb.morphia.DatastoreImpl.ensureIndexes(DatastoreImpl.java:353)
at org.mongodb.morphia.DatastoreImpl.ensureIndexes(DatastoreImpl.java:348)
at org.mongodb.morphia.DatastoreImpl.ensureIndexes(DatastoreImpl.java:456)
at org.mongodb.morphia.DatastoreImpl.ensureIndexes(DatastoreImpl.java:449)
at play.modules.morphia.MorphiaPlugin.configureDs_(MorphiaPlugin.java:825)
at play.modules.morphia.MorphiaPlugin.onApplicationStart(MorphiaPlugin.java:697)
at play.plugins.PluginCollection.onApplicationStart(PluginCollection.java:512)
at play.Play.start(Play.java:536)
I tried db.collectionName.reIndex() on each of my collections but that didn't resolve the startup error. Any thoughts on how to get past this?
Can you try to remove indexes in the mongodb shell and try again?
So far so good... here's the mongodb console script:
var collectionNames = db.getCollectionNames();
for(var i = 0, len = collectionNames.length; i < len ; i++){
var collectionName = collectionNames[i];
db[collectionName].dropIndexes();
print(collectionName);
}
@shoon, if you restart the app are you going to experience the same issue or not?
No problems after deleting the indexes in each collection and restarting the app... it works just fine.
perfect! BTW thank you for reporting the missing jar issue. I will update the dist to 1.5.0a
Using the latest 1.4.0 play-morphia, mongodb 2.7.0, java 8
The exception is thrown after a long time running. Looks like fixed problem with the mongo java driver:
https://jira.mongodb.org/browse/JAVA-616