Hi Vijay,

Thanks for posting the code snippets for your Calendar service
classes. From what I've overlooked,  the code seems to be set up
correctly. I think the reason why you're getting the NoClassDefFound
exception has to do with the server you're using and how it's
configured. More specifically, it seems that the server you're using
doesn't have the GData client JAR available in the web application
deployment resources.

There are a couple of scenarios that you should investigate to figure
out why this exception is coming up. The first scenario is if you're
using hosted mode with the embedded Tomcat server (i.e. without the -
noserver option). If this is the case, the solution is simply to use
hosted mode with the -noserver option and point it to your custom
server where the GData JARs have been included for your GWT
application. This is because the GWT hosted mode embedded Tomcat
server is not configured to deploy your GWT application with the GData
client JARs. What you'll need to do instead is use the GWT hosted mode
with your own custom server, where the GData client JARs are included
for your GWT application and can be resolved, using the -noserver
option. You can read up on running in -noserver mode at the link
below:

http://code.google.com/support/bin/answer.py?answer=55200&topic=13017

The second scenario is if you're already using hosted mode with the -
noserver option, in which case your custom server is missing the
required GData client JARs for your GWT application. To make sure your
server is set up correctly, you'll want to verify that the GData
client JARs have been included in the WEB-INF/lib directory for the
GWT application, or is available to the servlet container running the
GWT application through another configuration.

Hope that helps,
-Sumit Chandel

