java.lang.IllegalArgumentException:文档库目录不存在或不是可读目录

时间:2014-11-12 06:02:40

标签: java tomcat relative-path

我在stackoverflow中看到了同样的问题,但这些问题并没有帮助我。我想从Tomcat外面运行我的应用程序,所以我使用了" Context"汤姆猫 在上下文中,我给出了docBase,如下所示。

<Context docBase="../IdP/IdPserver/idp" // which is relative path
         privileged="true"
         antiResourceLocking="false"
         antiJARLocking="false"
         unpackWAR="false" />

实际位置(绝对路径)为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)

1 个答案:

答案 0 :(得分:1)

你认为实际:

D://SRDM2.3/srdm/svr//IdP/IdPserver/idp

与缺失相同?

D:\SDC-Builds\SRDM2.3.0.6904.10\SRDM\Svr\tomcat\webapps\..\IdP\IdPserver\idp

解析第二个中的..会导致

D:\SDC-Builds\SRDM2.3.0.6904.10\SRDM\Svr\tomcat\IdP\IdPserver\idp

你需要另一个..,所以试试这个:

<Context docBase="../../IdP/IdPserver/idp"