本文介绍了无法使用mongodb插件版本3.0.3运行Grails应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图将我的mongodb插件从2.0.1升级到3.0.3。但是我总是收到以下错误:

  java.lang.NoClassDefFoundError:com / mongodb / AggregationOptions 
at java。 lang.Class.getDeclaredMethods0(Native Method)$ b $ java.util.Class.privateGetDeclaredMethods(Class.java:2531)$ b $ java.util.Class.getDeclaredMethods(Class.java:1855)
在org.codehaus.groovy.reflection.CachedClass $ 3 $ 1.run(CachedClass.java:84)$ b $在java.security.AccessController.doPrivileged(本地方法)
在org.codehaus.groovy.reflection .CachedClass $ 3.initValue(CachedClass.java:81)
at org.codehaus.groovy.reflection.CachedClass $ 3.initValue(CachedClass.java:79)
at org.codehaus.groovy.util.LazyReference .getLocked(LazyReference.java:46)
at org.codehaus.groovy.util.LazyReference.get(LazyReference.java:33)
at org.codehaus.groovy.reflection.CachedClass.getMethods(CachedClass .java:250)
在groovy.lang.MetaClassImpl.populateMethods(MetaClassImpl.java:343)
在groovy.lang.MetaClassImpl.fillMethodIndex(MetaClassImpl.java:293)
在groovy.lang.MetaClassImpl.initialize(MetaClassImpl.java:3048)
在groovy.lang.ExpandoMetaClass.initialize(ExpandoMetaClass.java :483)
at org.codehaus.groovy.reflection.ClassInfo.getMetaClassUnderLock(Cl
...

我尝试将插件的版本更改为3.0.2,但错误仍然存​​在。



更新:



我在Grails 2.3.11



我已经尝试了包含指定没有依赖关系的插件,并且复制粘贴从我过去配置的依赖关系:

  dependencies {

runtimeorg.mongodb:mongo-java-driver:2.11.4
compileorg.mongodb:mongo -java-driver:2.11.4
runtimecom.gmongo:gmongo:1.2

}



 插件{

...

compile(':mongodb:2.0.1'){
不包括'mongo-java-driver','gmongo'
}








$ b $ p> compile:mongodb:3.0.2

不要指定任何其他与mongo相关的依赖项,并且不排除 mongo-java-driver gmongo 。另外,如果您使用的是mongeez插件,那么您必须排除java驱动程序。

  compile(:mongeez:0.2.3 ){
excludes(mongo-java-driver)
}


I'm trying to upgrade my mongodb plugin from 2.0.1 to 3.0.3. However I keep getting the following error:

java.lang.NoClassDefFoundError: com/mongodb/AggregationOptions
    at java.lang.Class.getDeclaredMethods0(Native Method)
    at java.lang.Class.privateGetDeclaredMethods(Class.java:2531)
    at java.lang.Class.getDeclaredMethods(Class.java:1855)
    at org.codehaus.groovy.reflection.CachedClass$3$1.run(CachedClass.java:84)
    at java.security.AccessController.doPrivileged(Native Method)
    at org.codehaus.groovy.reflection.CachedClass$3.initValue(CachedClass.java:81)
    at org.codehaus.groovy.reflection.CachedClass$3.initValue(CachedClass.java:79)
    at org.codehaus.groovy.util.LazyReference.getLocked(LazyReference.java:46)
    at org.codehaus.groovy.util.LazyReference.get(LazyReference.java:33)
    at org.codehaus.groovy.reflection.CachedClass.getMethods(CachedClass.java:250)
    at groovy.lang.MetaClassImpl.populateMethods(MetaClassImpl.java:343)
    at groovy.lang.MetaClassImpl.fillMethodIndex(MetaClassImpl.java:293)
    at groovy.lang.MetaClassImpl.initialize(MetaClassImpl.java:3048)
    at groovy.lang.ExpandoMetaClass.initialize(ExpandoMetaClass.java:483)
    at org.codehaus.groovy.reflection.ClassInfo.getMetaClassUnderLock(Cl
    ...

I've tried changing the version of the plugin to 3.0.2 but the error persists.

UPDATE:

I'm on Grails 2.3.11.

I've tried including the plugin with specifying no dependencies and also copy pasting the dependencies from my past configuration which is:

 dependencies {

        runtime "org.mongodb:mongo-java-driver:2.11.4"
        compile "org.mongodb:mongo-java-driver:2.11.4"
        runtime "com.gmongo:gmongo:1.2"

    }

and

 plugins {

        ...

        compile(':mongodb:2.0.1') {
            excludes 'mongo-java-driver', 'gmongo'
        }
解决方案

Update your BuildConfig a bit:

compile ":mongodb:3.0.2"

Don't specify any other mongo related dependencies and don't exclude mongo-java-driver or gmongo. Also, if you are using mongeez plugin then you have to exclude the java driver.

compile (":mongeez:0.2.3") {
    excludes("mongo-java-driver")
}

这篇关于无法使用mongodb插件版本3.0.3运行Grails应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-20 14:44