javax.servlet.ServletException: Servlet.init() for servlet springmvc threw exception

时间:2022-12-27 21:12:28

e'cipse中,项目没报错,正常启动,访问控制器时报错

javax.servlet.ServletException: Servlet.init() for servlet springmvc threw exception  
    org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)  
    org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)  
    org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:616)  
    org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:518)  
    org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1091)  
    org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:673)  
    org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1500)  
    org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1456)  
    java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)  
    java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)  
    org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)  
    java.lang.Thread.run(Thread.java:745)  
Servlet.init()初始化错误,错误一般发生在控制器中,当出现重名的servlet时候也会报类似的错误,
上述错误原因:
  controller中出现了,不存在的控制器引用
  例如:return “redirect:/admin/query.action”,返回重定向到另外一个控制器,但是控制器未定义,就会出现上述错误!


--------------个人总结,积累

  1. javax.servlet.ServletException: Servlet.init() for servlet springmvc threw exception  
  2.     org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)  
  3.     org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)  
  4.     org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:616)  
  5.     org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:518)  
  6.     org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1091)  
  7.     org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:673)  
  8.     org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1500)  
  9.     org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1456)  
  10.     java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)  
  11.     java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)  
  12.     org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)  
  13.     java.lang.Thread.run(Thread.java:745)