Sample Code GetCampaignIdsDemo gives error - RSA premaster secret error

39 views
Skip to first unread message

merzilla

unread,
Dec 23, 2005, 8:19:40 AM12/23/05
to AdWords API Forum
Hi there,

I´m trying to get the example code running, but i don´t succeed.
I´m using eclipse and API v0.2
The sample code:

package GetCampaignIdsDemo3;

// Copyright 2005 Google Inc.
// All Rights Reserved.

import com.google.api.adwords.lib.AdWordsServiceLogger;
import com.google.api.adwords.lib.CampaignAdWordsService;
import com.google.api.adwords.lib.AdWordsUser;
import com.google.api.adwords.Campaign;

/** * This sample client prints out the campaign ids for all campaigns
* * belonging to the customer issuing the request. */

public class GetCampaignIdsDemo3 {

public static void main(String args[]) throws Exception {

// This shows how to turn on logging of all the XML that gets sent to
// and from the server. This is useful for debugging and support.
// You can comment out this line if you don't want to see its (quite
// verbose) output.
AdWordsServiceLogger.log();

// Get Credentials and Service
AdWordsUser me = new AdWordsUser();
CampaignAdWordsService campaignService = me.newCampaignService();

// Print out all campaign ids
Campaign[] myCampaigns = campaignService.getAllAdWordsCampaigns(1);

// Print name and id for each campaign
for (int i = 0; i < myCampaigns.length; i++) {
System.out.println("Name: " + myCampaigns[i].getName() +
" id: " + myCampaigns[i].getId() +
" status: " + myCampaigns[i].getStatus());
}

// The amount of time spent on the server and the number of operations
// charged against your quota are available from the service object.
// These calls fetch the TOTAL time and operation count over the life
of
// the service object:
System.out.println("Total time on the server was " +
campaignService.getTotalTime() +
" milliseconds");

System.out.println("Total operations on the server was " +
campaignService.getTotalOperationCount());
}

}


always gives the error:

