玩 Morphia MongoDB :类型 Filter 已经定义

发布于 2024-12-12 10:41:26 字数 1101 浏览 0 评论 0原文

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

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!)
~ ...

When trying to launch a Play Java application with Morphia for MongoDB, I get the following stacktrace, caused by a recompilation of the Filter type that is already compiled :

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!)
~ ...

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

小巷里的女流氓 2024-12-19 10:41:26

当从 application.conf 和 dependency.yml 加载 morphia 模块时会出现此问题。

要解决此问题,请转到 application.conf 并注释掉下面的行“load
吗啡模块”,然后重新启动 Play。

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

This problem happens when the morphia module is being loaded from both the application.conf and dependencies.yml

To resolve it, go to your application.conf and comment out the line below "load
morphia module", then restart Play.

# load morphia module 
#module.morphia=${play.path}/modules/morphia-1.2.3d
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文