简体   繁体   English

Boot-clj连接被拒绝

[英]Boot-clj connection refused

When attempting to run Boot inside Docker, using the adzerk/boot-clj image, I receive connection refused errors. 当尝试使用adzerk / boot-clj映像在Docker中运行Boot时,我收到连接被拒绝的错误。

Specifically, when the container starts up, boot is started, and then a stack trace is output. 具体来说,当容器启动时,启动启动,然后输出堆栈跟踪。 The trace (which is not easy to copy and paste between computers with no connectivity) essentially is to do with downloading - https://github.com/boot-clj/boot/releases/download/2.7.2/boot.jar - and receiving "Connection refused" errors. 跟踪(在没有连接的计算机之间复制和粘贴不容易)实质上与下载有关-https://github.com/boot-clj/boot/releases/download/2.7.2/boot.jar-并收到“连接被拒绝”错误。

I'm asking, and answering this, question in the hope that it might help someone else. 我在问并回答这个问题,希望对别人有帮助。

Where to start? 从哪儿开始?

My main problem was with a Docker + Clojure + Boot setup, specifically when running “boot” from inside the container. 我的主要问题是使用Docker + Clojure + Boot设置,特别是从容器内部运行“ boot”时。 Doing this spewed out a stack trace. 这样做会产生堆栈跟踪。 This is where my journey begins. 这就是我的旅程的起点。

I'm using the adzerk/boot-clj image. 我正在使用adzerk / boot-clj映像。 I've used it locally (OSX) without issue, the problem I experienced was in using a VM (CentOS 7) hosted within a corporate data center. 我在本地(OSX)上使用它没有问题,我遇到的问题是在公司数据中心内使用的VM(CentOS 7)。

docker run -ti adzerk/boot-clj

Issuing this starts up the container, the entry point is Boot, and it starts pulling down some jars, specifically boot.jar from Github. 发出此命令将启动容器,入口点是Boot,它开始拉下一些jar,特别是Github中的boot.jar。 The resulting stack trace details several problems, but the crux of it was 生成的堆栈跟踪详细说明了几个问题,但关键是

“java.net.ConnectException: Connection refused” (connecting to Clojars.org:443)

Hmmm… 嗯...

So instead of running Boot straight away in the container, I specified the container entry point as “ —-entrypoint bash ” so I can prod around a little. 因此,我没有直接在容器中运行Boot,而是将容器入口点指定为“ — —-entrypoint bash ”,这样我可以进行一些操作。

So, wget - connection refused. 因此,wget-连接被拒绝。

What about without Docker in the way. 如果没有Docker,该怎么办。 Same thing. 一样。 Connection refused. 拒绝连接。

After a little wrangling with the network team, I found that the “https_proxy” env variable needs to be set on CentOS to route traffic out to the internet. 经过与网络团队的争执之后,我发现需要在CentOS上设置“ https_proxy” env变量以将流量路由到Internet。 A very specific issue to me in the situation. 在这种情况下,对我来说是一个非常具体的问题。

However…. 然而…。

wget is now fine, both on the host, and inside the adzerk/boot-clj container. 现在,无论是在主机上还是在adzerk / boot-clj容器内,wget都可以使用。 Boot however was not. 开机却不是。

In an effort to simplify things even more, I took Docker out of the equation entirely, and used boot locally. 为了进一步简化操作,我完全不考虑Docker,而是在本地使用boot。

Installed java-1.8.0-openjdk.x86_64, installed Boot. 安装了java-1.8.0-openjdk.x86_64,安装了Boot。 Same problem. 同样的问题。

So dug around a little, and found this - https ://github.com/boot-clj/boot-bin/issues/2 所以挖了一下,发现了-https://github.com/boot-clj/boot-bin/issues/2

This was a start. 这是一个开始。 It mentions setting the BOOT_JVM_OPTIONS, specifically https.proxyHost and https.proxyPort. 它提到设置BOOT_JVM_OPTIONS,特别是https.proxyHost和https.proxyPort。

It still didn't work… Arrrg. 还是没用... Arrrg。

OK, let's take Boot out of the equation. 好的,让我们摆脱引导问题。

