Jetty:run fails with NoSuchMethodError with Spring 5

后端 未结 2 1273
渐次进展
渐次进展 2021-01-21 12:56

I am trying to update my web application to current libraries. When I upgraded Spring from 3.1.1 to 5.0.0 it started to fail with:

java.lang.NoSuchMethodError: j         


        
2条回答
  •  春和景丽
    2021-01-21 13:07

    My bad I got it wrong. I think the problem is your jetty version:

    https://mvnrepository.com/artifact/org.mortbay.jetty/jetty/6.1.26

    Here the servlet API is 2.5 and when you add dependency in Maven and mark it with provided scope it means the required JARs will be provided on a later stage and not packed with the war. So the code compiles properly in the IDE and development but when you try to run it with jetty it uses the actual servlet-api coming from the jetty version. And for that method you need servlet-api version 3 or above

提交回复
热议问题