Problem with Running Sample Code...

69 views
Skip to first unread message

jadefire21

unread,
Jul 18, 2008, 6:47:52 PM7/18/08
to AdWords API Forum
I am having a problem with running the API example at
http://code.google.com/p/adwords-api-java-samples/source/browse/trunk/src/GetClientAccounts.java

I have changed my email, password, useragent, developerToken and
applicationToken variable at the top of the file to match my account
information and I recieve the following stack trace when I run the
application:

java.lang.NullPointerException
at
com.google.api.adwords.v11.AccountServiceSoapBindingStub.getClientAccounts_aroundBody3$advice(AccountServiceSoapBindingStub.java:
146)
at
com.google.api.adwords.v11.AccountServiceSoapBindingStub.getClientAccounts(AccountServiceSoapBindingStub.java:
1)
at
com.greggharrington.beehive.googlebee.poc.GoogleAdwordsPOC.main(GoogleAdwordsPOC.java:
54)

I have tired other code samples and get essentially the same stack
trace. Here is a example of one recieved after running the example
located at http://code.google.com/p/adwords-api-java-samples/source/browse/trunk/src/GetAllCampaigns.java

java.lang.NullPointerException
at
com.google.api.adwords.v11.CampaignServiceSoapBindingStub.getAllAdWordsCampaigns_aroundBody5$advice(CampaignServiceSoapBindingStub.java:
146)
at
com.google.api.adwords.v11.CampaignServiceSoapBindingStub.getAllAdWordsCampaigns(CampaignServiceSoapBindingStub.java:
1)
at
com.greggharrington.beehive.googlebee.poc.GoogleAdwordsPOC2.main(GoogleAdwordsPOC2.java:
54)

Any help would be greatly appreciated...

Cheers,

Gregg

AdWords API Advisor

unread,
Jul 22, 2008, 2:54:06 PM7/22/08
to AdWords API Forum
Hello Gregg,

There's not much to that sample code, so I'd think that this could be
an environment issue--are you sure you have a working set of Axis
libraries that you used to generate the stub classes from the WSDLs?

As an alternative to using that sample code you can go the route of
using our Java client library, which is also based on Axis-generated
stub classes but which implements some of the housekeeping that you'd
otherwise have to do. There are also links to download the specific
versions of Axis that we know should work with the client library.
More info on the Java client library is available at

http://code.google.com/p/google-api-adwords-java/

Cheers,
-Jeff Posnick, AdWords API Team


On Jul 18, 6:47 pm, jadefire21 <gr...@greggharrington.com> wrote:
> I am having a problem with running the API example athttp://code.google.com/p/adwords-api-java-samples/source/browse/trunk...
>
> I have changed my email, password, useragent, developerToken and
> applicationToken variable at the top of the file to match my account
> information and I recieve the following stack trace when I run the
> application:
>
> java.lang.NullPointerException
> at
> com.google.api.adwords.v11.AccountServiceSoapBindingStub.getClientAccounts_aroundBody3$advice(AccountServiceSoapBindingStub.java:
> 146)
> at
> com.google.api.adwords.v11.AccountServiceSoapBindingStub.getClientAccounts(AccountServiceSoapBindingStub.java:
> 1)
> at
> com.greggharrington.beehive.googlebee.poc.GoogleAdwordsPOC.main(GoogleAdwordsPOC.java:
> 54)
>
> I have tired other code samples and get essentially the same stack
> trace. Here is a example of one recieved after running the example
> located athttp://code.google.com/p/adwords-api-java-samples/source/browse/trunk...

jadefire21

unread,
Jul 25, 2008, 4:16:16 PM7/25/08
to AdWords API Forum, gr...@consult530.com
Jeff,

Thank you for your response. I am sorry I didn't include my full
environment details in the original post. I am using the jar file from
the Google Adwords API v.1.0.1 from http://code.google.com/p/google-api-adwords-java/

I also noticed two .jar files in there. I am using the one that is pre
bundled with the libraries called adwords-api-1.0.1.jar and _not_ the
adwords-api-1.0.1-loner.jar

Cheers,

Gregg


On Jul 22, 11:54 am, AdWords API Advisor

AdWords API Advisor

unread,
Aug 1, 2008, 11:45:01 AM8/1/08
to AdWords API Forum
Hello Gregg,

If you're using the packaged client library from
http://code.google.com/p/google-api-adwords-java/ then you should try
using the samples provided with the client library. The samples at
http://code.google.com/p/adwords-api-java-samples/ are intended to be
client library-agnostic and generic enough for folks who are
generating their own class stubs from the WSDLs using Axis.

There are instructions on running the sample code in the README file
bundled in the client library (though please see
http://groups.google.com/group/adwords-api/browse_thread/thread/03b11df63a07615c
for another thread about getting the Java sample code to work).

Cheers,
-Jeff Posnick, AdWords API Team


On Jul 25, 4:16 pm, jadefire21 <gr...@greggharrington.com> wrote:
> Jeff,
>
> Thank you for your response. I am sorry I didn't include my full
> environment details in the original post. I am using the jar file from
> the Google Adwords API v.1.0.1 fromhttp://code.google.com/p/google-api-adwords-java/

Sean Molloy

unread,
Aug 3, 2008, 10:09:11 PM8/3/08
to AdWords API Forum
I am suffering the exact same error. I am using the samples provided
and trying to do EITHER "GetClientAccounts" or "GetAllCampaigns", but
all I get is the same null pointer exception.

java.lang.NullPointerException

