-1

I have Spark running locally in Docker. Port 7077 is exposed and I'm able to hit the WebUI at localhost:9090.

I try connecting with the following code from java:

 SparkSession spark = SparkSession
                .builder()
                .master("spark://localhost:7077")
                .appName("foo")
                .getOrCreate();

But when I run the application, I get this error:

Caused by: javax.servlet.UnavailableException: Servlet class org.glassfish.jersey.servlet.ServletContainer is not a javax.servlet.Servlet

Why is this error happening and how do I fix it?

ritratt
  • 1,703
  • 4
  • 25
  • 45

1 Answers1

0

This is due to a dependency conflict between Spring and Spark. The below change to my pom.xml fixed the issue for me:

<properties>
<jakarta-servlet.version>4.0.3</jakarta-servlet.version>
<jersey.version>2.36</jersey.version>
</properties>

More info on this Stackoverflow question.

ritratt
  • 1,703
  • 4
  • 25
  • 45