0

I've been working with the grails plugin: 'grails-rest-client-builder:2.0.1'

https://github.com/grails-plugins/grails-rest-client-builder/

I'm experiencing an odd issue when I POST some data to a web service, a 500 Exception, even though the POST indeed is working successfully.

Class
java.lang.NoClassDefFoundError
Message
org/springframework/util/StreamUtils

Around line 195 of PageFragmentCachingFilter.java
if (CollectionUtils.isEmpty(cacheOperations)) {             
log.debug("No cacheable annotation found for {}:{} {}"
new Object[] { request.getMethod(), request.getRequestURI(), getContext() });
chain.doFilter(request, response);
return;
}

The response that is coming back from the web service should look like this:

{"id":"9999","key":"IX-2247","self":"https://jira.xxxx.com/rest/api/latest/issue/9999"}

Again, the web service is correctly getting the values that I pass into it, and I verified this by checking the application that I'm posting to and I do see what I expect. Not only that, but I also receive an email from the system that I am POSTing to, and the email contains the correct values from the Grails application.

Here's the POST that I'm using:

    def rest = new grails.plugins.rest.client.RestBuilder()
    def resp = rest.post("https://jira.xxxx.com/rest/api/latest/issue/"){
        auth "Basic xxxx"
        contentType "application/json"
        json builder.toPrettyString()
    }

My hypothesis is that perhaps the issue is that the rest-client-builder is having some kind of issue with the response that is being returned from the web service.

Has anyone encountered anything like this before, where the service is working, but Grails throws a 500 error, even on a successful POST?

Please let me know if I need to provide additional information.

Thanks in advance!

meoww-
  • 1,892
  • 2
  • 21
  • 29
  • looks like a class version mismatch.. maybe `org/springframework/util/StreamUtils` is used/exported in 2 different plugins. Also, it's not really clear from your description, what the problem was. Error 500 doesn't have to mean, that the data you send do not arrive. The problem is rather in the result rendering - on the server, not in client – injecteer Jan 21 '14 at 15:55
  • Yes, @injecteer is right, the 500 will be server side. If you call the same from SOAPUI or command line with a "curl -X POST --data.....", I'd expect the 500 as well. It doesn't mean the entire call is failing and if you see what you expect on the server side, then it gets that call, persists the data and then errors somewhere downstream before the response returns. – derdc Jan 21 '14 at 16:20

1 Answers1

0

Thank you all for the replies. I ended up upgrading my Grails application to 2.3.5, from 2.2.3 and now the code (above) works perfectly. The 500 error disappeared completely.

meoww-
  • 1,892
  • 2
  • 21
  • 29
  • hi please look into following code : http://stackoverflow.com/questions/29281028/rest-builder-client-post-request-with-header-issue-grails – Vish Mar 26 '15 at 14:41