Getting PrivilegedActionException: com.sun.xml.internal.messaging.saaj.SOAPExceptionImpl: Message send failed.while invoking web service
I am having https service url. I wrote java client using SAAJ. but i am getting the below exception:--
java.security.PrivilegedActionException: com.sun.xml.internal.messaging.saaj.SOAPExceptionImpl: Message send failed sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
I exported the certificate from service URL (using browser.) and saved as jssecacerts Then imporetd this by using the following command--> keytool -import -file jssecacerts -keystore cacerts
Now I wrote the java client using SAAJ as below:-
System.setProperty("javax.net.ssl.keyStore", "C:/Program Files/Java/jre6/lib/security/cacerts");
System.setProperty("javax.net.ssl.keyStorePassword", "changeit");
UR开发者_StackOverflow中文版L url = new URL("https://whatever.com/service");
SOAPConnectionFactory scf = SOAPConnectionFactory.newInstance();
connection = scf.createConnection();
response = connection.call(message, url);
I dont know where I am wrong...Please help...me....I am in seriously in trouble.. Thanks in Advance..
you don't need to set those system properties. if you successfully imported the certs into the jre's cacerts file, then they should be good to go. i'm assuming you are using the "java" from "C:/Program Files/Java/jre6/bin/java.exe" to actually run your program.
btw, why are you getting a PrivilegedActionException? that implies that you are running with some sort of SecurityManager or within a PrivilegedAction call?
精彩评论