I try to get a data of Grails application (MyApplication2) from another Grails application (MyApplication2). Boths application run locally. I get an exception thrown using the following code.
Groovy
try {
def http = new HTTPBuilder('http://localhost:8080/MyApplication2')
http.get( path : '/ControllerName/Action', contentType : ContentType.TEXT) { resp, reader ->
println "response status: ${resp.statusLine}"
resp.headers.each { h ->
println " ${h.name} : ${h.value}"
}
}
} catch (groovyx.net.http.HttpResponseException ex) {
ex.printStackTrace()
println ex.toString()
} catch (java.net.ConnectException ex) {
ex.printStackTrace()
println ex.toString()
}
Exception thrown
Error 2015-10-28 10:13:43,448 [http-bio-8090-exec-1] ERROR errors.GrailsExceptionResolver - HttpResponseException occurred when processing request: [GET] /MyApplication1/ControllerName/Action Not Found.