简体   繁体   English

如何解决原因:java.lang.ClassNotFoundException:grails.mongodb.MongoEntity

[英]How to resolve Caused by: java.lang.ClassNotFoundException: grails.mongodb.MongoEntity

I am trying a very simple code in grails. 我正在grails中尝试一个非常简单的代码。

I have added below lines in build.gradle file. 我在build.gradle文件中添加了以下几行。

compile "org.grails.plugins:mongodb:5.0.5"
compile "org.mongodb:mongodb-driver:3.0.2"
runtime 'org.springframework.data:spring-data-mongodb:1.8.1.RELEASE'

But when I try to execute the code, it is giving me following error at the line of Database connection: 但是,当我尝试执行代码时,它在数据库连接行给了我以下错误:

Caused by: java.lang.ClassNotFoundException: grails.mongodb.MongoEntity
    at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    ... 49 common frames omitted

What is the problem here? 这里有什么问题? Do I need to add another jar in classpath or there is some version problem? 我需要在类路径中添加另一个jar还是存在一些版本问题?

Try with this in your gradle file: 在gradle文件中尝试以下操作:

'org.grails:grails-datastore-gorm-mongodb:4.0.7.RELEASE'

You can find more information about that class here: http://grails.github.io/grails-data-mapping/5.0.x/mongodb/api/grails/mongodb/MongoEntity.html 您可以在此处找到有关该类的更多信息: http : //grails.github.io/grails-data-mapping/5.0.x/mongodb/api/grails/mongodb/MongoEntity.html

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何解决此错误,导致原因:java.lang.ClassNotFoundException - How to resolve this error Caused by: java.lang.ClassNotFoundException 如何解决 java.lang.ClassNotFoundException: DocumentException - How to resolve java.lang.ClassNotFoundException: DocumentException 如何解决原因:java.lang.ClassNotFoundException:org.apache.hive.hcatalog.data.JsonSerDe。? - How To Resolve Caused by: java.lang.ClassNotFoundException: org.apache.hive.hcatalog.data.JsonSerDe.? 原因:具有MaterialList的java.lang.ClassNotFoundException - Caused by: java.lang.ClassNotFoundException with MaterialList 原因:java.lang.ClassNotFoundException:日志 - Caused by: java.lang.ClassNotFoundException: Log 错误“由以下引起:java.lang.ClassNotFoundException:” - Error “Caused by: java.lang.ClassNotFoundException:” 无法解析 java.lang.ClassNotFoundException - Can't resolve java.lang.ClassNotFoundException How to resolve (java.lang.ClassNotFoundException: com.mongodb.spark.sql.DefaultSource.DefaultSource) in pyspark i'm using pycharm - How to resolve (java.lang.ClassNotFoundException: com.mongodb.spark.sql.DefaultSource.DefaultSource) in pyspark i'm using pycharm NoClassDefFoundError原因:java.lang.ClassNotFoundException:junit.textui.ResultPrinter - NoClassDefFoundError Caused by: java.lang.ClassNotFoundException: junit.textui.ResultPrinter 引起:java.lang.ClassNotFoundException:com.jfoenix.controls.JFXButton - Caused by: java.lang.ClassNotFoundException: com.jfoenix.controls.JFXButton
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM