I am trying to build a SpringBoot application.
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootAppli
For me, upgrading javax.servlet-api to 4.0.1 did the trick:
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>4.0.1</version>
</dependency>
Looks like you have an incompatible version of Servlet API in ur classpath. This could have been as a dependencies to Jersey jars. Try pulling jersey starter from Spring boot starters.
org.springframework.boot : spring-boot-starter-jersey
This will bring the right version into your classpath.
My guess is you have to use the default ServletInitializer
class that is provided within the Spring Boot Project template
of Eclipse.
//SpringBootApplication.java
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class SpringBootApplication {
public static void main(String[] args) {
SpringApplication.run(SpringBootApplication.class, args);
}
}
//ServletInitializer.java
public class ServletInitializer extends SpringBootServletInitializer {
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
return application.sources(SpringBootApplication.class);
}
}
If you are not using ServletInitializer
class as specified in Spring Boot Starter Project
template, try to extend SpringBootServletInitializer
from your App class
public class App extends SpringBootServletInitializer
Please check a similar answer here
I solved this problem using tomcat
configuration in pom.xml
First go to tomcat folder and open cmd
in bin my path is :
C:\Program Files\Apache Software Foundation\Tomcat 8.5\bin>
get tomcat version using this command
C:\Program Files\Apache Software Foundation\Tomcat 8.5\bin>catalina.sh version
After this add this in pom.xml
<properties>
<java.version>1.8</java.version>
<tomcat.version>8.5.43</tomcat.version>
</properties>
I had the same issue, After commenting out the below it was fixed. One of the follwoing dependency was the culprit.
<!-- dependency>
<groupId>me.fhir</groupId>
<artifactId>fhir</artifactId>
<version>0.12.0-RELEASE</version>
</dependency-->
<!-- dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.8.8</version>
</dependency-->
<!-- dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>2.8.8</version>
</dependency-->