NoClassDefFoundError: in Google App Engine app while creating Gson instance
Is there something tricky about using Gson in Google App Engine App? I placed gson jar in war/lib and included it in the build path. I'm using Eclipse.
Code compiles however app keeps failing at line:
Gson gson = new Gson();
A NoClassDefFoundError specifies that you have a particular class available at compile time but missing or not initialized during runtime. In your case com/google/gson/Gson class is found at compile time as gson jar is in your lib. But during runtime it is either not present or not initialized. Check for a conflict of gson jar or if there is an ExceptionInInitializerError in the stacktrace. You may further understand it here - Debugging a NoClassDefFoundError
I know GAE by name only, but I have that kind of error in Eclipse when I have a dynamic web project and I forget to deploy libs I used to build.
So, maybe you can solve by going into Deployment Assembly section of your project and add libs that you have in your build path.
The problem was that I placed library under war/libs and not under war/WEB-INF/lib