grails-plugins / grails-rest-client-builder

REST client plugin that uses Spring's RestTemplate
http://grails.org/plugin/rest-client-builder
Apache License 2.0
65 stars 32 forks source link

Read timout #51

Open prabhug1987 opened 7 years ago

prabhug1987 commented 7 years ago

This is the code that i am using in my grails application

def rest = new RestBuilder(connectTimeout:60000, readTimeout:60000, proxy:['localhost':8008]) def requestParams = [username:"",password:""] def resp = rest.post('http://localhost:8008/api/jwt/login?username={username}&password={password}',requestParams) { contentType "application/x-www-form-urlencoded" }

It throws the following error when i run

ERROR org.grails.web.errors.GrailsExceptionResolver - SocketTimeoutException occurred when processing request: [GET] /test/index Read timed out. Stacktrace follows: java.lang.reflect.InvocationTargetException: null at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) ~[na:1.8.0_131] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) ~[na:1.8.0_131] at java.lang.Thread.run(Thread.java:748) [na:1.8.0_131] Caused by: org.springframework.web.client.ResourceAccessException: I/O error on POST request for "http://localhost:8008/api/jwt/login?username=username&password=password":Read timed out; nested exception is java.net.SocketTimeoutException: Read timed out at grails.plugins.rest.client.RestBuilder.invokeRestTemplate(RestBuilder.groovy:310) ~[grails-datastore-rest-client-5.0.0.RC2.jar:na] at grails.plugins.rest.client.RestBuilder.doRequestInternal(RestBuilder.groovy:274) ~[grails-datastore-rest-client-5.0.0.RC2.jar:na] at grails.plugins.rest.client.RestBuilder.post(RestBuilder.groovy:158) ~[grails-datastore-rest-client-5.0.0.RC2.jar:na] at rest.api.TestController.index(TestController.groovy:10) ~[main/:na] ... 3 common frames omitted Caused by: java.net.SocketTimeoutException: Read timed out at java.net.SocketInputStream.socketRead(SocketInputStream.java:116) ~[na:1.8.0_131] at java.net.SocketInputStream.read(SocketInputStream.java:171) ~[na:1.8.0_131] at java.net.SocketInputStream.read(SocketInputStream.java:141) ~[na:1.8.0_131] at java.io.BufferedInputStream.fill(BufferedInputStream.java:246) ~[na:1.8.0_131] at java.io.BufferedInputStream.read1(BufferedInputStream.java:286) ~[na:1.8.0_131] at java.io.BufferedInputStream.read(BufferedInputStream.java:345) ~[na:1.8.0_131] at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:480) ~[na:1.8.0_131] ... 7 common frames omitted

But, the same URL works forme when I use POSTMAN Tool. Please help me.