[英]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.