Failing to access Analytics via Java

559 views
Skip to first unread message

Nils

unread,
Jan 11, 2013, 6:41:35 AM1/11/13
to google-analytics...@googlegroups.com
Hi,

I am trying for hours already to access the Analytics API. I found different tutorials but none of them worked since the code was too old I guess.

I also tried the one provided by Google:

I worked myself through step by step but unfortunately I couldn't get through. Even though I included ALL libs from google-api-java-client-1.12.0-beta, there are a few classes missing:
Analytics
OAuth2Native
AnalyticsScopes

May be there are more missing, but thats only from the first step where actual code is written.

Could somebody help me by giving me a link to a tutorial (for dummies) that acutally works or even has simple sample projekt as zip to download from somewhere?

Would be awesome!

Nick

unread,
Jan 11, 2013, 12:55:39 PM1/11/13
to google-analytics...@googlegroups.com

Nils

unread,
Jan 14, 2013, 3:58:10 AM1/14/13
to google-analytics...@googlegroups.com
Hi Nick,

thanks for your reply. I tried that, but as I understand I have to install Maven and Mercuri to have that example running. I have trouble installing maven though, because somehow I am not able to set the system variables correctly. (I think it is because of the way the work environment is set up here in my office.)

So is there a way so have that sample running withough installing maven?

Best, Nils

Nils

unread,
Jan 14, 2013, 9:44:47 AM1/14/13
to google-analytics...@googlegroups.com
Well, I just tried to copy the source-code and importet the jres manually. 
Now I am getting this:

java.lang.NoClassDefFoundError: javax/servlet/http/HttpServletRequest
at com.google.api.client.extensions.jetty.auth.oauth2.LocalServerReceiver.getRedirectUri(LocalServerReceiver.java:98)
at com.google.api.client.extensions.java6.auth.oauth2.AuthorizationCodeInstalledApp.authorize(AuthorizationCodeInstalledApp.java:76)
at com.google.api.services.samples.analytics.cmdline.HelloAnalyticsApiSample.authorize(HelloAnalyticsApiSample.java:109)
at com.google.api.services.samples.analytics.cmdline.HelloAnalyticsApiSample.initializeAnalytics(HelloAnalyticsApiSample.java:121)
at com.google.api.services.samples.analytics.cmdline.HelloAnalyticsApiSample.main(HelloAnalyticsApiSample.java:72)


Who knows how to resolve that problem?

Best regards

Bikesh Kumar

unread,
May 15, 2013, 4:00:01 AM5/15/13
to google-analytics...@googlegroups.com
add servlet api to resove it.

u bestt

unread,
Dec 31, 2014, 5:19:35 AM12/31/14
to google-analytics...@googlegroups.com
Hi,

I am trying for hours already to access the Analytics API.

I worked myself through step by step but unfortunately I couldn't get through. Even though I included ALL libs from google-api-java-client and servelt api
its shows exception
Throwable: javax/servlet/http/HttpServletRequest

java.lang.NoClassDefFoundError: javax/servlet/http/HttpServletRequest
    at com.google.api.client.extensions.jetty.auth.oauth2.LocalServerReceiver.getRedirectUri(LocalServerReceiver.java:98)
    at com.google.api.client.extensions.java6.auth.oauth2.AuthorizationCodeInstalledApp.authorize(AuthorizationCodeInstalledApp.java:76)
    at Auth.authorize(Auth.java:75)
    at YouTubeAnalyticsReports.main(YouTubeAnalyticsReports.java:73)
Caused by: java.lang.ClassNotFoundException: javax.servlet.http.HttpServletRequest
    at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:323)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:268)
    ... 4 more
 
 

Would be awesome!

u bestt

unread,
Jan 2, 2015, 4:32:27 AM1/2/15
to google-analytics...@googlegroups.com

how to reslove  the error

Matthew Cohoon

unread,
Jan 2, 2015, 1:15:04 PM1/2/15
to google-analytics...@googlegroups.com
You need to download and include the javax.servlet.jar into your java path.
This should help resolve this issue.
-Matt

u bestt

unread,
Jan 3, 2015, 9:12:35 AM1/3/15
to google-analytics...@googlegroups.com
thanks  for  reply

--
You received this message because you are subscribed to a topic in the Google Groups "Google Analytics Reporting API" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/google-analytics-data-export-api/cts7g0XMrvE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to google-analytics-data-...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages