Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Grails Rendering Plugin gives java.lang.ClassNotFoundException when deployed

Tags:

grails

I've followed this tutorial successfully and works good on localhost. It's about using the using the grails rendering plugin. It works good and all on LOCALHOST, but when I deploy the app, or even just run grails run-war, the rendering plugin no longer works. It's giving some weird error. :(

I'm using grails 2.0.0 with rendering plugin 0.4.3 and this is what my BuildConfig.groovy contains:

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

        build ":tomcat:$grailsVersion"
    }

The error is this:

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)
like image 847
ShootingStar Avatar asked Sep 27 '12 17:09

ShootingStar


1 Answers

That's in the spring-test jar which is in the dev environment but isn't included in the WAR file. Add

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

to the dependencies section of BuildConfig.groovy.

like image 99
Burt Beckwith Avatar answered Nov 19 '22 17:11

Burt Beckwith