来自 Maven 项目中袜子服务器的格式错误的回复

Posted

技术标签:

【中文标题】来自 Maven 项目中袜子服务器的格式错误的回复【英文标题】:Malformed reply from socks server in maven project 【发布时间】:2014-10-09 06:52:30 【问题描述】:

我在 netbeans 8.0 中创建了 maven 项目,并在该项目中添加了 java 类以打印 helloworld。当我尝试运行该项目时,它显示以下错误并需要 15 分钟才能完成运行。

 cd C:\Users\selva\Documents\NetBeansProjects\SelvaMaven; "JAVA_HOME=C:\\Program Files\\Java\\jdk1.8.0_05" cmd /c "\"\"C:\\Program Files\\NetBeans 8.0\\java\\maven\\bin\\mvn.bat\" -Dexec.args=\"-classpath %classpath com.mycompany.selvamaven.SelDur\" -Dexec.executable=\"C:\\Program Files\\Java\\jdk1.8.0_05\\bin\\java.exe\" -Dmaven.ext.class.path=\"C:\\Program Files\\NetBeans 8.0\\java\\maven-nblib\\netbeans-eventspy.jar\" -Dfile.encoding=UTF-8 -Djava.net.useSystemProxies=true process-classes org.codehaus.mojo:exec-maven-plugin:1.2.1:exec\""
Scanning for projects...
Downloading: http://repo.maven.apache.org/maven2/org/codehaus/mojo/exec-maven-plugin/1.2.1/exec-maven-plugin-1.2.1.pom
Oct 09, 2014 12:11:04 PM org.apache.maven.wagon.providers.http.httpclient.impl.client.DefaultRequestDirector tryConnect
INFO: I/O exception (java.net.SocketException) caught when connecting to the target host: Malformed reply from SOCKS server
Oct 09, 2014 12:11:05 PM org.apache.maven.wagon.providers.http.httpclient.impl.client.DefaultRequestDirector tryConnect
INFO: Retrying connect
Oct 09, 2014 12:16:05 PM org.apache.maven.wagon.providers.http.httpclient.impl.client.DefaultRequestDirector tryConnect
INFO: I/O exception (java.net.SocketException) caught when connecting to the target host: Malformed reply from SOCKS server
Oct 09, 2014 12:16:05 PM org.apache.maven.wagon.providers.http.httpclient.impl.client.DefaultRequestDirector tryConnect
INFO: Retrying connect
Oct 09, 2014 12:21:06 PM org.apache.maven.wagon.providers.http.httpclient.impl.client.DefaultRequestDirector tryConnect
INFO: I/O exception (java.net.SocketException) caught when connecting to the target host: Malformed reply from SOCKS server
Oct 09, 2014 12:21:06 PM org.apache.maven.wagon.providers.http.httpclient.impl.client.DefaultRequestDirector tryConnect
INFO: Retrying connect

------------------------------------------------------------------------
BUILD FAILURE
------------------------------------------------------------------------
Total time: 20:02.044s
Finished at: Thu Oct 09 12:26:06 IST 2014
Final Memory: 4M/99M
------------------------------------------------------------------------
Plugin org.codehaus.mojo:exec-maven-plugin:1.2.1 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.codehaus.mojo:exec-maven-plugin:jar:1.2.1: Could not transfer artifact org.codehaus.mojo:exec-maven-plugin:pom:1.2.1 from/to central (http://repo.maven.apache.org/maven2): Malformed reply from SOCKS server -> [Help 1]

To see the full stack trace of the errors, re-run Maven with the -e switch.
Re-run Maven using the -X switch to enable full debug logging.

For more information about the errors and possible solutions, please read the following articles:
[Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginResolutionException

如何解决这个问题?任何帮助将不胜感激!!!!

【问题讨论】:

检查您的 Maven settings.xml - 如果它使用 HTTP 代理设置,请检查它们是否有效 哪个 settings.xml、m2/settings.xml 或 maven/conf/settings.xml? 您在某处配置了一个不是 SOCKS 代理的 SOCKS 代理。例如,它可能是一个 HTTP 代理。 我的项目、ide 和系统中没有配置 socks 代理。 如果你没有在某处配置 SOCKS 代理,你不可能得到这个错误。你可能不知道它在哪里,或者你自己做过,但它就在某个地方。 【参考方案1】:

不要使用与 netbeans 捆绑的 maven,而是在您的 PC 上安装 maven 并让 netbeans 引用它。 然后使用您的代理配置编辑 /conf/settings 文件:

 <proxies>
   <proxy>
   <active>true</active>
   <host>yourproxy</host>
     <port>8080</port>
   </proxy>
 </proxies>

然后将wagon-http-lightweight-2.2.jar 放入你的maven /lib/ext 目录中。

【讨论】:

如果您使用的是 maven 3.x,则需要最新版本的 wagon-http-lightweight (mvnrepository.com/artifact/org.apache.maven.wagon/…)。【参考方案2】:

https://netbeans.org/bugzilla/show_bug.cgi?id=233170

有一条评论建议使用 NetBeans 中捆绑的 Maven 版本作为解决方法。

【讨论】:

以上是关于来自 Maven 项目中袜子服务器的格式错误的回复的主要内容,如果未能解决你的问题,请参考以下文章

来自 SOCKS 服务器的 Android Orbot 格式错误的回复

袜子 5 UDP 连接

java中的袜子(通过袜子打开)

GuzzleHttp \ Exception \ RequestException cURL错误52:来自服务器的空回复

什么是 curl 错误 52“来自服务器的空回复”?

卷曲错误 - 来自服务器的空回复 (ssl)