Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

java.lang.NullPointerException while trying to get a traffic estimation report on v201409 #28

Closed
Guaramy opened this issue Nov 25, 2014 · 5 comments

Comments

@Guaramy
Copy link

Guaramy commented Nov 25, 2014

I'm trying to run the example that is on this rep to get a traffic estimation for some keywords and I keep getting that exception.

I have followed everything in the readme file and I'm not using maven only jar.

I have tried to run a bunch of others examples and it works just fine

@jradcliff
Copy link
Member

Could you provide a stack trace for the NullPointerException? I was able to run the example without issue just now.

Also, please indicate which version of the AdWords API you are using (v201406 or v201409).

Thanks

@Guaramy
Copy link
Author

Guaramy commented Nov 26, 2014

Hi Josh,

Exception in thread "main" java.lang.NullPointerException
at
adwords.axis.v201409.optimization.EstimateKeywordTraffic.runExample(EstimateKeywordTraffic.java:144)
at
adwords.axis.v201409.optimization.EstimateKeywordTraffic.main(EstimateKeywordTraffic.java:70)

this is what I get every time that I try to compile the
EstimateKeywordTraffic example, every other one works just fine in my
machine.

Thanks for your reply,

Best

Jorge

On Tue, Nov 25, 2014 at 7:39 PM, Josh Radcliff notifications@github.com
wrote:

Could you provide a stack trace for the NullPointerException? I was able
to run the example without issue just now.

Also, please indicate which version of the AdWords API you are using
(v201406 or v201409).

Thanks


Reply to this email directly or view it on GitHub
#28 (comment)
.

@jradcliff
Copy link
Member

Thanks - a NullPointerException at that point means that the keyword you were searching for resulted in a KeywordEstimate with null attributes.

// Find the mean of the min and max values.
double meanAverageCpc =
    (keywordEstimate.getMin().getAverageCpc().getMicroAmount() + keywordEstimate.getMax()
        .getAverageCpc().getMicroAmount()) / 2.0;

Which keywords did you include in your request (starting at line 83)? I haven't been able to produce a request that results in null attributes on a KeywordEstimate.

@Guaramy
Copy link
Author

Guaramy commented Nov 27, 2014

Hi Josh,

I haven't change the code, the keywords are exactly the ones from the
example.
I also have this warning message
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.

and since the issue is that I'm receiving a null answer from the API could
that be the issue?

Best

On Wed, Nov 26, 2014 at 9:57 PM, Josh Radcliff notifications@github.com
wrote:

Thanks - a NullPointerException at that point means that the keyword you
were searching for resulted in a KeywordEstimate with null attributes.

// Find the mean of the min and max values.
double meanAverageCpc =
(keywordEstimate.getMin().getAverageCpc().getMicroAmount() + keywordEstimate.getMax()
.getAverageCpc().getMicroAmount()) / 2.0;

Which keywords did you include in your request (starting at line 83)? I
haven't been able to produce a request that results in null attributes on a
KeywordEstimate.


Reply to this email directly or view it on GitHub
#28 (comment)
.

@jradcliff
Copy link
Member

Let's continue the discussion on your forum post, as it looks like this is a problem with your setup, not the Java library.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants