This error happen when I have this code
Code: https://hastebin.com/giminetoko.cs
Error: https://hastebin.com/ubuhuriziy.sql
Pom.xml: https://hastebin.com/abirifadog.xml
This happens because one of your dependencies are pulling in an old version of the servlet-api. Javalin requires version 3.1.0:
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
</dependency>
Nope. It doesn't fixes.
Code: https://hastebin.com/uzurofinuf.cs
Error: https://hastebin.com/eleyewoyib.sql
pom.xml: https://hastebin.com/ocecehaqot.xml
You'll probably have to exclude the servlet-api from the dependency that's pulling in an old version.
How do I do that?
You'll need to figure out which dependency is including it, then follow this page: https://maven.apache.org/guides/introduction/introduction-to-optional-and-excludes-dependencies.html
But how do I know which dependency is using an old version of javax.servlet-api?
You can build a dependency tree and inspect it: https://maven.apache.org/plugins/maven-dependency-plugin/examples/resolving-conflicts-using-the-dependency-tree.html
I don't think any dependency uses servlet-api
Here is the dependency tree: https://imgur.com/unYBtrZ
Which the line is the left is directly goes to my project root
Wait. I found it. Here is what I add in my pom.xml for other's reference.
<dependency>
<groupId>com.google.oauth-client</groupId>
<artifactId>google-oauth-client-jetty</artifactId>
<exclusions>
<exclusion> <!-- declare the exclusion here -->
<groupId>org.mortbay.jetty</groupId>
<artifactId>servlet-api</artifactId>
</exclusion>
</exclusions>
<version>1.27.0</version>
</dependency>
Great, thank you for posting the solution!
Most helpful comment
Wait. I found it. Here is what I add in my pom.xml for other's reference.
<dependency> <groupId>com.google.oauth-client</groupId> <artifactId>google-oauth-client-jetty</artifactId> <exclusions> <exclusion> <!-- declare the exclusion here --> <groupId>org.mortbay.jetty</groupId> <artifactId>servlet-api</artifactId> </exclusion> </exclusions> <version>1.27.0</version> </dependency>