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:
<source path='client'> and <source path='shared'>private final TestServiceAsync testService = GWT.create(TestService.class); and invokes testService.testMethod();Gson g = new Gson(); and so forthThe 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
This is a class path problem. GSON is not in the classpath. Which IDE do you use? if u use eclipse - 1. right click the project 2. build path 3. configure build path 4. select "libraries" tab 5. click "add jars..." 6. in the popup choose the correct location for each of the necessary jars.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With