Java Jarsigner 不使用提供的代理

Java Jarsigner does not use provided Proxy

我无法让 Jarsigner 使用 HTTPS 代理。对于我的系统,我在 /etc/sysconfig/proxy 中配置了 http 和 https 代理。我什至在 Java 控件中添加了代理。

检查 wget 和代理确实有效:

user@machineLinx:~/workspace/myApp> wget     https://timestamp.geotrust.com/tsa
--2015-10-05 16:06:30--  https://timestamp.geotrust.com/tsa
Resolving proxy.spacetec.no... 100.11.4.6
Connecting to proxy.spacetec.no|100.11.4.6|:3128... connected.
Proxy request sent, awaiting response... 404 Not Found
2015-10-05 16:06:31 ERROR 404: Not Found.

使用 Jarsigner 不使用提供的代理:

/usr/java/jdk1.7.0_80/bin/jarsigner -J-Dhttps.proxyHost=http://proxy.company.com -J-Dhttps.proxyPort=3128 -keystore /home/user/keystore.p12 -storepass myStorePass -storetype pkcs12 -tsa https://timestamp.geotrust.com/tsa workspace/myApp/target/myApp-1.0.0-SNAPSHOT.jar alias

jarsigner: unable to sign jar: no response from the Timestamping Authority. When connecting from behind a firewall an HTTP or HTTPS proxy may need to be specified. Supply the following options to jarsigner:
  -J-Dhttp.proxyHost=<hostname>
  -J-Dhttp.proxyPort=<portnumber>
or
  -J-Dhttps.proxyHost=<hostname> 
  -J-Dhttps.proxyPort=<portnumber> 

那么,为什么代理在我的系统上工作,但在 Java 上却不工作?我试过 jdk1.7.0_80 和 jdk1.8.0_60

jarsigner 使用 RFC 3161 中定义的时间戳协议 (TSP) 与 TSA 通信。该协议基本上假定 TSA 上的侦听器进程可以在明确定义的端口(IP 端口号 318)上接受 TSA 消息).

会不会是我的Proxy为了TSP没有和这个端口通信?

从代理主机中删除了 http:// 修复了这个问题

-J-Dhttps.proxyHost=proxy.company.com -J-Dhttps.proxyPort=3128