Play Morphia MongoDB:类型过滤器已经定义



当尝试使用MongoDB的Morphia启动Play Java应用程序时,我得到以下堆栈跟踪,由已经编译的过滤器类型的重新编译引起:

Internal Server Error (500) for request GET /
Compilation error (In {module:morphia-1.2.3d}/app/morphia/Filter.java around line 8)
The file {module:morphia-1.2.3d}/app/morphia/Filter.java could not be compiled. Error raised is : The type Filter is already defined
play.exceptions.CompilationException: The type Filter is already defined at play.classloading.ApplicationCompiler$2.acceptResult(ApplicationCompiler.java:246)
        at org.eclipse.jdt.internal.compiler.Compiler.handleInternalException(Compiler.java:672)
        at org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:516)
        at play.classloading.ApplicationCompiler.compile(ApplicationCompiler.java:278)
        at play.classloading.ApplicationClassloader.getAllClasses(ApplicationClassloader.java:412)
        at play.Play.start(Play.java:485)
        at play.Play.detectChanges(Play.java:599)
        at play.Invoker$Invocation.init(Invoker.java:186)
        at Invocation.HTTP Request(Play!)
~ ...

当从application.conf和dependencies.yml中同时加载morphia模块时,会出现这个问题

要解决这个问题,请转到application.conf并注释掉"load"下面的行morphia模块",然后重新启动Play。

# load morphia module 
#module.morphia=${play.path}/modules/morphia-1.2.3d

最新更新