Using example OAuth Calendar access example generates exceptions

29 views
Skip to first unread message

Robo

unread,
Jan 20, 2012, 6:04:51 PM1/20/12
to gwt-oauth2 users
I am trying to us OAuth for authenticating user access to Google
Calendars. I keep getting Run Time Exceptions in following Google
example:
http://code.google.com/p/gwt-google-apis/source/browse/trunk/apis/samples/calendar/?r=2019#calendar%2Fcom%2Fgoogle%2Fapi%2Fgwt%2Fsamples%2Fcalendar%2Fclient

The exceptions are:
1) java.lang.NoClassDefFoundError: org/json/JASONException

2) Caused by: java.lang.ClassNotFoundException: null

These exceptions happen at line 132 of CalendarEntryPoint.java in
method listEvents()

If the following code is commented out, the exceptions do not occur:
--------
calendar.events().list(calendarId)
.setTimeMin(today()).to(new Receiver<Events>() {
@Override
public void onSuccess(Events events) {
println("=== UPCOMING EVENTS ===");
for (Event event : events.getItems()) {
printLink(event.getSummary(), event.getHtmlLink());
}
}
@Override
public void onFailure(ServerFailure error) {
// TODO Auto-generated method stub
super.onFailure(error);
}
}).fire();

If someone can give me a clue of where to look I sure would be
thankful.

Jason Hall

unread,
Feb 12, 2012, 11:18:38 AM2/12/12
to gwt-oaut...@googlegroups.com
I'm not sure how this is happening. org.json.JSONException should not be included in GWT code at all, since it's not GWT compatible. You are running this code in a GWT application, compiled into JS and run in a browser, or running in GWT's Hosted Mode, correct?

This sample code works for me, so please note any changes you've made to the code that may be causing this problem.

- Jason

Robert Owens

unread,
Feb 13, 2012, 6:47:12 PM2/13/12
to gwt-oaut...@googlegroups.com
Hi Jason,

Thank you very much for getting back to me.
The only lines of code I changed are:
    the CLIENT_ID and API_KEY for which I generated ones for me
    listEvents() I put a try / catch clause around the     calendar.events().list(calendarId)
    plus added a onFailure callback for same code segment.
Reason for above changes was to get around or find more about the exceptions noted before.
I looked at the import statements and the project configuration.

I am running the application in Eclipse IDE as a Google Web Application.

The following are the Jar files that are in the project path and the war.WEB-INF.lib directory:

gwt-plus-v1-0.2-alpha.jar
gwt-google-apis.jar
gwt-calendar-v3-0.2-alpha.jar
appengine-api-1.0-sdk-1.6.1.jar
appengine-api-labs-1.6.1.jar
appengine-jsr107cache-1.6.1.jar
datanucleus-appengine-1.0.10.final.jar
datanucleus-core-1.1.5.jar
datanucleus-jpa-1.1.5.jar
geronimo-jpa_3.0_spec-1.1.1.jar
geronimo-jta_1.1_spec-1.1.1.jar
google_sql.jar
jdo2-api-2.3-eb.jar
jsr107cache-1.1.jar
gwt-servlet.jar

I am using Galeo Eclipse IDE and have gotten various other GWT projects or code sets working. Any suggestions to get me on the right track are very welcome.
Thank you
Reply all
Reply to author
Forward
0 new messages