java.lang.ClassNotFoundException: com.google.api.client.util.Preconditions

2,484 views
Skip to first unread message

F.Pers

unread,
Mar 22, 2013, 3:03:45 PM3/22/13
to adwor...@googlegroups.com
Hi

im trying to use oAuth2 with the webServerClient connection, and i get a "java.lang.ClassNotFoundException: com.google.api.client.util.Preconditions" when executing the following code:

[code]
GoogleAuthorizationCodeFlow authorizationFlow = new GoogleAuthorizationCodeFlow.Builder(
                new NetHttpTransport(),
                new JacksonFactory(),
                CLIENT_ID,
                CLIENT_SECRET,
                Lists.newArrayList(SCOPE))
        .setApprovalPrompt("force")
        // Set the access type to offline so that the token can be refreshed.
        .setAccessType("offline").build();
[/code]

Can anybody tell me why or what code to use instead because i do have the access to the package com.google.api.client.util. but there really is no such class called Preconditions.

greez

F.Per

unread,
Mar 22, 2013, 4:59:19 PM3/22/13
to adwor...@googlegroups.com

Takeshi Hagikura (AdWords API Team)

unread,
Mar 25, 2013, 2:19:26 AM3/25/13
to adwor...@googlegroups.com
Hi,

It's most likely you are missing some dependent jars.
Are you using Maven?
Either way, please read this quick start guide to setup the development environment.

Best,
- Takeshi

JVSrvcs

unread,
Jun 26, 2013, 4:01:48 PM6/26/13
to adwor...@googlegroups.com
I am getting the same error.  I am using Maven, something is mucked up with the poms if this class cannot be found.  Any solution so far?

JVSrvcs

unread,
Jun 26, 2013, 4:02:58 PM6/26/13
to adwor...@googlegroups.com
I am getting the same error and using Maven, something is mucked up with the poms that needs to be fixed.  I do not know which jar this class is to be found.  This was working with an earlier version of the API jar in my pom, I just updated to the latest version and now have a problem finding this class and cannot compile.  any ideas?

JVSrvcs

unread,
Jun 26, 2013, 4:05:12 PM6/26/13
to adwor...@googlegroups.com
I am using Maven and things will compile, this error only appears at runtime.  It looks like Preconditions is instantiated at runtime and cannot be found.


On Monday, March 25, 2013 12:19:26 AM UTC-6, Takeshi Hagikura (AdWords API Team) wrote:

Takeshi Hagikura (AdWords API Team)

unread,
Jul 2, 2013, 1:23:37 PM7/2/13
to adwor...@googlegroups.com
Hi, 

Can you please try running the GetRefreshToken example via the command line with the adwords-axis-example.1-17.0.tar.gz?
(Please refer these steps)

I also tested using the same bundle and it worked well. 
If it works from the command line, there should be an environmental issue with your web application setting. 

Best,
- Takeshi

Danilo

unread,
Jul 2, 2013, 3:44:10 PM7/2/13
to adwor...@googlegroups.com

Takeshi Hagikura (AdWords API Team)

unread,
Jul 3, 2013, 2:57:58 AM7/3/13
to adwor...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages