eclipse - java.lang.IllegalArgumentException : Document base [. ..] 不存在或不是可读目录

标签 eclipse tomcat servlets

我从 Servlet 开始,我安装了 Tomcat 7,

这是我在 eclipse 中启动 tomcat 时的控制台:

java.lang.IllegalArgumentException: Document base C:\Users\Janko\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp3\wtpwebapps\Servlet does not exist or is not a readable directory
    at org.apache.naming.resources.FileDirContext.setDocBase(FileDirContext.java:138)
    at org.apache.catalina.core.StandardContext.resourcesStart(StandardContext.java:5055)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5235)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
    at java.util.concurrent.FutureTask.run(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)

最佳答案

我假设您在 Eclipse IDE 中运行 tomcat, 克服 404 的常见步骤很少。

  1. 在 Eclipse 中打开“服务器选项卡”。 (Window Menu => Show view => Other => Server。(如果找不到就在弹出框中输入Server)

  2. 点击“新建服务器向导”添加tomcat。

  3. 右键单击 tomcat 服务器实例。单击属性

enter image description here 4. 然后你会看到属性。单击“位置”属性。单击切换位置。 (默认情况下,此值是工作区元数据,通过切换位置,您可以指定您引用的 tomcat 的位置)

enter image description here 5.点击“Tomcat7 Server”,确保选择了“Use Tomcat installation (take controls from Tomcat installation)”

关于eclipse - java.lang.IllegalArgumentException : Document base [. ..] 不存在或不是可读目录,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19990592/

相关文章:

java - 使用 Eclipse 项目中的 JDK

java - 如何使用AutoIt上传多个文件?

tomcat - 在同一台机器上运行 Tomcat 的第二个实例时出现问题

java - 用完 c3p0 池连接会导致 CPU 高吗?

jakarta-ee - 在 servlet 的 doget() 方法中调用 init()

eclipse - 在 Eclipse EE 中为我的 servlet 设置 POI(在 Mac 上)

java - 我应该使用什么设计模式来构建一个简单的报告系统

java - Eclipse 找不到 Oracle VM 模拟器

java - 如何通过浏览器限制对 Servlet 的访问

java - SWT Eclipse 组合事件