java.lang.IllegalStateException: No WebApplicationContext found: no ContextLoaderListener registered?

前端 未结 4 1719
野趣味
野趣味 2021-02-12 14:50

This the file web.xml in WEB-INF





        
4条回答
  •  执笔经年
    2021-02-12 15:17

    I've recently stumbled upon the same issue, and I knew for sure it couldn't be caused by misconfiguration because I've copied the entire working Tomcat installation from another machine. Yet I kept getting the same exception:

    java.lang.IllegalStateException: No WebApplicationContext found: not in a DispatcherServlet request and no ContextLoaderListener registered?
    

    As I've eventually figured out, it was a wrong JVM version that broke the application: this one used Java 7, whereas the working instance (and the webapp) was on Java 8.

    Hope it helps someone struggling with this counter-intuitive error message.

提交回复
热议问题