Spring Boot - 网络服务:拒绝连接 [英] Spring Boot - webservice: Connection Refused

查看:27
本文介绍了Spring Boot - 网络服务:拒绝连接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试实现 spring 文档中给出的 spring boot webservice 应用程序:

I am trying to implement spring boot webservice application as given in spring docs :

https://spring.io/guides/gs/sumption-web-service/

构建成功,创建了请求和响应 java 文件,但是当执行 spring-boot:run 时,它给出

Build was successful, request and response java files was created and , but when executed spring-boot:run , it gives

Caused by: org.springframework.ws.client.WebServiceIOException: I/O error: Connection refused: connect; nested exception is java.net.ConnectException: Connection refused: connect
    at org.springframework.ws.client.core.WebServiceTemplate.sendAndReceive(WebServiceTemplate.java:561)
    at org.springframework.ws.client.core.WebServiceTemplate.marshalSendAndReceive(WebServiceTemplate.java:390)
    at hello.WeatherClient.getCityForecastByZip(WeatherClient.java:30)
    at hello.Application.main(Application.java:20)

但是可以通过 eclipse 中的 Web 浏览器访问该 URL.请帮我解决这个问题

But the URL is accessible via web browser in eclipse. Kindly help me solve this issue

推荐答案

您尝试调用的 Web 服务 URL 可能无法访问或超时.确保 Web 服务 URL 路径正确且正在侦听.还要验证设置的超时持续时间和从您的请求中花费的时间.

The web Service URL you are trying to call may be not reachable or it gets timeout. Ensure the web Service URL path is correct and is listening. also verify the timeout duration set and the time taken from your request.

<代码>PS.还要检查服务器端是否存在一些防火墙问题.

对于防火墙问题,您可能需要在客户端代码中提供代理详细信息(proxyHost 和 proxyPort).

For firewall issue, you might need to provide proxy details(proxyHost and proxyPort) In client code.

我找不到合适的博客或更好地解释它的东西.但是在stackoverflow上发现了一个问题,它有类似的答案:这里

I am not able to find appropriate blog or something which explains it better. but found one question on stackoverflow which has similar answer : here

这篇关于Spring Boot - 网络服务:拒绝连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