Hi everybody.
I already read that there is no possibility to run GSON in GWT client code, but that it is possible to run it in server code.
The latter one is which I'm trying to achive, but not getting to work. I thought any class within the com.whatever.server package has access to the whole JRE namespace including reflection. It seems that that is not the case. So how managed all those developers to use GSON in GWT server code? (I'm new to GWT, so the answer may be really easy.)
Thanks.
EDIT: My setting is as follows:
- test.gwt.xml contains:
<source path='client'>
and<source path='shared'>
- the client uses
private final TestServiceAsync testService = GWT.create(TestService.class);
and invokestestService.testMethod();
- TestService interface and TestServiceAsync are located in package client
- the TestServiceImpl implemented in test.server uses
Gson g = new Gson();
and so forth
The exception thrown is java.lang.NoClassDefFoundError: com/google/gson/Gson. But it seems that it is raised no matter whether the method contains GSON code or not (it is sufficient that it contains the GSON import-statement).
Caused by: java.lang.ClassNotFoundException: com.google.gson.Gson at java.net.URLClassLoader$1.run(URLClassLoader.java:200) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:188) at java.lang.ClassLoader.loadClass(ClassLoader.java:307) at com.google.appengine.tools.development.IsolatedAppClassLoader.loadClass(IsolatedAppClassLoader.java:151) at java.lang.ClassLoader.loadClass(ClassLoader.java:252) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320) ... 33 more