Looks like you forgot to include at least one jar file within your web app. Did you include both gdata-core and gdata-docs? -Patricia
> -----Original Message----- > From: Google-Docs-Data-APIs@googlegroups.com > [mailto:google-docs-data-a...@googlegroups.com] On Behalf Of shantan > Sent: Tuesday, June 30, 2009 10:12 AM > To: Google Docs Data APIs > Subject: [Google-Docs-Data-APIs] Help in creating a JSP page > with google docs java api > > > Hello, > > I have been trying to create a JSP page that inserts a new > document using google docs java api. The following is the > sample code I created. > > -------------------------------------------------------------- > -------------------------------------------------------------- > -------------------------------------------- > <%@ page import="com.google.gdata.client.*" %> <%@ page > import="com.google.gdata.client.GoogleService" %> <%@ page > import="com.google.gdata.client.Query" %> <%@ page > import="com.google.gdata.client.docs.DocsService" %> <%@ page > import="com.google.gdata.client.media.*" %> <%@ page > import="com.google.gdata.data.PlainTextConstruct" %> <%@ page > import="com.google.gdata.data.Link" %> <%@ page > import="com.google.gdata.data.docs.DocumentListFeed" %> <%@ > page import="com.google.gdata.data.docs.DocumentListEntry" %> > <%@ page import="com.google.gdata.data.docs.FolderEntry" %> > <%@ page import="com.google.gdata.data.docs.DocumentEntry" %> > <%@ page import="com.google.gdata.data.docs.SpreadsheetEntry" > %> <%@ page import="com.google.gdata.data.acl.AclEntry" %> > <%@ page import="com.google.gdata.data.acl.AclFeed" %> <%@ > page import="com.google.gdata.data.acl.AclRole" %> <%@ page > import="com.google.gdata.data.acl.AclScope" %> <%@ page > import="com.google.gdata.data.acl.*" %> <%@ page > import="com.google.gdata.util.*" %> <%@ page > import="com.google.gdata.util.AuthenticationException" %> <%@ > page import="com.google.gdata.util.ServiceException" %> <%@ > page import="java.net.URL" %> <%@ page > import="java.util.List" %> <%@ page import="java.io.*" %> > > <html> > <head> > <title>google docs test</title> > <meta http-equiv="Content-Type" content="text/html; > charset=iso-8859-1"> </head> <body> > <% > try { > // Create a new Documents service > DocsService myService = new > DocsService("Java GData Client"); > > myService.setUserCredentials("username","password"); > // Get a list of all entries > URL url = new > URL("http://docs.google.com/feeds/documents/ > private/full"); > DocumentEntry entry = new DocumentEntry(); > entry.setTitle(new > PlainTextConstruct("shantan.doc")); > myService.insert(url, entry); > } > catch(Exception e) { > out.println("Exception has arised"); > } > %> > </body> > </html> > -------------------------------------------------------------- > -------------------------------------------------------------- > -------------------------------------- > > Unfortunately I get the following exception when I try to run > this code in tomcat server. > > java.lang.NoClassDefFoundError: Could not initialize class > com.google.gdata.client.docs.DocsService > org.apache.jsp.test_jsp._jspService(test_jsp.java:110) > > org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) > javax.servlet.http.HttpServlet.service(HttpServlet.java:717) > org.apache.jasper.servlet.JspServletWrapper.service > (JspServletWrapper.java:374) > > org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java: > 342) > > org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267) > javax.servlet.http.HttpServlet.service(HttpServlet.java:717) > > > I did include the jar files found in gdata/java/lib. > > Please help me in finding where I went wrong. Thanks for the > help in advance. > > -Shantan > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google Docs Data APIs" group. To post to this group, send email to Google-Docs-Data-APIs@googlegroups.com To unsubscribe from this group, send email to google-docs-data-apis+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/Google-Docs-Data-APIs?hl=en -~----------~----~----~----~------~----~------~--~---