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