I wrote a test harness in Java, very simple that connects to https ://clojars.org and attempts to read the index page. 我用Java写了一个测试工具,非常简单,它连接到https://clojars.org并尝试读取索引页。 Copied from https ://docs.oracle.com/javase/tutorial/networking/urls/readingWriting.html, and setting the JVM_OPTS. 从https://docs.oracle.com/javase/tutorial/networking/urls/readingWriting.html复制,并设置JVM_OPTS。

It still fails. 它仍然失败。 “Connection refused” “拒绝连接”

…. …。 Weird beard. 奇怪的胡子。

I finally stumbled on this SO - https ://stackoverflow.com/questions/43695299/java-httpurlconnection-works-on-windows-and-fails-on-linux - specifically the answer from Stephen C 我终于迷迷糊糊了-https://stackoverflow.com/questions/43695299/java-httpurlconnection-works-on-windows-and-fails-on-linux-特别是来自Stephen C的答案

“Java doesn't necessarily respect your system's default proxy settings. “ Java不一定必须遵守系统的默认代理设置。 Since you are able to "curl" the URL on the Linux machine, the most likely explanation is that Java is not using the proxy that you have configured. 由于您可以在Linux计算机上“卷曲” URL,因此最可能的解释是Java没有使用您配置的代理。 The following links explains various ways to configure the proxies for Java:” 以下链接说明了配置Java代理的各种方法:”

So taking the first link - https ://stackoverflow.com/questions/120797/how-do-i-set-the-proxy-to-be-used-by-the-jvm - and the answer from Leonel 因此,采用第一个链接-https://stackoverflow.com/questions/120797/how-do-i-set-the-proxy-to-by-the-jvm-以及Leonel的回答

I issued “ java -Dhttps.proxyHost=xxx -Dhttps.proxyPort=80 HelloWorld 我发布了“ java -Dhttps.proxyHost=xxx -Dhttps.proxyPort=80 HelloWorld

I get an error, but a different one. 我收到一个错误,但又有一个错误。 This is progress. 这是进步。 “Unable to tunnel through proxy” “无法通过代理隧道”

A quick Google of this led me here: http ://www.oracle.com/technetwork/java/javase/8u111-relnotes-3124969.html - “Disable Basic authentication for HTTPS tunneling” 一个快速的Google引导我来到这里:http://www.oracle.com/technetwork/java/javase/8u111-relnotes-3124969.html-“禁用HTTPS隧道的基本身份验证”

So updated to “ java -Dhttps.proxyHost=xxx -Dhttps.proxyPort=80 -Djdk.http.auth.tunneling.disabledSchemes=“” HelloWorld 因此更新为“ java -Dhttps.proxyHost=xxx -Dhttps.proxyPort=80 -Djdk.http.auth.tunneling.disabledSchemes=“” HelloWorld

Profit. 利润。

Info: 信息:

java -v 
openjdk version 1.8.0_144
Openjdk Runtime Environment (build 1.8.0_144-b01)
OpenJDK 64-Bit Server VM (build 25.144-b01, mixed mode)

Sorry for all my profanity Boot. 对不起,我所有的亵渎引导。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Dockerized Spring Boot + Postgres 连接被拒绝 - Dockerized Spring Boot + Postgres connection refused Dockerizing Spring 引导数据库错误:连接被拒绝 - Dockerizing Spring Boot db error : connection refused Spring 引导 Docker - 连接到 localhost:5432 被拒绝 - Spring Boot Docker - connection to localhost:5432 refused Spring boot + docker + rest 模板连接被拒绝 - Spring boot + docker + rest template connection refused java.net.ConnectException:连接被拒绝(连接被拒绝):Docker + Spring 启动 - java.net.ConnectException: Connection refused (Connection refused): Docker + Spring boot Windows上的Docker,Mongodb,Spring Boot出现连接被拒绝错误 - Docker, Mongodb,Spring Boot on Windows getting Connection refused error 使用Redis时Spring Boot Redis获取连接被拒绝异常 - Spring Boot Redis getting connection refused exception when using Redis Spring Boot docker无法连接到mysql(连接被拒绝/ createCommunicationsException) - Spring boot docker Cannot connect to mysql (Connection refused / createCommunicationsException) 在不同的Docker容器中运行的Spring Boot应用拒绝连接 - Connection refused by Spring boot app running in different docker container docker镜像中的spring boot应用程序错误连接到localhost:5433被拒绝 - spring boot app in docker image error Connection to localhost:5433 refused
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM