错误:No WebApplicationContext found: no ContextLoaderListener or DispatcherServlet registered?

错误详情:

严重: Servlet.service() for servlet [jsp] in context with path [/exam-system-tab-shiro] threw exception
java.lang.IllegalStateException: No WebApplicationContext found: no ContextLoaderListener or DispatcherServlet registered?
    at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:253)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
    at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:197)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:199)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:493)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:81)
    at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:650)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:342)
    at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:800)
    at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
    at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:806)
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1498)
    at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
    at java.lang.Thread.run(Thread.java:748)

报错的原因:未添加  <load-on-startup>1</load-on-startup>

 1 <!-- 配置spring代理shiro的过滤器 -->
 2     <filter>
 3         <filter-name>shiroFilterBean</filter-name>
 4         <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
 5         <!-- 让spring控制shiro过滤器的生命周期 -->
 6         <init-param>
 7             <param-name>targetFilterLifecycle</param-name>
 8             <param-value>true</param-value>
 9         </init-param>
10     </filter>
11     <filter-mapping>
12         <filter-name>shiroFilterBean</filter-name>
13         <url-pattern>/*</url-pattern>
14     </filter-mapping>
15     <!-- 配置攔截器,攔截所有的請求,讓一個方法對應一個請求 -->
16     <servlet>
17         <servlet-name>dispatcherServlet</servlet-name>
18         <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
19         <!-- 指定配置類路徑 -->
20         <init-param>
21             <param-name>contextConfigLocation</param-name>
22             <param-value>cn.mgy.config</param-value>
23         </init-param>
24         <!-- 指定加載註解配置類的容器 -->
25         <init-param>
26             <param-name>contextClass</param-name>
27             <param-value>org.springframework.web.context.support.AnnotationConfigWebApplicationContext</param-value>
28         </init-param>
29         <load-on-startup>1</load-on-startup> 
30     </servlet>
31     <servlet-mapping>
32         <servlet-name>dispatcherServlet</servlet-name>
33         <url-pattern>/</url-pattern>
34     </servlet-mapping>

 

转载于:https://www.cnblogs.com/maigy/p/10853410.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值