Exception in thread "main" AxisFault
faultCode:
{http://schemas.xmlsoap.org/soap/envelope/}Server.userException
faultSubcode:
faultString: javax.net.ssl.SSLKeyException: RSA premaster secret error
faultActor:
faultNode:
faultDetail:
{http://xml.apache.org/axis/}stackTrace:javax.net.ssl.SSLKeyException:
RSA premaster secret error
at com.sun.net.ssl.internal.ssl.PreMasterSecret.&lt;init&gt;(Unknown
Source)
at
com.sun.net.ssl.internal.ssl.ClientHandshaker.serverHelloDone(Unknown
Source)
at
com.sun.net.ssl.internal.ssl.ClientHandshaker.processMessage(Unknown
Source)
at com.sun.net.ssl.internal.ssl.Handshaker.processLoop(Unknown Source)
at com.sun.net.ssl.internal.ssl.Handshaker.process_record(Unknown
Source)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(Unknown
Source)
at
com.sun.net.ssl.internal.ssl.SSLSocketImpl.performInitialHandshake(Unknown
Source)
at com.sun.net.ssl.internal.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:2765)
at org.apache.axis.client.Call.invoke(Call.java:2748)
at org.apache.axis.client.Call.invoke(Call.java:2424)
at org.apache.axis.client.Call.invoke(Call.java:2347)
at org.apache.axis.client.Call.invoke(Call.java:1804)
at
com.google.api.adwords.CampaignServiceSoapBindingStub.getAllAdWordsCampaigns(CampaignServiceSoapBindingStub.java:465)
at
com.google.api.adwords.lib.BaseCredentials$7.getAllAdWordsCampaigns(BaseCredentials.java:1245)
at
GetCampaignIdsDemo3.GetCampaignIdsDemo3.main(GetCampaignIdsDemo3.java:29)
Caused by: java.security.NoSuchAlgorithmException: Cannot find any
provider supporting RSA/ECB/PKCS1Padding
at javax.crypto.Cipher.getInstance(DashoA12275)
at com.sun.net.ssl.internal.ssl.JsseJce.getCipher(Unknown Source)
at com.sun.net.ssl.internal.ssl.RSACipher.&lt;init&gt;(Unknown Source)
at com.sun.net.ssl.internal.ssl.RSACipher.getInstance(Unknown Source)
... 24 more

{http://xml.apache.org/axis/}hostname:merzilla

javax.net.ssl.SSLKeyException: RSA premaster secret error
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:2765)
at org.apache.axis.client.Call.invoke(Call.java:2748)
at org.apache.axis.client.Call.invoke(Call.java:2424)
at org.apache.axis.client.Call.invoke(Call.java:2347)
at org.apache.axis.client.Call.invoke(Call.java:1804)
at
com.google.api.adwords.CampaignServiceSoapBindingStub.getAllAdWordsCampaigns(CampaignServiceSoapBindingStub.java:465)
at
com.google.api.adwords.lib.BaseCredentials$7.getAllAdWordsCampaigns(BaseCredentials.java:1245)
at
GetCampaignIdsDemo3.GetCampaignIdsDemo3.main(GetCampaignIdsDemo3.java:29)
Caused by: javax.net.ssl.SSLKeyException: RSA premaster secret error
at com.sun.net.ssl.internal.ssl.PreMasterSecret.<init>(Unknown Source)
at
com.sun.net.ssl.internal.ssl.ClientHandshaker.serverHelloDone(Unknown
Source)
at
com.sun.net.ssl.internal.ssl.ClientHandshaker.processMessage(Unknown
Source)
at com.sun.net.ssl.internal.ssl.Handshaker.processLoop(Unknown Source)
at com.sun.net.ssl.internal.ssl.Handshaker.process_record(Unknown
Source)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(Unknown
Source)
at
com.sun.net.ssl.internal.ssl.SSLSocketImpl.performInitialHandshake(Unknown
Source)
at com.sun.net.ssl.internal.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)
... 12 more
Caused by: java.security.NoSuchAlgorithmException: Cannot find any
provider supporting RSA/ECB/PKCS1Padding
at javax.crypto.Cipher.getInstance(DashoA12275)
at com.sun.net.ssl.internal.ssl.JsseJce.getCipher(Unknown Source)
at com.sun.net.ssl.internal.ssl.RSACipher.<init>(Unknown Source)
at com.sun.net.ssl.internal.ssl.RSACipher.getInstance(Unknown Source)
... 24 more
23.12.2005 11:57:18 org.apache.axis.transport.http.HTTPSender invoke
FEIN: Enter: HTTPSender::invoke
23.12.2005 11:57:18 org.apache.axis.transport.http.HTTPSender invoke
FEIN: javax.net.ssl.SSLKeyException: RSA premaster secret error


I don´t know what´s wrong here. The credentials are in the seperated
file ".adwords-api.properties"

The only sample that works is the ApiExceptionDemo.
When I use the sample GetCampaignIdsDemo from the API v0.1, I always
get an NullPointerException in the line with for(i...; .length; ...)...

I used to post that problem too on Nov. 15th, but Patrick stopped
helping me after his first tip.
For that I´m not able to write another question in that thread, i´m
starting this new one with the hope that someone has a know-how with
that kind of errors.

Thanks a lot for all your help!

Merzilla

Dmitry Trunikov

unread,
Dec 23, 2005, 8:29:06 AM12/23/05
to merzilla, AdWords API Forum
merzilla wrote:

>Hi there,
>
>I惴 trying to get the example code running, but i don愒 succeed.
>I惴 using eclipse and API v0.2

>I don愒 know what愀 wrong here. The credentials are in the seperated


>file ".adwords-api.properties"
>
>The only sample that works is the ApiExceptionDemo.
>When I use the sample GetCampaignIdsDemo from the API v0.1, I always
>get an NullPointerException in the line with for(i...; .length; ...)...
>
>I used to post that problem too on Nov. 15th, but Patrick stopped
>helping me after his first tip.

>For that I惴 not able to write another question in that thread, i惴


>starting this new one with the hope that someone has a know-how with
>that kind of errors.
>
>Thanks a lot for all your help!
>
>Merzilla
>
>
>
>

Hi Merzilla.
AFAIK this error is eclipse-specific.
See http://forum.java.sun.com/thread.jspa?threadID=587480&messageID=3033184.

P.S. Try run your sample form command line.

Reply all
Reply to author
Forward
0 new messages