On Nov 21, 9:43 pm, Vijay <[EMAIL PROTECTED]> wrote:
> Hi Sumit,
>
> (This is my servlet for implementation of service)
>
> package com.calender.server;
>
> import java.io.IOException;
> import java.net.MalformedURLException;
> import java.net.URL;
>
> import com.calender.client.CalenderService;
> import com.google.gdata.client.*;
> import com.google.gdata.client.calendar.*;
>
> import com.google.gdata.data.*;
> import com.google.gdata.data.extensions.*;
> import com.google.gdata.util.*;
>
> import com.google.gwt.user.server.rpc.RemoteServiceServlet;
>
> public class CalendarServlet extends RemoteServiceServlet implements
> CalenderService
> {
>
>         /**
>          *
>          */
>         private static final long serialVersionUID = 8743313712323328729L;
>
>         public boolean getData()
>         {
>                 URL feedUrl=null;
>                 try {
>                         feedUrl =
>                                   new 
> URL("http://www.google.com/calendar/feeds/mygmailid/private/
> full");
>
>                 } catch (MalformedURLException e) {
>
>                         e.printStackTrace();
>                 }
>
>                         CalendarService myService = new 
> CalendarService("exampleCo-
> exampleApp-1");
>
>                 try {
>                         myService.setUserCredentials("mygmailid", 
> "mypassword");
>                 }
>                                 catch (AuthenticationException e) {
>                         e.printStackTrace();
>                 }
>                 new 
> EventFeed().declareExtensions(myService.getExtensionProfile());
>
>                 try {
>                         Feed myFeed = (Feed)myService.getFeed(feedUrl, 
> Feed.class);
>                 } catch (IOException e) {
>                         e.printStackTrace();
>                 } catch (ServiceException e) {
>                         e.printStackTrace();
>                 }
>
>                 EventEntry myEntry = new EventEntry();
>                 myEntry.setTitle(new PlainTextConstruct("Tennis with Darcy"));
>                 myEntry.setContent(new PlainTextConstruct("Meet for a quick
> lesson."));
>                 Person author = new Person("Vijay Poojary", null, 
> "mygmailid");
>                 myEntry.getAuthors().add(author);
>                 DateTime startTime =
> DateTime.parseDateTime("2007-11-22T15:00:00-08:00");
>                 DateTime endTime =
> DateTime.parseDateTime("2007-11-22T17:00:00-08:00");
>                 When eventTimes = new When();
>                 eventTimes.setStartTime(startTime);
>                 eventTimes.setEndTime(endTime);
>                 myEntry.addTime(eventTimes);
>                 try {
>                         EventEntry insertedEntry = 
> (EventEntry)myService.insert(postUrl,
> myEntry);
>                 } catch (IOException e) {
>                         e.printStackTrace();
>                 } catch (ServiceException e) {
>                         e.printStackTrace();
>                 }
>
>                 return true;
>         }
>
> }
>
> and below is my clientside Entrypoint,
>
> package com.calender.client;
> import com.google.gwt.core.client.EntryPoint;
> import com.google.gwt.core.client.GWT;
> import com.google.gwt.user.client.Window;
> import com.google.gwt.user.client.rpc.AsyncCallback;
> import com.google.gwt.user.client.rpc.ServiceDefTarget;
>
> /**
>  * Entry point classes define <code>onModuleLoad()</code>.
>  */
> public class GWTcalender implements EntryPoint {
>
>   /**
>    * This is the entry point method.
>    */
>   public void onModuleLoad() {
>
>           final CalenderServiceAsync NumsService = (CalenderServiceAsync)
> GWT.create(CalenderService.class);
>           ServiceDefTarget endpoint = (ServiceDefTarget) NumsService;
>           endpoint.setServiceEntryPoint(GWT.getModuleBaseURL()+"Nums");
>
>           AsyncCallback callback = new AsyncCallback(){
>
>                   public void onSuccess(Object result) {
>                                 if(((Boolean)result).booleanValue())
>                                 {
>                                         Window.alert("Yes,");
>                                 }
>                                 else
>                                 {
>                                         Window.alert("No,");
>                                 }
>                         }
>
>                         public void onFailure(Throwable caught) {
>
>                                         Window.alert("error");
>                         }
>
>                           };
>           NumsService.getData(callback);
>       }
>
> }
>
> I want to know why while using GData classes like CalenderService or
> other I am getting Exception as NoClassDefFound.
>
> Thanks,
> Vijay
>
> On Nov 22, 2:53 am, Sumit Chandel <[EMAIL PROTECTED]> wrote:
>
> > Hi Vijay,
>
> > The reason why you're getting this error message in hosted mode is
> > because there is an exception bubbling up from your
> > CalendarService.getData() call that cannot be serialized across GWT
> > RPC. What you'll want to do is either catch the exception at the
> > service level in a custom defined exception that can be serialized on
> > the client-side through GWT RPC, or catch the exception and take some
> > corrective action (such as passing a sentinel String or int value back
> > up to the client to indicate a system failure). Even better, you might
> > want to dig into the reason why the CalendarService.getData() call is
> > throwing an exception in the first place, but in any case you must
> > catch this exception so that it doesn't bubble up to the client, where
> > it can't be serialized.
>
> > You can check out more specifics about the constraints on Serializable
> > types in GWT RPC at the link below:
>
> >http://code.google.com/webtoolkit/documentation/com.google.gwt.doc.De...
>
> > If you need to further troubleshoot the problem of getting exception
> > and other object types to the client-side across GWT RPC, you're more
> > likely to get answers on the Google Web Toolkit forums (linked below).
> > If you want to further look into the reason why your
> > Calendar.getData() call is throwing an exception, I suggest you post
> > up more information for follow up here.
>
> > Google Web Toolkit forum:
>
> >http://groups.google.com/group/Google-Web-Toolkit
>
> > Hope that helps,
> > -Sumit Chandel
>
> > On Nov 21, 4:33 am, Vijay <[EMAIL PROTECTED]> wrote:
>
> > > HI
>
> > > I have added GData jar files and mail.jar, activation.jar in the
> > > library, but still I am getting error message as below noClassDefFound
> > > while using gdata, like googleservice.
>
> > > Please tell me what to do.
>
> > > [WARN] StandardContext[]Exception while dispatching incoming RPC call
> > > com.google.gwt.user.server.rpc.UnexpectedException: Service method
> > > 'public abstract boolean
> > > com.calender.client.CalenderService.getData()' threw an unexpected
> > > exception: java.lang.NoClassDefFoundError: com/google/gdata/client/
> > > calendar/CalendarService- Hide quoted text -
>
> > - Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Data API" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/google-help-dataapi?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to