1

我们正在为我们的项目使用 JDK 1.7,它直到上周都运行良好,但现在它失败并出现以下错误,

jarsigner:无法签名 jar:javax.net.ssl.SSLHandshakeException:握手期间远程主机关闭连接

我开始知道这个问题是由于用于与时间戳服务器通信的协议,但我不确定如何通过 pom.xml 将参数传递给 jdk 以强制它使用 TLSv1.2

我的 Pom.xml 文件

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

    <parent>
        <groupId>com.project.dews.common</groupId>
        <artifactId>CommonPom</artifactId>
        <version>2.2-SNAPSHOT</version>
        <relativePath>..</relativePath>
    </parent>

    <modelVersion>4.0.0</modelVersion>
    <artifactId>UserNameApplet</artifactId>
    <version>2.2-SNAPSHOT</version>
    <packaging>jar</packaging>
    <name>User Name Applet</name>
    <build>
    <plugins>
        <plugin>
            <artifactId>maven-jar-plugin</artifactId>
            <configuration>
                <archive>
                    <addMavenDescriptor>false</addMavenDescriptor>
                    <manifestEntries>
                        <Trusted-Library>true</Trusted-Library>
                        <Permissions>all-permissions</Permissions>
                        <Codebase>*</Codebase>
                        <Caller-Allowable-Codebase>*</Caller-Allowable-Codebase>
                    </manifestEntries>
                </archive>
            </configuration>
        </plugin>
        <plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-jarsigner-plugin</artifactId>
            <executions>
                <execution>
                    <goals>
                        <goal>sign</goal>
                        <!--<goal>verify</goal>-->
                    </goals>
                    <phase>package</phase>
                    <configuration>
                        <keystore>src/main/keystore/keystore.ks</keystore>
                        <alias>85034585a-17b9-4a50-53e79d3a86345</alias>
                        <storepass>password</storepass>
                        <keypass>password</keypass>
                        <arguments>
                            <argument>-tsa</argument>
                            <argument>https://timestamp.geotrust.com/tsa</argument>
                        </arguments>
                        <!--<verbose>true</verbose>-->
                        <!--<certs>true</certs>-->
                    </configuration>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>
</project>

构建错误

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-jarsigner-plugin:1.4:sign (default) on project UserNameApplet: Failed executing 'cmd.exe /X /C ""C:\JAVA 7\jdk1.7.0_71\jre\..\bin\jarsigner.exe" -keystore src/main/keystore/keystore.ks -storepass ***** -tsa https://timestamp.geotrust.com/tsa -keypass ***** C:\2.X_Dev_Code_SVN\Project\Common\Applet\target\UserNameApplet-2.1-SNAPSHOT.jar 85034585a-17b9-4a50-53e79d3a86345"' - exitcode 1 -> 
        [INFO] jarsigner: unable to sign jar:    javax.net.ssl.SSLHandshakeException: Remote host closed connection during handshake

我尝试从 java 控制面板禁用 TLSv1.0 和 TLSv1.1 并使用 jdk.tls.disabledAlgorithms= SSLv2Hello, SSLv3, TLSv1, TLSv1.1 从 java.security 禁用它,但我在这两种情况下都失败了,对我来说也是如此我只需要从 pom.xml 解决问题。

任何解决此问题的建议将不胜感激。

4

0 回答 0