【发布时间】:2014-09-06 17:18:56
【问题描述】:
我正在尝试使用带有 wsimport 目标的 jaxws-maven-plugin 创建 Web 服务客户端,并带有这个 pom:
<plugin>
<groupId>org.jvnet.jax-ws-commons</groupId>
<artifactId>jaxws-maven-plugin</artifactId>
<version>2.2</version>
<executions>
<execution>
<goals>
<goal>wsimport</goal>
</goals>
</execution>
</executions>
<configuration>
<wsdlUrls>
<wsdlUrl>
https://test.test/WSTtest?wsdl
</wsdlUrl>
</wsdlUrls>
<verbose>true</verbose>
</configuration>
<dependencies>
<dependency>
<groupId>javax.xml</groupId>
<artifactId>webservices-api</artifactId>
<version>1.4</version>
</dependency>
</dependencies>
</plugin>
但我得到了错误
[错误] java.security.cert.CertificateException:找不到与 IP 地址 93.92.169.114 匹配的主题替代名称
因为我需要证书。正如我在SSL client certificate in Maven 阅读的那样,我在我的 POM 中添加了与认证文件位置相关的属性:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>properties-maven-plugin</artifactId>
<version>1.0-alpha-2</version>
<executions>
<execution>
<goals>
<goal>set-system-properties</goal>
</goals>
<configuration>
<properties>
<property>
<name>javax.net.ssl.trustStore</name>
<value>c:\certificate.crt</value>
</property>
</properties>
</configuration>
</execution>
</executions>
</plugin>
但现在我得到了其他错误:
[ERROR] java.security.NoSuchAlgorithmException:构造实现时出错(算法:默认,提供者:SunJSSE,类:sun.security.ssl.SSLContextImpl$DefaultSSLContext)
我在Java Exception on SSLSocket creation 读到的内容似乎与认证文件的格式有关。我试图通过在 POM 中添加具有相同结果的属性来指示文件的类型。
<properties>
<property>
<name>javax.net.ssl.trustStoreType</name>
<value>JCEKS</value>
</property>
<property>
<name>javax.net.ssl.trustStore</name>
<value>c:\certificate.crt</value>
</property>
</properties>
知道如何解决这个问题吗?我做错了什么?这是指示证书文件在哪里的正确方法吗?
谢谢
【问题讨论】:
-
这个答案可能会有所帮助 - stackoverflow.com/a/6483650/2719186
标签: java web-services maven ssl https