Hi guys.
I am just starting to get a feel about Google Code and GWT.
So my first thing to do was to download the Google Plugin for Eclipse and
create a new Project.
The project comes with an example, the greeting example. So i deployed that
to App Engine and it worked great.
Now I want to put some functionality in the example. So via eclipse, i
d/led the Contacts API and automatically the jars were placed in the
classpath and lib directory.
So in the server side, in GreetingServiceImpl.java I added the following
line
ContactsService service = new ContactsServic("Contacts");
So the file looks like this:
package com.gnt.server;
>
> import com.gnt.client.GreetingService;
> import com.gnt.shared.FieldVerifier;
> import com.google.gdata.client.contacts.ContactsService;
> import com.google.gwt.user.server.rpc.RemoteServiceServlet;
>
> /**
> * The server side implementation of the RPC service.
> */
> @SuppressWarnings("serial")
> public class GreetingServiceImpl extends RemoteServiceServlet implements
> GreetingService {
>
> public String greetServer(String input) throws
> IllegalArgumentException {
> // Verify that the input is valid.
> if (!FieldVerifier.isValidName(input)) {
> // If the input is not valid, throw an
> IllegalArgumentException back to
> // the client.
> throw new IllegalArgumentException(
> "Name must be at least 4 characters long");
> }
>
> String serverInfo = getServletContext().getServerInfo();
> String userAgent = getThreadLocalRequest().getHeader("User-Agent");
>
> // Escape data from the client to avoid cross-site script
> vulnerabilities.
> input = escapeHtml(input);
> userAgent = escapeHtml(userAgent);
> ContactsService contactsService = new ContactsService("Contacts");
> return "Hello, " + input + "!<br><br>I am running " + serverInfo
> + ".<br><br>It looks like you are using:<br>" + userAgent;
> }
>
> /**
> * Escape an html string. Escaping data received from the client helps
> to
> * prevent cross-site script vulnerabilities.
> *
> * @param html the html string to escape
> * @return the escaped string
> */
> private String escapeHtml(String html) {
> if (html == null) {
> return null;
> }
> return html.replaceAll("&", "&").replaceAll("<", "<")
> .replaceAll(">", ">");
> }
> }
>
>
Now, the Remote Procedure Call fails and in the logs i only see
javax.servlet.ServletContext log: Exception while dispatching incoming RPC call
> com.google.gwt.user.server.rpc.UnexpectedException: Service method 'public
> abstract java.lang.String
> com.gnt.client.GreetingService.greetServer(java.lang.String) throws
> java.lang.IllegalArgumentException' threw an unexpected exception:
> java.lang.NoClassDefFoundError: com/google/gdata/client/GoogleService
> at
> com.google.gwt.user.server.rpc.RPC.encodeResponseForFailure(RPC.java:385)
> at
> com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:588)
> at
> com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall(RemoteServiceServlet.java:208)
> at
> com.google.gwt.user.server.rpc.RemoteServiceServlet.processPost(RemoteServiceServlet.java:248)
> at
> com.google.gwt.user.server.rpc.AbstractRemoteServiceServlet.doPost(AbstractRemoteServiceServlet.java:62)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
> at
> org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511)
> at
> org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1166)
> at
> com.google.apphosting.utils.servlet.ParseBlobUploadFilter.doFilter(ParseBlobUploadFilter.java:102)
> at
> org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
> at
> com.google.apphosting.runtime.jetty.SaveSessionFilter.doFilter(SaveSessionFilter.java:35)
> at
> org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
> at
> com.google.apphosting.utils.servlet.TransactionCleanupFilter.doFilter(TransactionCleanupFilter.java:43)
> at
> org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
> at
> org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:388)
> at
> org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
> at
> org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
> at
> org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765)
> at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:418)
> at
> com.google.apphosting.runtime.jetty.AppVersionHandlerMap.handle(AppVersionHandlerMap.java:249)
> at
> org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
> at org.mortbay.jetty.Server.handle(Server.java:326)
> at
> org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)
> at
> org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:923)
> at
> com.google.apphosting.runtime.jetty.RpcRequestParser.parseAvailable(RpcRequestParser.java:76)
> at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
> at
> com.google.apphosting.runtime.jetty.JettyServletEngineAdapter.serviceRequest(JettyServletEngineAdapter.java:135)
> at
> com.google.apphosting.runtime.JavaRuntime$RequestRunnable.run(JavaRuntime.java:477)
> at
> com.google.tracing.TraceContext$TraceContextRunnable.runInContext(TraceContext.java:449)
> at
> com.google.tracing.TraceContext$TraceContextRunnable$1.run(TraceContext.java:455)
> at com.google.tracing.TraceContext.runInContext(TraceContext.java:695)
> at
> com.google.tracing.TraceContext$AbstractTraceContextCallback.runInInheritedContextNoUnref(TraceContext.java:333)
> at
> com.google.tracing.TraceContext$AbstractTraceContextCallback.runInInheritedContext(TraceContext.java:325)
> at
> com.google.tracing.TraceContext$TraceContextRunnable.run(TraceContext.java:453)
> at
> com.google.apphosting.runtime.ThreadGroupPool$PoolEntry.run(ThreadGroupPool.java:251)
> at java.lang.Thread.run(Thread.java:679)
> Caused by: java.lang.NoClassDefFoundError:
> com/google/gdata/client/GoogleService
> at
> com.google.appengine.runtime.Request.process-ff033622b2cd8d3f(Request.java)
> at java.lang.ClassLoader.defineClass1(Native Method)
> at java.lang.ClassLoader.defineClass(ClassLoader.java:634)
> at
> java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
> at java.net.URLClassLoader.defineClass(URLClassLoader.java:277)
> at sun.reflect.GeneratedMethodAccessor5.invoke(Unknown Source)
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> at java.lang.reflect.Method.invoke(Method.java:616)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
> at
> com.gnt.server.GreetingServiceImpl.greetServer(GreetingServiceImpl.java:32)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> at java.lang.reflect.Method.invoke(Method.java:43)
> at
> com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:569)
> at
> com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall(RemoteServiceServlet.java:208)
> at
> com.google.gwt.user.server.rpc.RemoteServiceServlet.processPost(RemoteServiceServlet.java:248)
> at
> com.google.gwt.user.server.rpc.AbstractRemoteServiceServlet.doPost(AbstractRemoteServiceServlet.java:62)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
> at
> org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511)
> at
> org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1166)
> at
> org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
> at
> org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
> at
> org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
> at
> org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:388)
> at
> org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
> at
> org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
> at
> org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765)
> at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:418)
> at
> org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
> at org.mortbay.jetty.Server.handle(Server.java:326)
> at
> org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)
> at
> org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:923)
> at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
> at
> com.google.tracing.TraceContext$TraceContextRunnable.runInContext(TraceContext.java:449)
> at
> com.google.tracing.TraceContext$TraceContextRunnable$1.run(TraceContext.java:455)
> at com.google.tracing.TraceContext.runInContext(TraceContext.java:695)
> at
> com.google.tracing.TraceContext$AbstractTraceContextCallback.runInInheritedContextNoUnref(TraceContext.java:333)
> at
> com.google.tracing.TraceContext$AbstractTraceContextCallback.runInInheritedContext(TraceContext.java:325)
> at
> com.google.tracing.TraceContext$TraceContextRunnable.run(TraceContext.java:453)
> ... 1 more
> Caused by: java.lang.ClassNotFoundException:
> com.google.gdata.client.GoogleService
> at
> com.google.appengine.runtime.Request.process-ff033622b2cd8d3f(Request.java)
> ... 34 more
>
>
Can someone pls explain to me why this happens? All the necessary jars are
in the classpath as well as in the lib directory...
Why am i Getting this?
Caused by: java.lang.NoClassDefFoundError: com/google/gdata/client/GoogleService
Is there another way to get Contacts?
Thank you and sorry for the big post!
--
You received this message because you are subscribed to the Google
Groups "Google Contacts, Shared Contacts and User Profiles APIs" 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://code.google.com/apis/contacts/community/forum.html