com.google.api.adwords.v11.AccountServiceSoapBindingStub.getClientAccounts_aroundBody3$advice(AccountServiceSoapBindingStub.java:
146)

com.google.api.adwords.v11.AccountServiceSoapBindingStub.getClientAccounts(AccountServiceSoapBindingStub.java:
1)

This null is coming from within the ad words code, so something is not
right.

On Aug 1, 9:45 am, AdWords API Advisor <adwordsapiadvi...@google.com>
wrote:
> Hello Gregg,
>
> If you're using the packaged client library fromhttp://code.google.com/p/google-api-adwords-java/then you should try
> using the samples provided with the client library. The samples athttp://code.google.com/p/adwords-api-java-samples/are intended to be
> client library-agnostic and generic enough for folks who are
> generating their own class stubs from the WSDLs using Axis.
>
> There are instructions on running the sample code in the README file
> bundled in the client library (though please seehttp://groups.google.com/group/adwords-api/browse_thread/thread/03b11...

Sean Molloy

unread,
Aug 3, 2008, 10:23:32 PM8/3/08
to AdWords API Forum
In fact, I can change all kinds of the string values and get the same
null pointer. I also should note that the sample DOES NOT COMPILE
with the includes. The sample includes the following:

import com.google.adwords.api.adwords.v11.AccountInterface;

But the ACTUAL package path (from the JAR) is:

import com.google.api.adwords.v11.AccountInterface;

So the samples are already a little sketchy.

On Aug 3, 8:09 pm, Sean Molloy <sean.mol...@paradoxdigital.com> wrote:
> I am suffering the exact same error. I am using the samples provided
> and trying to do EITHER "GetClientAccounts" or "GetAllCampaigns", but
> all I get is the same null pointer exception.
>
> java.lang.NullPointerException
>
> com.google.api.adwords.v11.AccountServiceSoapBindingStub.getClientAccounts_aroundBody3$advice(AccountServiceSoapBindingStub.java:
> 146)
>
> com.google.api.adwords.v11.AccountServiceSoapBindingStub.getClientAccounts(AccountServiceSoapBindingStub.java:
> 1)
>
> This null is coming from within the ad words code, so something is not
> right.
>
> On Aug 1, 9:45 am, AdWords API Advisor <adwordsapiadvi...@google.com>
> wrote:
>
> > Hello Gregg,
>
> > If you're using the packaged client library fromhttp://code.google.com/p/google-api-adwords-java/thenyou should try
> > using the samples provided with the client library. The samples athttp://code.google.com/p/adwords-api-java-samples/areintended to be

AdWords API Advisor

unread,
Aug 4, 2008, 1:59:30 PM8/4/08
to AdWords API Forum
Hello Sean,

I'm sorry that this is a little confusing, but to clarify: Google
provides an "official" client library for Java, available at
http://code.google.com/p/google-api-adwords-java/. The client library
is meant to be a standalone way to get started writing Java
applications against the AdWords API without having to worry about
generating your own stub classes from our WSDLs, and it also takes
care of things like logging and API unit usage tracking. The namespace
for the classes provided by the client library is
com.google.api.adwords.v1x.*. The client library ships with what
should be working samples that can be run against the client
library .jars out of the box.

Independent of the client library is our generic Java sample code,
available at http://code.google.com/p/adwords-api-java-samples/. This
code is meant to be a "reference" implementation of certain API
methods, and we link to it inline from the AdWords API developer
guide. Equivalent code is available in many languages other than Java.
It's not meant to compile and run against the client library, but you
can get it working if you generate your own stub classes using the
Axis framework. This code uses the
com.google.adwords.api.adwords.v1x.* namespace.

So, in short, if you're planning on using the client library and want
to try some examples that should work out of the box, the code that
ships with the client library in the "examples" directory should be
your first stop.

Cheers,
-Jeff Posnick, AdWords API Team


On Aug 3, 10:23 pm, Sean Molloy <sean.mol...@paradoxdigital.com>
wrote:
> In fact, I can change all kinds of the string values and get the same
> null pointer.  I also should note that the sample DOES NOT COMPILE
> with the includes.  The sample includes the following:
>
> import com.google.adwords.api.adwords.v11.AccountInterface;
>
> But the ACTUAL package path (from the JAR) is:
>
> import com.google.api.adwords.v11.AccountInterface;
>
> So the samples are already a little sketchy.
>
> On Aug 3, 8:09 pm, Sean Molloy <sean.mol...@paradoxdigital.com> wrote:
>
> > I am suffering the exact same error.  I am using the samples provided
> > and trying to do EITHER "GetClientAccounts" or "GetAllCampaigns", but
> > all I get is the same null pointer exception.
>
> > java.lang.NullPointerException
>
> > com.google.api.adwords.v11.AccountServiceSoapBindingStub.getClientAccounts_aroundBody3$advice(AccountServiceSoapBindingStub.java:
> > 146)
>
> > com.google.api.adwords.v11.AccountServiceSoapBindingStub.getClientAccounts(AccountServiceSoapBindingStub.java:
> > 1)
>
> > This null is coming from within the ad words code, so something is not
> > right.
>
> > On Aug 1, 9:45 am, AdWords API Advisor <adwordsapiadvi...@google.com>
> > wrote:
>
> > > Hello Gregg,
>
> > >  If you're using the packaged client library fromhttp://code.google.com/p/google-api-adwords-java/thenyoushould try
> > > using the samples provided with the client library. The samples athttp://code.google.com/p/adwords-api-java-samples/areintendedto be
Reply all
Reply to author
Forward
0 new messages