Java Jarsigner不使用提供的Proxy

时间:2015-10-05 14:11:58

标签: java proxy jarsigner

我无法让Jarsigner使用HTTPS代理。对于我的系统,我已经配置了http& https代理在/ etc / sysconfig / proxy中。我甚至在Java Control中添加了代理。

使用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消息。

可能是我的代理服务器没有与TSP的此端口通信吗?

1 个答案:

答案 0 :(得分:3)

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

this.elenco_prodotti = function (callBack) {
    var promises=[];
    for (var c = 1; c < 5; c++ /*categoria*/)
    {
        for (var p = 1; p < 5; p++/*pagina*/)
        {
            var sql = //your sql;
            for (var y = 1; y <= 6; y++) {
                for (var x = 1; x <= 8; x++) {

                    var posizione_attuale = y + "-" + x;
                    var testo_query = //more sql;
                    var prom=new Promise(function(resolve,reject)){
                        var loopVars = {c:c,p:p,y:y,x:x};
                        comanda.sincro.query(testo_query, function (prodotto)
                        {
                            resolve({loopVars:loopVars,prodotto:prodotto})
                        });
                        promises.push(prom);
                    }
                }
            }
        }
    }
    Promise.all(promises).then(function(data){
        //this callback executes only when
        //all promises have completed...
        var output="";
        data.forEach(function(){item}{
            var c=item.loopVars.c;
            var p=item.loopVars.p;
            var x=item.loopVars.x;
            var y= item.loopVars.y;
            var prodotto=item.prodotto;
            //build your output string here
        });
        callBack(output);
    });
};