我有一個需要在Maven項目中使用的HTTPS WSDL URL(https://hostname/MyApp/MyApp.svc?wsdl)。 WSDL上的證書已過期併發布到hostname.company.com。CertificateException:沒有找到與找到的主機名匹配的名字Maven
我有下面的代碼中的Maven的pom.xml
<dependencies>
<dependency>
<groupId>com.sun.xml.ws</groupId>
<artifactId>jaxws-rt</artifactId>
<scope>compile</scope>
<version>2.1.3</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>jaxws-maven-plugin</artifactId>
<version>1.10</version>
<executions>
<execution>
<goals>
<goal>wsimport</goal>
</goals>
<configuration>
<sourceDestDir>${project.build.directory}/generated-sources/jaxws-wsimport</sourceDestDir>
<wsdlUrls>
<wsdlUrl>https://hostname/MyApp/MyApp.svc?wsdl</wsdlUrl>
</wsdlUrls>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
當我做一個乾淨而建,我獲得以下錯誤
[jaxws:wsimport]
Processing: https://hostname/MyApp/MyApp.svc?wsdl
jaxws:wsimport args: [-s, C:\WorkspaceNetBeans\Maven\WSTest\target\generated-sources\jaxws-wsimport, -d, C:\WorkspaceNetBeans\Maven\WSTest\target\classes, https://hostname/MyApp/MyApp.svc?wsdl]
parsing WSDL...
java.security.cert.CertificateException: No name matching hostname found
Failed to read the WSDL document: https://hostname/MyApp/MyApp.svc?wsdl, because 1) could not find the document; /2) the document could not be read; 3) the root element of the document is not <wsdl:definitions>.
failed.noservice=Could not find wsdl:service in the provided WSDL(s):
At least one WSDL with at least one service definition needs to be provided.
Failed to parse the WSDL.
我添加的證書使用密鑰工具實用程序密鑰庫。我還需要做什麼?
我有一個類似的問題,使用Apache作爲我的服務LB,如果您使用的是Apache和虛擬主機,可能您的虛擬主機不會與maven使用的名稱匹配。嘗試使用-Djavax.net.debug = SSL來運行maven,它可以提出關於SSL錯誤的一些提示。 –