Javalin: java.lang.NoSuchMethodError: io.javalin.core.CachedRequestWrapper.getContentLengthLong()J

Created on 15 Apr 2019  路  10Comments  路  Source: tipsy/javalin

INFO QUESTION

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>

All 10 comments

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>

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?

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!

Was this page helpful?
0 / 5 - 0 ratings