Google Adwords API java -> Exception in thread "main" AxisFault

470 views
Skip to first unread message

Rajalakshmi Thangavelu

unread,
Jan 2, 2015, 4:26:43 AM1/2/15
to adwor...@googlegroups.com

Hi Team,

I have connected the Google Adwords through the java and have set all the properties including the client secret,clientid,etc.

I m getting the below error...............



log4j:WARN No appenders could be found for logger (org.apache.commons.configuration.PropertiesConfiguration).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
Exception in thread "main" AxisFault
 faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
 faultSubcode:
 faultString: javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
 faultActor:
 faultNode:
 faultDetail:
    {http://xml.apache.org/axis/}stackTrace:javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
    at sun.security.ssl.Alerts.getSSLException(Unknown Source)
    at sun.security.ssl.SSLSocketImpl.fatal(Unknown Source)
    at sun.security.ssl.Handshaker.fatalSE(Unknown Source)
    at sun.security.ssl.Handshaker.fatalSE(Unknown Source)
    at sun.security.ssl.ClientHandshaker.serverCertificate(Unknown Source)
    at sun.security.ssl.ClientHandshaker.processMessage(Unknown Source)
    at sun.security.ssl.Handshaker.processLoop(Unknown Source)
    at sun.security.ssl.Handshaker.process_record(Unknown Source)
    at sun.security.ssl.SSLSocketImpl.readRecord(Unknown Source)
    at sun.security.ssl.SSLSocketImpl.performInitialHandshake(Unknown Source)
    at sun.security.ssl.SSLSocketImpl.startHandshake(Unknown Source)
    at sun.security.ssl.SSLSocketImpl.startHandshake(Unknown Source)
    at org.apache.axis.components.net.JSSESocketFactory.create(JSSESocketFactory.java:186)
    at org.apache.axis.transport.http.HTTPSender.getSocket(HTTPSender.java:191)
    at org.apache.axis.transport.http.HTTPSender.writeToSocket(HTTPSender.java:404)
    at org.apache.axis.transport.http.HTTPSender.invoke(HTTPSender.java:138)
    at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32)
    at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)
    at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
    at org.apache.axis.client.AxisClient.invoke(AxisClient.java:165)
    at org.apache.axis.client.Call.invokeEngine(Call.java:2784)
    at org.apache.axis.client.Call.invoke(Call.java:2767)
    at org.apache.axis.client.Call.invoke(Call.java:2443)
    at org.apache.axis.client.Call.invoke(Call.java:2366)
    at org.apache.axis.client.Call.invoke(Call.java:1812)
    at com.google.api.ads.adwords.axis.v201406.cm.CampaignServiceSoapBindingStub.get(CampaignServiceSoapBindingStub.java:1364)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at com.google.api.ads.common.lib.soap.SoapClientHandler.invoke(SoapClientHandler.java:109)
    at com.google.api.ads.common.lib.soap.axis.AxisHandler.invokeSoapCall(AxisHandler.java:213)
    at com.google.api.ads.common.lib.soap.SoapServiceClient.callSoapClient(SoapServiceClient.java:64)
    at com.google.api.ads.common.lib.soap.SoapServiceClient.invoke(SoapServiceClient.java:93)
    at $Proxy14.get(Unknown Source)
    at adwords.axis.v201406.basicoperations.GetCampaigns.runExample(GetCampaigns.java:82)
    at adwords.axis.v201406.basicoperations.GetCampaigns.main(GetCampaigns.java:59)
Caused by: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
    at sun.security.validator.PKIXValidator.doBuild(Unknown Source)
    at sun.security.validator.PKIXValidator.engineValidate(Unknown Source)
    at sun.security.validator.Validator.validate(Unknown Source)
    at sun.security.ssl.X509TrustManagerImpl.validate(Unknown Source)
    at sun.security.ssl.X509TrustManagerImpl.checkTrusted(Unknown Source)
    at sun.security.ssl.X509TrustManagerImpl.checkServerTrusted(Unknown Source)
    ... 33 more
Caused by: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
    at sun.security.provider.certpath.SunCertPathBuilder.engineBuild(Unknown Source)
    at java.security.cert.CertPathBuilder.build(Unknown Source)
    ... 39 more

    {http://xml.apache.org/axis/}hostname:UG-dsfdf-536

javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
    at org.apache.axis.AxisFault.makeFault(AxisFault.java:101)
    at org.apache.axis.transport.http.HTTPSender.invoke(HTTPSender.java:154)
    at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32)
    at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)
    at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
    at org.apache.axis.client.AxisClient.invoke(AxisClient.java:165)
    at org.apache.axis.client.Call.invokeEngine(Call.java:2784)
    at org.apache.axis.client.Call.invoke(Call.java:2767)
    at org.apache.axis.client.Call.invoke(Call.java:2443)
    at org.apache.axis.client.Call.invoke(Call.java:2366)
    at org.apache.axis.client.Call.invoke(Call.java:1812)
    at com.google.api.ads.adwords.axis.v201406.cm.CampaignServiceSoapBindingStub.get(CampaignServiceSoapBindingStub.java:1364)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at com.google.api.ads.common.lib.soap.SoapClientHandler.invoke(SoapClientHandler.java:109)
    at com.google.api.ads.common.lib.soap.axis.AxisHandler.invokeSoapCall(AxisHandler.java:213)
    at com.google.api.ads.common.lib.soap.SoapServiceClient.callSoapClient(SoapServiceClient.java:64)
    at com.google.api.ads.common.lib.soap.SoapServiceClient.invoke(SoapServiceClient.java:93)
    at $Proxy14.get(Unknown Source)
    at adwords.axis.v201406.basicoperations.GetCampaigns.runExample(GetCampaigns.java:82)
    at adwords.axis.v201406.basicoperations.GetCampaigns.main(GetCampaigns.java:59)
