Grails渲染插件在部署时提供java.lang.ClassNotFoundException

Grails渲染插件在部署时提供java.lang.ClassNotFoundException,grails,Grails,我已经成功地遵循了这一点,并在localhost上运行良好。这是关于使用grails渲染插件的。它在LOCALHOST上运行良好,但当我部署应用程序,甚至只是运行grails run war时,渲染插件就不再工作了。它给出了一些奇怪的错误( 我正在使用grails 2.0.0和渲染插件0.4.3,这就是我的BuildConfig.groovy所包含的内容: plugins { runtime ":hibernate:$grailsVersion" runtime

我已经成功地遵循了这一点,并在localhost上运行良好。这是关于使用grails渲染插件的。它在LOCALHOST上运行良好,但当我部署应用程序,甚至只是运行grails run war时,渲染插件就不再工作了。它给出了一些奇怪的错误(

我正在使用grails 2.0.0和渲染插件0.4.3,这就是我的BuildConfig.groovy所包含的内容:

plugins {
        runtime ":hibernate:$grailsVersion"
        runtime ":jquery:1.7.1"
        runtime ":resources:1.1.5"
        compile ":rendering:0.4.3"

        build ":tomcat:$grailsVersion"
    }
错误是:

2012-09-27 17:08:47,714 [http-8643-1] ERROR errors.GrailsExceptionResolver  - ClassNotFoundException occurred when processing request: [GET] /profile/renderFormPDF/1
org.springframework.mock.web.MockHttpServletRequest. Stacktrace follows:
java.lang.ClassNotFoundException: org.springframework.mock.web.MockHttpServletRequest
    at java.lang.Class.privateGetDeclaredMethods(Class.java:2427)
    at java.lang.Class.getDeclaredMethods(Class.java:1791)
    at org.codehaus.groovy.util.LazyReference.getLocked(LazyReference.java:46)
    at org.codehaus.groovy.util.LazyReference.get(LazyReference.java:33)
    at grails.plugin.rendering.document.RenderEnvironment.init(RenderEnvironment.groovy:33)
    at grails.plugin.rendering.document.RenderEnvironment.with(RenderEnvironment.groovy:69)
    at grails.plugin.rendering.document.RenderEnvironment.with(RenderEnvironment.groovy:61)
    at grails.plugin.rendering.document.XhtmlDocumentService.generateXhtml(XhtmlDocumentService.groovy:68)
    at grails.plugin.rendering.document.XhtmlDocumentService.createDocument(XhtmlDocumentService.groovy:38)
    at grails.plugin.rendering.RenderingService.render(RenderingService.groovy:34)
    at grails.plugin.rendering.RenderingService.render(RenderingService.groovy:33)
    at grails.plugin.rendering.RenderingService.render(RenderingService.groovy:63)
    at com.icodeya.ProfileController.renderFormPDF(ProfileController.groovy:108)
    at net.stax.appserver.webapp.RequestMonitorValve.invoke(RequestMonitorValve.java:35)
    at net.stax.appserver.admin.StaxApplicationQueryValve.invoke(StaxApplicationQueryValve.java:49)
    at net.stax.appserver.webapp.RequestSetupValve.invoke(RequestSetupValve.java:31)
    at java.lang.Thread.run(Thread.java:662)

这在SpringTestJAR中,它位于开发环境中,但不包括在WAR文件中

runtime 'org.springframework:spring-test:3.1.0.RELEASE'

到BuildConfig.groovy的
依赖项
部分。

我遇到了同样的问题,但没有解决方案(在appfog/cloudfoundry上部署了war)感谢Burt,发现这个解决方案在使用mail 1.0.3插件时也解决了一个类似的问题。如果您使用的是Grails 2.3.7,请使用
org.springframework:spring test:3.2.8。RELEASE
因为它是org.Grails:Grails plugin testing:2.3.7的依赖项。对于您正在使用的Grails版本,请运行“Grails依赖项报告”找到org.grails:grails插件测试的依赖项。其中一个应该是org.springframework:spring test:x.x.x.RELEASE并使用它。在我的例子中,这个问题发生在我将呈现插件与独立插件一起使用时。对于grails 2.4.3,我使用以下版本:运行时“org.springframework:spring test:4.0.6.RELEASE”a它就像一个符咒。