KeywordToolDemo.java

13 views
Skip to first unread message

zk

unread,
Apr 18, 2008, 1:35:24 AM4/18/08
to AdWords API Forum
I have installed AdWords Java client API library, configured ~/
adwords.properties, and compiled KeywordToolDemo.java successfully.
However, I go this error while running the program by passing an URL
as the parameter:

17-Apr-08 4:07:04 PM org.apache.axis.InternalException <init>
SEVERE: Exception:
org.apache.axis.ConfigurationException:
java.lang.IllegalStateException: can't declare any more prefixes in
this context
java.lang.IllegalStateException: can't declare any more prefixes in
this context
at org.apache.crimson.parser.Parser2.parseInternal(Parser2.java:
524)
at org.apache.crimson.parser.Parser2.parse(Parser2.java:305)
at org.apache.crimson.parser.XMLReaderImpl.parse(XMLReaderImpl.java:
442)
at
org.apache.crimson.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:
185)
at org.apache.axis.utils.XMLUtils.newDocument(XMLUtils.java:369)
at org.apache.axis.utils.XMLUtils.newDocument(XMLUtils.java:388)
at
org.apache.axis.configuration.FileProvider.configureEngine(FileProvider.java:
179)
at org.apache.axis.AxisEngine.init(AxisEngine.java:172)
at org.apache.axis.AxisEngine.<init>(AxisEngine.java:156)
at org.apache.axis.client.AxisClient.<init>(AxisClient.java:52)
at org.apache.axis.client.Service.getAxisClient(Service.java:103)
at org.apache.axis.client.Service.<init>(Service.java:112)

==================

Any suggestion is welcome.

AdWords API Advisor

unread,
Apr 24, 2008, 12:22:00 PM4/24/08
to AdWords API Forum
Hello,

This isn't an AdWords API-related error that you're running into, but
rather something triggered by the underlying Axis SOAP framework.

While I'm not entirely sure what's causing the problem, the first
step I'd recommend is to check to make sure that you have mutually
compatible versions of the all dependency libraries in your classpath,
as Googling around a bit for that exception leads to some results that
talk about incompatibilities. The versions of the libraries available
in the downloads section from the Java client library page should all
be mutually compatible:

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

so if you're using those, make sure there isn't anything that clashes
that is listed towards the start of your classpath.

Cheers,
-Jeff Posnick, AdWords API Team

zk

unread,
Apr 27, 2008, 1:52:33 AM4/27/08
to AdWords API Forum
Jeff

Thanks for your response.

I still cannot resolve the issue.

======================================
This is my environment:
$ uname -a
Linux 2.6.22.14-72.fc6 #1 SMP Wed Nov 21 14:10:25 EST 2007 x86_64
x86_64 x86_64 GNU/Linux
$ java -version
java version "1.4.2"
gij (GNU libgcj) version 4.1.2 20070626 (Red Hat 4.1.2-13)
=================================================
This is the setup


Step 1: Download awapi_java_lib_1.0.1.tar.gz from
http://code.google.com/p/google-api-adwords-java/downloads/list
and uncompress to
WORK_DIR/awapi_java_lib_1.0.1/
Step 2: Download lib_jars.tar.gz from http://code.google.com/p/google-api-adwords-java/downloads/list
and uncompress to
WORK_DIR/lib
Step 3: Download includelib_jars.tar.gz from
http://code.google.com/p/google-api-adwords-java/downloads/list
and uncompress to
WORK_DIR/includelib

=====================================
This is the command to compile KeywordToolDemo.java
$ cd WORK_DIR/awapi_java_lib_1.0.1/examples
$ javac -classpath ../lib/adwords-api-1.0.1.jar KeywordToolDemo.java

Although there are warnings. The file KeywordToolDemo.class was
created.

These are the warnings:

----------
1. WARNING in KeywordToolDemo.java (at line 17)
import java.util.HashMap;
^^^^^^^^^^^^^^^^^
The import java.util.HashMap is never used
----------
2. WARNING in KeywordToolDemo.java (at line 19)
import com.google.api.adwords.lib.AdWordsServiceLogger;
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
The import com.google.api.adwords.lib.AdWordsServiceLogger is never
used
----------
3. WARNING in KeywordToolDemo.java (at line 43)
(KeywordToolInterface)
user.getService(user.KEYWORDTOOL_SERVICE);

^^^^^^^^^^^^^^^^^^^
The static field BaseCredentials.KEYWORDTOOL_SERVICE should be
accessed in a static way
----------
3 problems (3 warnings)


========================================
This is the command to execute the tool

Any of the following experiments will generate the same run time
error.

# Experiment 1:
export CLASSPATH=.:$WORK_DIR/awapi_java_lib_1.0.1/lib/adwords-
api-1.0.1.jar:$WORK_DIR/awapi_java_lib_1.0.1/lib:$WORK_DIR/lib:
$WORK_DIR/includelib
java KeywordToolDemo http://www.yahoo.com

# Experiment 2:
export CLASSPATH=.:$WORK_DIR/awapi_java_lib_1.0.1/lib/adwords-
api-1.0.1.jar:$WORK_DIR/lib:$WORK_DIR/includelib
java KeywordToolDemo http://www.yahoo.com

# Experiment 3:
export CLASSPATH=.:$WORK_DIR/awapi_java_lib_1.0.1/lib/adwords-
api-1.0.1.jar:$WORK_DIR/lib
java KeywordToolDemo http://www.yahoo.com

# Experiment 4:
export CLASSPATH=.:$WORK_DIR/awapi_java_lib_1.0.1/lib/adwords-
api-1.0.1.jar:$WORK_DIR/includelib
java KeywordToolDemo http://www.yahoo.com

# Experiment 5:
export CLASSPATH=.:$WORK_DIR/awapi_java_lib_1.0.1/lib/adwords-
api-1.0.1.jar
java KeywordToolDemo http://www.yahoo.com


The error is

26-Apr-08 10:44:48 PM org.apache.axis.InternalException <init>
SEVERE: Exception:
org.apache.axis.ConfigurationException:
java.lang.IllegalStateException: can't declare any more prefixes in
this context
java.lang.IllegalStateException: can't declare any more prefixes in
this context
at org.apache.crimson.parser.Parser2.parseInternal(Parser2.java:
524)
at org.apache.crimson.parser.Parser2.parse(Parser2.java:305)
at org.apache.crimson.parser.XMLReaderImpl.parse(XMLReaderImpl.java:
442)
at
org.apache.crimson.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:
185)
at org.apache.axis.utils.XMLUtils.newDocument(XMLUtils.java:369)
.......


================================


On Apr 24, 9:22 am, AdWords API Advisor <adwordsapiadvi...@google.com>
wrote:
> > org.apache.axis.configuration.FileProvider.configureEngine(FileProvider.jav­a:
> > 179)
> >    at org.apache.axis.AxisEngine.init(AxisEngine.java:172)
> >    at org.apache.axis.AxisEngine.<init>(AxisEngine.java:156)
> >    at org.apache.axis.client.AxisClient.<init>(AxisClient.java:52)
> >    at org.apache.axis.client.Service.getAxisClient(Service.java:103)
> >    at org.apache.axis.client.Service.<init>(Service.java:112)
>
> > ==================
>
> > Any suggestion is welcome.- Hide quoted text -
>
> - Show quoted text -
Reply all
Reply to author
Forward
0 new messages