Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/spring/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Spring Docker错误解决POST请求时的主机和I/O错误http://es.example/oauth/check_token 拒绝连接_Spring_Networking_Docker_Ansible_Oauth2 - Fatal编程技术网

Spring Docker错误解决POST请求时的主机和I/O错误http://es.example/oauth/check_token 拒绝连接

Spring Docker错误解决POST请求时的主机和I/O错误http://es.example/oauth/check_token 拒绝连接,spring,networking,docker,ansible,oauth2,Spring,Networking,Docker,Ansible,Oauth2,我有两个容器,一个是AuthServer,另一个是api rest/资源服务器 该流与容器上的AuthServer和本地中的ResourceServer一起工作,但当我将资源服务器部署到容器中时,显示: "error": "Internal Server Error", "exception": "org.springframework.web.client.ResourceAccessException", "message": "I/O error on POST request

我有两个容器,一个是AuthServer,另一个是api rest/资源服务器

该流与容器上的AuthServer和本地中的ResourceServer一起工作,但当我将资源服务器部署到容器中时,显示:

 "error": "Internal Server Error",
  "exception": "org.springframework.web.client.ResourceAccessException",
  "message": "I/O error on POST request for \"http://es.example/oauth/check_token\": Connection refused; nested exception is java.net.ConnectException: Connection refused",
我做错了什么

注意:如果我留在容器中,ping工作:S

Docker文件相同:

FROM xxx.xxx.xxx.xxx:5000/services-base:1.0

EXPOSE 8080

# Services
ADD build/libs/service-authServer.jar /opt/app.jar
WORKDIR /opt
RUN sh -c 'touch app.jar'
ENTRYPOINT ["java","-Dlogging.config=config/logback.xml","-jar","app.jar"]
映像库是一个使用java 8的Alpine linux

我们在ansible中部署了:

- name: Container is running
  docker:
    image: "{{ registry_url }}/{{ services_oauth2_container }}"
    name: "{{ services_oauth2_name }}"
    ports: "{{ services_oauth2_ports }}"
    hostname: "{{ hostname }}"
    env:
      TZ: "{{ timezone_value }}"
      SERVICE_NAME: "{{ services_oauth2_name }}"
    volumes: "{{ volumes }}"
  tags: [service]
德特罗·德尔孔多尔酒店


ansible主机名上的我的配置重定向到容器rest到自身,而不是外部主机。

ansible主机名上的我的配置重定向到容器rest到自身,而不是外部主机。

请发布您的Dockerfiles/撰写文件/您如何运行这些容器?我已经实现了后发布Dockerfiles/撰写文件/你是如何运行这些容器的?我已经实现了这篇文章
[root@SERVICES~]# docker exec -it service-rest sh
/opt # curl -X GET 'http://es.example:2474/api/v1/rest/ping'
curl: (7) Failed to connect to es.example port 2474: Connection refused
/opt # curl -X GET 'http://es.example/api/v1/rest/ping'
curl: (7) Failed to connect to es.example port 80: Connection refused
/opt # curl -X GET 'http://localhost:8080/api/v1/rest/ping'
{"timestamp":1467184337030,"status":500,"error":"Internal Server Error","exception":"org.hibernate.exception.GenericJDBCException","message":"could not inspect JDBC autocommit mode","path":"/api/v1/rest"
/opt # curl -X GET 'http://localhost:8080/me'
/opt # curl -H 'Authorization: Bearer 76cac1c1-c2e6-4a16-a64c-f347d9e38793' -X GET 'http://localhost:8080/me'
{"timestamp":1467184455211,"status":500,"error":"Internal Server Error","exception":"org.springframework.web.client.ResourceAccessException","message":"I/O error on POST request for \"http://es.example:2490/oauth/check_token\": Connection refused; nested exception is java.net.ConnectException: Connection refused","path":"/me"}/opt # 
/opt # 
/opt # curl -X GET 'http://es.example:2490/oauth/check_token?token=76cac1c1-c2e6-4a16-a64c-f347d9e38793'
curl: (6) Couldn't resolve host 'es.example'
/opt # curl -X GET 'http://es.example:2490/oauth/check_token?token=76cac1c1-c2e6-4a16-a64c-f347d9e38793'
curl: (7) Failed to connect to es.example port 2490: Connection refused
/opt # curl -X GET 'http://xxx.xxx.xxx.xxx:2490/oauth/check_token?token=76cac1c1-c2e6-4a16-a64c-f347d9e38793'
{"error":"invalid_token","error_description":"Token has expired"}/opt # ping es.example
PING es.example (xxx.xxx.xxx.xxx): 56 data bytes
64 bytes from xxx.xxx.xxx.xxx: seq=0 ttl=64 time=0.085 ms
64 bytes from xxx.xxx.xxx.xxx: seq=1 ttl=64 time=0.066 ms
64 bytes from xxx.xxx.xxx.xxx: seq=2 ttl=64 time=0.069 ms
64 bytes from xxx.xxx.xxx-xxx: seq=3 ttl=64 time=0.060 ms
^C
--- es.example ping statistics ---
4 packets transmitted, 4 packets received, 0% packet loss
round-trip min/avg/max = 0.060/0.070/0.085 ms
/opt # curl -X GET 'http://xxx.xxx.xxx.xxx:2490/oauth/check_token?token=76cac1c1-c2e6-4a16-a64c-f347d9e38793'
/opt # curl -X GET 'http://xxx.xxx.xxx.xxx:2490/oauth/check_token?token=789cb37b-53b4-4f49-9ae7-c4a7f93c7df5'
{"exp":1467185199,"user_name":"admin","authorities":["USER","client_id":"clientID","scope":["read","write"]}