Internal server error and failure to connect

729 views
Skip to first unread message

jwi...@lifelink.com

unread,
Sep 8, 2016, 8:40:01 PM9/8/16
to wiremock-user

I'm trying to run WireMock 2.1.12 in a Grails project.

The code I'm testing:

    rest.post('http://127.0.0.1/8090/rest/orders/v1/submission'){
      auth getEnv
('questUsername'), getEnv('questPassword')
      contentType
"application/json"
      json
{
        documentTypes
= "REQ"
        orderHl7
= this.toHl7Base64()
     
}
   
}



The WireMockServer test in spock, I've configured it to respond on port 8090:

    WireMockServer wireMockServer = new WireMockServer(
            options
().port(8090)


    wireMockServer
.start()


    stubFor
(post(urlMatching(/rest\/orders\/v1\/submission/))
           
.willReturn(aResponse()
           
.withStatus(200)
           
.withHeader("Content-Type", "application/json")
           
.withBody('whee!')
           
))



When I execute the spock test, I get:

    com.github.tomakehurst.wiremock.client.VerificationException: Expected status 201 for http://localhost:8080/__admin/mappings/new but was 500


      at com
.github.tomakehurst.wiremock.client.HttpAdminClient.safelyExecuteRequest(HttpAdminClient.java:269)
      at com
.github.tomakehurst.wiremock.client.HttpAdminClient.postJsonAssertOkAndReturnBody(HttpAdminClient.java:249)
      at com
.github.tomakehurst.wiremock.client.HttpAdminClient.addStubMapping(HttpAdminClient.java:115)
      at com
.github.tomakehurst.wiremock.client.WireMock.register(WireMock.java:213)
      at com
.github.tomakehurst.wiremock.client.WireMock.register(WireMock.java:209)
      at com
.github.tomakehurst.wiremock.client.WireMock.givenThat(WireMock.java:80)
      at com
.github.tomakehurst.wiremock.client.WireMock.stubFor(WireMock.java:84)




I created a file in: src/test/resources/mappings/new with some mapping data per the docs.  Same error.

When I hit http://localhost:8080/__admin, I get json indicating
 {"message":"Internal server error","error":500}


I found 2 java processes on 8080 and kill them both:

java    13705  440u  IPv6 0xa3f8c124b8967d3f      0t0  TCP localhost:59886->localhost:http-alt (CLOSE_WAIT)
java    
13749  154u  IPv6 0xa3f8c124b896c31f      0t0  TCP *:http-alt (LISTEN)



When I re-run the test I get:

org.apache.http.conn.HttpHostConnectException: Connect to localhost:8080 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused
  at org
.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:158)
  at org
.apache.http.impl.conn.PoolingHttpClientConnectionManager.connect(PoolingHttpClientConnectionManager.java:353)
  at org
.apache.http.impl.execchain.MainClientExec.establishRoute(MainClientExec.java:380)
  at org
.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:236)
  at org
.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:184)
  at org
.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:184)
  at org
.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:82)
  at org
.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:107)
  at com
.github.tomakehurst.wiremock.client.HttpAdminClient.safelyExecuteRequest(HttpAdminClient.java:266)
  at com
.github.tomakehurst.wiremock.client.HttpAdminClient.postJsonAssertOkAndReturnBody(HttpAdminClient.java:249)
  at com
.github.tomakehurst.wiremock.client.HttpAdminClient.addStubMapping(HttpAdminClient.java:115)
  at com
.github.tomakehurst.wiremock.client.WireMock.register(WireMock.java:213)
  at com
.github.tomakehurst.wiremock.client.WireMock.register(WireMock.java:209)
  at com
.github.tomakehurst.wiremock.client.WireMock.givenThat(WireMock.java:80)
  at com
.github.tomakehurst.wiremock.client.WireMock.stubFor(WireMock.java:84)


The java processes are no longer running.

Any idea whats going on?
Reply all
Reply to author
Forward
0 new messages