java.lang.IllegalArgumentException:文档基础目录不存在或不是可读目录
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/26880304/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
java.lang.IllegalArgumentException: Document base dir does not exist or is not a readable directory
提问by majji
I have seen the same kind of questions in stackoverflow but those questions were not helping me. I wanted to run my app from outside of Tomcat, so I have used "Context" of Tomcat.
In the context I have given the docBase
like below.
我在 stackoverflow 中看到过类似的问题,但这些问题对我没有帮助。我想从 Tomcat 外部运行我的应用程序,所以我使用了 Tomcat 的“上下文”。在上下文中,我给出了docBase
以下内容。
<Context docBase="../IdP/IdPserver/idp" // which is relative path
privileged="true"
antiResourceLocking="false"
antiJARLocking="false"
unpackWAR="false" />
The actual location(absolute path) is D://SRDM2.3/srdm/svr//IdP/IdPserver/idp
. But it was not working with relative path but is working with absolute path.
I got the following error while using relative path.
实际位置(绝对路径)是D://SRDM2.3/srdm/svr//IdP/IdPserver/idp
。但它不适用于相对路径,而是使用绝对路径。使用相对路径时出现以下错误。
SEVERE: Error starting static Resources
java.lang.IllegalArgumentException: Document base D:\SDC-Builds\SRDM2.3.0.6904.10\SRDM\Svr\tomcat\webapps\..\IdP\IdPserver\idp 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:4324)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4493)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:799)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:779)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:583)
at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:675)
at org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:601)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:502)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1317)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:324)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:142)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1065)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:822)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1057)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:463)
at org.apache.catalina.core.StandardService.start(StandardService.java:525)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:754)
at org.apache.catalina.startup.Catalina.start(Catalina.java:595)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
采纳答案by icza
Do you think the actual:
你认为实际:
D://SRDM2.3/srdm/svr//IdP/IdPserver/idp
is the same as the missing?
和失踪一样吗?
D:\SDC-Builds\SRDM2.3.0.6904.10\SRDM\Svr\tomcat\webapps\..\IdP\IdPserver\idp
Resolving the ..
in the second one results in
解决..
第二个结果中的
D:\SDC-Builds\SRDM2.3.0.6904.10\SRDM\Svr\tomcat\IdP\IdPserver\idp
You sill need another ..
, so try this one:
你还需要另一个..
,所以试试这个:
<Context docBase="../../IdP/IdPserver/idp"