java.lang.IllegalStateException: Error starting child错误的产生与解决
生活随笔
收集整理的這篇文章主要介紹了
java.lang.IllegalStateException: Error starting child错误的产生与解决
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
經(jīng)過網(wǎng)友解惑,
一般原因有:
1,jar版本不一致
2,servlet配置重復(fù)(xml+注解)
3,servlet配置映射少了‘/’,(路徑錯誤)
嚴(yán)格意義上我的錯誤是屬于第3種,
錯在哪呢?
你們看:
<!-- 請求錯誤響應(yīng)配置--><error-page><error-code>404</error-code><location>error.html</location></error-page>在說明一點(diǎn):我的error.html在WEB-INF目錄下。
我們來分析打印的錯誤(最后一個):
Caused by: java.lang.IllegalArgumentException: Error page location [error.html] must start with a '/'at org.apache.catalina.core.StandardContext.addErrorPage(StandardContext.java:2930)at org.apache.catalina.startup.ContextConfig.configureContext(ContextConfig.java:1280)at org.apache.catalina.startup.ContextConfig.webConfig(ContextConfig.java:1169)at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:775)at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:301)at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:123)at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5048)at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)... 44 more Error page location [error.html] must start with a '/'顯而易見,是元素中路徑配置出錯,改成:
<!-- 請求錯誤響應(yīng)配置--><error-page><error-code>404</error-code><location>/WEB-INF/error.html</location></error-page>不要忘記加/
(類似錯誤一定要仔細(xì)檢查xml與servlet類+異常信息)
所以說,要仔細(xì),不能在這些東西上面浪費(fèi)太多時間。
希望能幫到你!!!
總結(jié)
以上是生活随笔為你收集整理的java.lang.IllegalStateException: Error starting child错误的产生与解决的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: maven项目里面程序不能正确读取res
- 下一篇: java通过对.class文件字节码加密