2012-02-16 79 views
0

我開始播放應用程序時出現此錯誤。我使用Play 1.2.4和Mongo 1.3模塊。DuplicateMemberException播放框架mongodb模塊

`Oops: DuplicateMemberException 

An unexpected error occured caused by exception DuplicateMemberException: duplicate method: getCollectionName in models.MongoShapes 

play.exceptions.UnexpectedException: While applying [email protected] on models.MongoShapes 
    at play.plugins.PluginCollection.enhance(PluginCollection.java:511) 
    at play.classloading.ApplicationClasses$ApplicationClass.enhance(ApplicationClasses.java:235) 
    at play.classloading.ApplicationClassloader.loadApplicationClass(ApplicationClassloader.java:165) 
    at play.classloading.ApplicationClassloader.getAllClasses(ApplicationClassloader.java:429) 
    at play.Play.start(Play.java:505) 
    at play.Play.detectChanges(Play.java:618) 
    at play.Invoker$Invocation.init(Invoker.java:198) 
    at Invocation.HTTP Request(Play!) 
Caused by: javassist.bytecode.DuplicateMemberException: duplicate method: getCollectionName in models.MongoShapes 
    at javassist.bytecode.ClassFile.testExistingMethod(ClassFile.java:593) 
    at javassist.bytecode.ClassFile.addMethod(ClassFile.java:577) 
    at javassist.CtClassType.addMethod(CtClassType.java:1235) 
    at play.modules.mongo.MongoEnhancer.enhanceMongoEntity(MongoEnhancer.java:69) 
    at play.modules.mongo.MongoEnhancer.enhanceThisClass(MongoEnhancer.java:35) 
    at play.modules.mongo.MongoPlugin.enhance(MongoPlugin.java:17) 
    at play.plugins.PluginCollection.enhance(PluginCollection.java:506) 
    ... 7 more 

我的類看起來像

@MongoEntity 
public class MongoShapes extends MongoModel{ 
String someComment; 
} 
+1

老實說,我強烈建議您嘗試使用PlayMorphia插件來替換Mongodb插件。檢查它在:http://www.playframework.org/modules/morphia – 2012-02-16 19:10:44

回答

1

看起來像你的項目包括蒙戈模塊不止一次。你是如何聲明mongo模塊的?不要在applicaiton.conf和dependencies.yml中聲明它。

+0

謝謝。這是問題所在。並且我會用你的建議來使用嗎啡。 – smk 2012-02-21 16:23:57