Java Error 500 in accessing contact

23 views
Skip to first unread message

Gianluigi

unread,
Feb 9, 2012, 6:16:02 AM2/9/12
to google-co...@googlegroups.com
Hi, i'm trying to access contacts but i got an error.
I already got access token with oAuth2, then i have a servlet with the code:

public void doGet(HttpServletRequest req, HttpServletResponse resp)
throws IOException {
resp.setContentType("text/plain");
String AccessToken= req.getParameter("accessToken");
ContactsService myService = new ContactsService("CloudOffice");
myService.setHeader("Authorization", "Oauth <OAUTH_TOKEN>")
   // Authorize the service object.
// Request the feed
 resp.getWriter().println(feedUrl.toString());
 
 ContactFeed resultFeed=new ContactFeed();
try {
resultFeed = myService.getFeed(feedUrl, ContactFeed.class);
} catch (ServiceException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

but i got the error 505:

Problem accessing /contactaccess. Reason:

    com/google/gdata/client/contacts/ContactsService

Caused by:

java.lang.NoClassDefFoundError: com/google/gdata/client/contacts/ContactsService
	at contactAccess.ContactAccessServlet.doGet(ContactAccessServlet.java:25)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
...

It looks like i'm missing something...
can you help me?

Gianluigi

unread,
Feb 9, 2012, 6:18:43 AM2/9/12
to google-co...@googlegroups.com
I forgot to write that ContactAccessServlet.java:25 corresponds to  ContactsService myService = new ContactsService("CloudOffice");

Wojciech Mąka

unread,
Feb 9, 2012, 9:39:48 AM2/9/12
to google-co...@googlegroups.com
Simply You do not have ContactsService included in build path. Configure your build path properly - i mean add gdata-contacts jar. 

Gianluigi

unread,
Feb 9, 2012, 11:30:19 AM2/9/12
to Google Contacts, Shared Contacts and User Profiles APIs
That looks odd, since i already have ...\gdata-src.java-1.46.0\gdata
\java\lib\gdata-contacts-3.0.jar in my build path
Reply all
Reply to author
Forward
0 new messages