Problem using Gson in Wildfly

Asked

Viewed 111 times

0

I am trying to use GSON in a Maven EJB project but gives the following error:

java.lang.NoClassDefFoundError: com/google/gson/Gson

When I test in class main without uploading the server to lib works normally.

Someone once had a similar problem?

1 answer

0

In the case of the JSP/ Servlet web application, just copy the Gson JAR into the / WEB-INF / lib folder. If it is a project using Maven add

<dependency>
    <groupId>com.google.code.gson</groupId>
    <artifactId>gson</artifactId>
    <version>2.8.0</version>
</dependency>

pom-pom.

https://mvnrepository.com/artifact/com.google.code.gson/gson

depending on your ide, you need to do a clean and re-build project

Browser other questions tagged

You are not signed in. Login or sign up in order to post.