2016-02-26 51 views
1

我正在將一個相當大的應用程序升級到mongodb:5.0.1.RELEASE來自mongodb:3.0.2,並且在嘗試grails package時收到以下異常NoClassDefFoundError:org/grails/compiler/gorm/GormEntityTransformation

Caused by: java.lang.NoClassDefFoundError: org/grails/compiler/gorm/GormEntityTransformation 
    at org.codehaus.groovy.grails.compiler.gorm.GormTransformer.performInjection(GormTransformer.java:69) 
    at org.codehaus.groovy.grails.compiler.gorm.GormTransformer.performInjectionOnAnnotatedClass(GormTransformer.java:78) 
    at org.codehaus.groovy.grails.compiler.gorm.GormTransformer.performInjection(GormTransformer.java:61) 

我遵循這些說明了使用新的mongodb的插件: http://grails.github.io/grails-data-mapping/latest/mongodb/manual/guide/gettingStarted.html

我的環境:

  • 操作系統:Windows 7
  • JVM:1.8.0_66
  • 的Grails:2.5.3
  • Groovy:在2.4.4

我創建了一個新的/清潔使用Grails 2.5項目.3並將其升級到新版本的mongodb插件,並且工作完美,所以我知道問題出在我的配置上,但我沒有足夠的空間去尋找。

我的生成配置:

dependencies { 
    runtime 'org.springframework.data:spring-data-mongodb:1.8.1.RELEASE' 

    compile "net.sf.ehcache:ehcache-core:2.4.8" 

    test "org.gebish:geb-spock:$gebVersion" 

    test "org.seleniumhq.selenium:selenium-firefox-driver:$seleniumVersion" 
    test "org.seleniumhq.selenium:selenium-chrome-driver:$seleniumVersion" 
    test "org.seleniumhq.selenium:selenium-ie-driver:$seleniumVersion" 
    test "org.seleniumhq.selenium:selenium-support:$seleniumVersion" 
    test("org.seleniumhq.selenium:selenium-htmlunit-driver:$seleniumVersion") { exclude 'xml-apis' } 

    build 'org.apache.httpcomponents:httpcore:4.3.2' 
    build 'org.apache.httpcomponents:httpclient:4.3.2' 
    runtime 'org.apache.httpcomponents:httpcore:4.3.2' 
    runtime 'org.apache.httpcomponents:httpclient:4.3.2' 

    compile 'org.apache.poi:poi:3.11' 
    compile 'org.apache.poi:poi-ooxml:3.11' 
    compile 'org.apache.poi:poi-ooxml-schemas:3.11' 
    compile 'org.apache.poi:ooxml-schemas:1.1' 

    compile "com.sun.jersey:jersey-bundle:1.6" 

    compile 'org.codehaus.groovy.modules.http-builder:http-builder:0.7.1' 
    runtime 'xml-apis:xml-apis:1.4.01' 

    compile 'org.apache.httpcomponents:httpmime:4.3.3' 

    test 'org.powermock:powermock-api-mockito:1.6.2' 

    compile 'org.apache.commons:commons-lang3:3.4' 
} 

plugins { 
    build ":tomcat:7.0.55" 

    compile ":scaffolding:2.1.2" 
    compile ':cache:1.1.8' 
    compile ":asset-pipeline:1.9.9" 
    compile ":less-asset-pipeline:1.10.0" 

    runtime ":database-migration:1.4.0" 
    runtime ":jquery:1.11.1" 
    runtime ':aws-sdk:1.9.22' 

    compile(":mongodb:5.0.1.RELEASE"); 

    compile ":spring-security-core:2.0-RC4" 
    compile ":fields:1.4" 
    compile ":mail:1.0.7" 

    compile ":phonenumbers:0.10" 

    test "org.grails.plugins:geb:$gebVersion" 
} 
+0

您是否嘗試過加入'編譯 「org.grails.plugins:MongoDB的:5.0.0.RC1」 編譯 「org.mongodb:MongoDB的驅動程序:3.0.2」'下依賴 –

+0

@SandeepPoonia我只是按照您的建議嘗試,我仍然收到相同的錯誤。 –

回答

2

我發現了它。我還需要升級GORM,而不僅僅是gong mongodb插件。這讓我經歷了這個問題。

dependencies { 
    ... 
    compile org.grails:grails-datastore-gorm:5.0.1.RELEASE' 
    ... 
}