java.lang.ClassNotFoundException: javax.servlet.ServletContainerInitializer

后端 未结 5 820
被撕碎了的回忆
被撕碎了的回忆 2020-12-19 02:16

I was working on writing some servlets and they all worked fine Tomcat had no issue running what so ever. Then I wrote a class file that used JERSEY and when I tried to run

5条回答
  •  無奈伤痛
    2020-12-19 02:30

    A late answer but this may help someone.

    I believe this happens because the Jersey was created using a newer java version and you're trying to run it in an older version of java. Either update your java version or download an older version of Jersey that supports your java version.

    Window -> Preferences -> Java -> Compiler -> set "Compiler compliance level" to 1.7. 
    

    From Jersey documentation:

    Until version 2.6, Jersey was compiled with Java SE 6. This has changes in Jersey 2.7. 
    Now almost all Jersey components are compiled with Java SE 7 target. It means, that 
    you will need at least Java SE 7 to be able to compile and run your application 
    that is using latest Jersey. Only core-common and core-client modules are still 
    compiled with Java class version runnable with Java SE 6. 
    

提交回复
热议问题