Reputation: 361
I've create a Java application, it will use GSON class, so I add gson.jar to the ClassPath of my project, also, I include this line
import com.google.gson.Gson
at the top of my program.
Everything seems to be good, however, once my app runs to this line,
Gson gson = new Gson();
it will pop up errors and say :
org.jboss.resteasy.spi.UnhandledException: java.lang.NoClassDefFoundError: com/google/gson/Gson
...
Caused by: java.lang.NoClassDefFoundError: com/google/gson/Gson
I've search dozens of articles, and I've tried to add new variable to my library folder, as the answer which gave by Vaishali Kulkarni in this article mentioned, but it still doesn't work.
Did I miss anything necessary to use Gson object?
Upvotes: 3
Views: 7477
Reputation: 11
Resolve this by removing the gson test range from the parent pom.
<dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
</dependency>
</dependency>
Upvotes: 1