1. 程式人生 > >Tomcat啟動時出現java.lang.IllegalArgumentException: Document base D:\apache-tomcat-6.0.20\webapps\XXX doe

Tomcat啟動時出現java.lang.IllegalArgumentException: Document base D:\apache-tomcat-6.0.20\webapps\XXX doe

java.lang.IllegalArgumentException: Document base D:\apache-tomcat-6.0.20\webapps\bookstore does not exist or is not a readable directory
 at org.apache.naming.resources.FileDirContext.setDocBase(FileDirContext.java:142)
 at org.apache.catalina.core.StandardContext.resourcesStart(StandardContext.java:4048)
 at org.apache.catalina.core.StandardContext.start(StandardContext.java:4217)
 at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
 at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
 at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:526)
 at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:630)
 at org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:556)
 at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:491)
 at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1206)
 at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:314)
 at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
 at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
 at org.apache.catalina.core.StandardHost.start(StandardHost.java:722)
 at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
 at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
 at org.apache.catalina.core.StandardService.start(StandardService.java:516)
 at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
 at org.apache.catalina.startup.Catalina.start(Catalina.java:583)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
 at java.lang.reflect.Method.invoke(Method.java:585)
 at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
 at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)

今天我碰到了這個問題,明明那個專案在webapps下面已經不存在了,為什麼還是報錯。

按照網上的方法試了,結果都不行,其中包括:把work/catalina/localhost下的東西都刪掉,檢查配置檔案的無用連線,都不行。

最後,我找到了:conf\Catalina\localhost下有一個bookmanager.xml的檔案,就是我報錯的那個檔名,所以我確定就是它,刪除後重啟tomcat就好了,建議大家試一下