java.lang.NoClassDefFoundError: org/glassfish/jersey/internal/inject/Binder when started Tomcat Server
Very likely there is a version mismatch between core Jersey
and one of the Jersey
extension libraries that imports that Binder
class. Make sure all Jersey-related modules have explicit versions (and they match each other). Or even better, fix your versions by importing the jersey-bom. E.g.:
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.glassfish.jersey</groupId>
<artifactId>jersey-bom</artifactId>
<version>2.26-b03</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
After which your main <dependencies>
section may omit the versions.
I have faced the same issue with using different versions. Make sure your Jersey-bean-validation and Jersey-container-servlet versions are the same.
<dependency>
<groupId>org.glassfish.jersey.containers</groupId>
<artifactId>jersey-container-servlet</artifactId>
<version>2.22</version>
</dependency>
<!-- bean validation -->
<dependency>
<groupId>org.glassfish.jersey.ext</groupId>
<artifactId>jersey-bean-validation</artifactId>
<version>2.22</version>
</dependency>