Caused by: javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
    at sun.security.ssl.Alerts.getSSLException(Unknown Source)
    at sun.security.ssl.SSLSocketImpl.fatal(Unknown Source)
    at sun.security.ssl.Handshaker.fatalSE(Unknown Source)
    at sun.security.ssl.Handshaker.fatalSE(Unknown Source)
    at sun.security.ssl.ClientHandshaker.serverCertificate(Unknown Source)
    at sun.security.ssl.ClientHandshaker.processMessage(Unknown Source)
    at sun.security.ssl.Handshaker.processLoop(Unknown Source)
    at sun.security.ssl.Handshaker.process_record(Unknown Source)
    at sun.security.ssl.SSLSocketImpl.readRecord(Unknown Source)
    at sun.security.ssl.SSLSocketImpl.performInitialHandshake(Unknown Source)
    at sun.security.ssl.SSLSocketImpl.startHandshake(Unknown Source)
    at sun.security.ssl.SSLSocketImpl.startHandshake(Unknown Source)
    at org.apache.axis.components.net.JSSESocketFactory.create(JSSESocketFactory.java:186)
    at org.apache.axis.transport.http.HTTPSender.getSocket(HTTPSender.java:191)
    at org.apache.axis.transport.http.HTTPSender.writeToSocket(HTTPSender.java:404)
    at org.apache.axis.transport.http.HTTPSender.invoke(HTTPSender.java:138)
    ... 21 more
Caused by: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
    at sun.security.validator.PKIXValidator.doBuild(Unknown Source)
    at sun.security.validator.PKIXValidator.engineValidate(Unknown Source)
    at sun.security.validator.Validator.validate(Unknown Source)
    at sun.security.ssl.X509TrustManagerImpl.validate(Unknown Source)
    at sun.security.ssl.X509TrustManagerImpl.checkTrusted(Unknown Source)
    at sun.security.ssl.X509TrustManagerImpl.checkServerTrusted(Unknown Source)
    ... 33 more
Caused by: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
    at sun.security.provider.certpath.SunCertPathBuilder.engineBuild(Unknown Source)
    at java.security.cert.CertPathBuilder.build(Unknown Source)
    ... 39 more

Josh Radcliff (AdWords API Team)

unread,
Jan 2, 2015, 10:13:25 AM1/2/15
to adwor...@googlegroups.com
Hi,

Could you share the code you are using to create your AdWordsSession?

Also, the error suggests that you are using a service account, but as mentioned in our Service Accounts guide:

OAuth2 offline and web flows require user interaction only once: when access to the account is granted. From that point, all operations can be executed with no manual steps until the access token is revoked. We strongly recommend using offline or web flows instead of service accounts unless you need domain-specific features (e.g. impersonation).

Please make sure you remove any sensitive information when posting.

Thanks,
Josh, AdWords API Team

saravana...@ihg.com

unread,
Feb 11, 2016, 3:09:25 PM2/11/16
to AdWords API Forum
Hi,

I am getting the same error and I infact downloaded the certificate for "adwords.google.com" and things worked fine afterwards. However, the very next day it started coming again and so had to download the certificate again. May I know why do I need to download it daily OR is there any resolution available?

Below is the code snippet to get AdwordsSession:

         HttpTransport httpTransport = new NetHttpTransport.Builder().doNotValidateCertificate().build();
        JsonFactory jsonFactory = JacksonFactory.getDefaultInstance();
        InputStreamReader propStream = new InputStreamReader(AdwordsSessionFactory.class.getClassLoader().getResourceAsStream("conf/credentials.json"), "UTF-8");
        GoogleClientSecrets clientSecrets = GoogleClientSecrets.load(jsonFactory, propStream);
        GoogleCredential credential = new GoogleCredential.Builder().setTransport(httpTransport).setJsonFactory(jsonFactory).setClientSecrets(clientSecrets).build();

        AdWordsSession adWordsSession = new AdWordsSession.Builder().from(this.adwordsPropConfiguration).withOAuth2Credential(credential).build();
        return adWordsSession;

Thanks,
Saravanan

Josh Radcliff (AdWords API Team)

unread,
Feb 11, 2016, 7:14:53 PM2/11/16
to AdWords API Forum
Hi Saravanan,

I would talk to your system administrator to see why your cert store is missing the certificate for adwords.google.com. My guess is that you had to download it again the next day because there's some automated process (from your sys admin) that refreshes your cert store each night.

Thanks,
Josh, AdWords API Team

kcau...@gmail.com

unread,
Jan 10, 2018, 7:27:51 PM1/10/18
to AdWords API Forum
Hi there,

We have had the same issue and we don;t know where to download the certificates from. Can you please share a link to the latest Google AdWords certificate to resolve this issue?

Thanks,

Josh Radcliff (AdWords API Team)

unread,
Jan 11, 2018, 2:32:13 PM1/11/18
to AdWords API Forum
Hi,

There are tools for updating your certificate store, but I would definitely check with your system administrator before doing so. Chances are that they have a process in place for keeping certificates up to date that's more reliable than manually importing specific certificates.

Thanks,
Josh, AdWords API Team
Reply all
Reply to author
Forward
0 new messages