Problem with Google Calendar API invocation at server side
Posted
by Raffo
on Stack Overflow
See other posts from Stack Overflow
or by Raffo
Published on 2010-05-16T09:15:12Z
Indexed on
2010/05/16
9:20 UTC
Read the original article
Hit count: 338
Hi guys, I have problems with the invocation of the Google Calendar API. I downloaded the library for java and I added as external JAR in eclipse the following files: gdata-core, gdata-calendar, gdata- calendar-meta, gdata-client-meta, gdata-client. Then, I created a the method as it follows:
import com.google.gdata.client.calendar.CalendarService;
import com.google.gdata.data.calendar.CalendarEntry;
import com.google.gdata.data.calendar.CalendarFeed;
import com.google.gwt.user.server.rpc.RemoteServiceServlet;
public class GCalServImpl extends RemoteServiceServlet implements
GCalServ {
@Override
public String RetrieveCalendars() {
// TODO Auto-generated method stub
// Create a CalenderService and authenticate
try{
CalendarService myService = new CalendarService("taskR");
myService.setUserCredentials(***username***, "***password***");
// Send the request and print the response
URL feedUrl = new URL("http://www.google.com/calendar/feeds/default/
allcalendars/full");
CalendarFeed resultFeed = myService.getFeed(feedUrl,
CalendarFeed.class);
System.out.println("Your calendars:");
System.out.println();
String s = "";
for (int i = 0; i < resultFeed.getEntries().size(); i++) {
CalendarEntry entry = resultFeed.getEntries().get(i);
s=entry.getTitle().getPlainText();
System.out.println("\t" + s);
return s;
}
}catch(Exception e){
e.printStackTrace();
}
return null;
}
I then call it from the client side doing a basic async invocation. If I try to launch the program I got the following errors:
WARNING: Error for /taskr/cal
java.lang.NoClassDefFoundError: com/google/gdata/client/calendar/
CalendarService
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Class.java:2389)
at java.lang.Class.getConstructor0(Class.java:2699)
at java.lang.Class.newInstance0(Class.java:326)
at java.lang.Class.newInstance(Class.java:308)
at org.mortbay.jetty.servlet.Holder.newInstance(Holder.java:153)
at
org.mortbay.jetty.servlet.ServletHolder.initServlet(ServletHolder.java:
428)
at
org.mortbay.jetty.servlet.ServletHolder.getServlet(ServletHolder.java:
339)
at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:
487)
at org.mortbay.jetty.servlet.ServletHandler
$CachedChain.doFilter(ServletHandler.java:1166)
at
com.google.appengine.api.blobstore.dev.ServeBlobFilter.doFilter(ServeBlobFilter.java:
51)
at org.mortbay.jetty.servlet.ServletHandler
$CachedChain.doFilter(ServletHandler.java:1157)
at
com.google.apphosting.utils.servlet.TransactionCleanupFilter.doFilter(TransactionCleanupFilter.java:
43)
at org.mortbay.jetty.servlet.ServletHandler
$CachedChain.doFilter(ServletHandler.java:1157)
at
com.google.appengine.tools.development.StaticFileFilter.doFilter(StaticFileFilter.java:
122)
at org.mortbay.jetty.servlet.ServletHandler
$CachedChain.doFilter(ServletHandler.java:1157)
at
org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:
388)
at
org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:
216)
at
org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:
182)
at
org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:
765)
at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:
418)
at
com.google.apphosting.utils.jetty.DevAppEngineWebAppContext.handle(DevAppEngineWebAppContext.java:
70)
at
org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:
152)
at com.google.appengine.tools.development.JettyContainerService
$ApiProxyHandler.handle(JettyContainerService.java:349)
at
org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:
152)
at org.mortbay.jetty.Server.handle(Server.java:326)
at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:
542)
at org.mortbay.jetty.HttpConnection
$RequestHandler.content(HttpConnection.java:938)
at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:755)
at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:218)
at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
at
org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:
409)
at org.mortbay.thread.QueuedThreadPool
$PoolThread.run(QueuedThreadPool.java:582)
Caused by: java.lang.ClassNotFoundException:
com.google.gdata.client.calendar.CalendarService
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:315)
at
com.google.appengine.tools.development.IsolatedAppClassLoader.loadClass(IsolatedAppClassLoader.java:
151)
at java.lang.ClassLoader.loadClass(ClassLoader.java:250)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:398)
... 33 more
What can I do??
© Stack Overflow or respective owner