java - SunCertPathBuilderException => Maven JAXB2 generation with certificate -
i'm using maven-jaxb2, generate classes make calls webservice.
<plugin> <groupid>org.jvnet.jaxb2.maven2</groupid> <artifactid>maven-jaxb2-plugin</artifactid> <version>0.12.3</version> <configuration> <schemalanguage>wsdl</schemalanguage> <schemas> <schema> <url>https://my-secured-webservice.com/file?wsdl</url> </schema> </schemas> <generatedirectory>src\main\java</generatedirectory> <verbose>true</verbose> </configuration> <executions> <execution> <phase>generate-sources</phase> <goals> <goal>generate</goal> </goals> </execution> </executions> </plugin>
the wsdl needs certificate correctly installed on machine. can access wsdl browser.
i've added 2 properties properties-maven-plugin
<property> <name>javax.net.ssl.keystore</name> <value>/path/to/jks/file.jks</value> </property> <property> <name>javax.net.ssl.keystorepassword</name> <value>my-super-secret-password</value> </property>
i've created jks file by:
keytool -importkeystore -deststorepass my-super-secret-password -destkeystore /path/to/jks/file.jks -srckeystore /path/to/file.p12 -srcstoretype pkcs12
when i'm triggering mvn:generate-sources, i've got following error popping up:
com.sun.istack.saxparseexception2; ioexception thrown when processing "https://my-secured-webservice.com/file?wsdl". exception: javax.net.ssl.sslhandshakeexception: sun.security.validator.validatorexception: pkix path building failed: sun.security.provider.certpath.suncertpathbuilderexception: unable find valid certification path requested target.
what doing wrong?
i'm sorry.. fixed on own:
i've picked certificate de wsdl location. (i've used chrome download .crt file)
then:
sudo keytool -importcert -file /path/to/downloaded/certificate.crt -alias myalias -keystore $java_home/jre/lib/security/cacerts
so imported certificate cacerts..
Comments
Post a Comment