In this post, we will see how to resolve Apache Spark with Spring boot – failed to start exception Factory method ‘javaSparkContext’ threw exception with message: javax/servlet/Servlet
Question:
I am setting up Spring boot 3.0.4 with apache spark version 3.3.2 with Java 17. however container failed to start with following exceptionHere is my
pom.xml
fileGithub Repo
Best Answer:
Spring Boot 3.0 requires version 5.0 of the Servlet API which moved the classes fromjavax.servlet
to jakarta.servlet
. To use Spark with Spring Boot 3.0, you’ll have to use a Servlet 5.0-compatible version of Spark (if one exists). Alternatively, you could use Spring Boot 2.7.x with your current version of Spark.If you have better answer, please add a comment about this, thank you!
Source: Stackoverflow.com