Grails: Exception with RestBuilder only while running in production tomcat server

506 Views Asked by At

I created the war file and deployed into tomcat server but while submitting the registration page(having recaptcha) this error is happening, but not in the local machine and app running in the local machine using the GGTS IDE.

Following is the error happening in the production server

    errors.GrailsExceptionResolver  - ClassNotFoundException occurred when processing request: [POST] /IFP/signup/completeSignUp
grails.plugins.rest.client.RestBuilder. Stacktrace follows:
java.lang.ClassNotFoundException: grails.plugins.rest.client.RestBuilder
    at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
    at java.lang.Class.getDeclaredMethods(Class.java:1975)
    at org.codehaus.groovy.util.LazyReference.getLocked(LazyReference.java:46)
    at org.codehaus.groovy.util.LazyReference.get(LazyReference.java:33)
    at com.megatome.grails.recaptcha.ReCaptcha.checkAnswer(ReCaptcha.groovy:171)
    at com.megatome.grails.RecaptchaService.verifyAnswer(RecaptchaService.groovy:147)
    at com.controllers.portal.SignupController.completeSignUp(SignupController.groovy:42)
    at grails.plugin.cache.web.filter.PageFragmentCachingFilter.doFilter(PageFragmentCachingFilter.java:198)
    at grails.plugin.cache.web.filter.AbstractFilter.doFilter(AbstractFilter.java:63)
    at grails.plugin.springsecurity.web.filter.GrailsAnonymousAuthenticationFilter.doFilter(GrailsAnonymousAuthenticationFilter.java:53)
    at grails.plugin.springsecurity.web.authentication.RequestHolderAuthenticationFilter.doFilter(RequestHolderAuthenticationFilter.java:53)
    at grails.plugin.springsecurity.web.authentication.logout.MutableLogoutFilter.doFilter(MutableLogoutFilter.java:62)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)

From my view this exception is happening after the implementation of recaptcha. Please help me for resolving this issue.

3

There are 3 best solutions below

2
injecteer On

java.lang.ClassNotFoundException: grails.plugins.rest.client.RestBuilder

states clearly that this class is missing in your production war or Tomcat.

Make sure you are setting proper dependencies in your gradle config as per plugin ref-doc:

compile "org.grails.plugins:rest-client-builder:2.1.1"

Check that those jars are also present in your war or Tomcat's classpath

0
Ragesh ck On

Copying the file grails-datastore-rest-client-3.1.4.RELEASE.jar into the tomcat lib folder resolved the problem. You can download the jar file from here.

2
joy2014 On

If someone is still looking for the answer: Please add the line below to build.gradle and it should work (pulls in a necessary dependency):

implementation 'org.grails:grails-datastore-rest-client:6.1.9.RELEASE'