eclipse Eclipse下运行Tomcat时wtpwebapps/myapp为空

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/5053621/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 15:50:11  来源:igfitidea点击:

wtpwebapps/myapp is empty when running Tomcat under Eclipse

javaeclipsetomcatpublish

提问by outellou

I know that tomcat is running because when I type http://localhost, the tomcat page dispay. My problem is I can't figure out why the wtpwebapps/myapp is empty, is like the eclipse doesn't publish it and when i type http://localhost/myapp, I get 404 error.

我知道 tomcat 正在运行,因为当我输入http://localhost 时,tomcat 页面会显示。我的问题是我不知道为什么 wtpwebapps/myapp 是空的,就像 eclipse 没有发布它一样,当我输入http://localhost/myapp 时,我收到 404 错误。

In the server overview :

在服务器概述中:

  • Server Location is set to "Use Tomcat installation" | server path: the servers's folder | deploy path : wtpwebapps
  • Server Option : Publish module contexts to separate XML file
  • Publishing : Automatically publish when ressource change
  • 服务器位置设置为“使用Tomcat安装”| 服务器路径:服务器的文件夹 | 部署路径:wtpwebapps
  • 服务器选项:将模块上下文发布到单独的 XML 文件
  • 发布:资源变化时自动发布

I use eclipse Ganymede 3.4.2, tomcat 6.0, under Win7

我用的是eclipse Ganymede 3.4.2,tomcat 6.0,Win7下

Any help would be appreciated, thanks

任何帮助将不胜感激,谢谢

采纳答案by lukastymo

your files must be somwhere, so start searching in:

你的文件一定在某处,所以开始搜索:

<YOUR_WORKSPACE_DIR>\.metadata\.plugins\org.eclipse.wst.server.core\tmp<SOME_NUMBER>\wtpwebapps

回答by Franz

I had a similar problem, when updating our project (.projectand .classpathare checked in for convenience, but causes sometimes problems).

我有一个类似的问题,更新时,我们的项目(.project以及.classpath为了方便检查,但有时会导致问题)。

Console-Log in eclipse always says:

Console-Log in eclipse 总是说:

Error configuring application listener of class org.sth.ThisClass java.lang.ClassNotFoundException: org.sth.ThisClass

Error configuring application listener of class org.sth.ThisClass java.lang.ClassNotFoundException: org.sth.ThisClass

The reasonwas that $WORKSPACE_DIR/.metadata/.plugins/org.eclipse.wst.server.core/tmp$NUMBER/wtpwebapps/$CONTEXT/WEB-INF/lib/classeswas empty. The solutionwas to enter under Project Properties > Deployment Assemblyan entry:

原因是,$WORKSPACE_DIR/.metadata/.plugins/org.eclipse.wst.server.core/tmp$NUMBER/wtpwebapps/$CONTEXT/WEB-INF/lib/classes是空的。该解决方案正在进入Project Properties > Deployment Assembly一个条目:

Source: /src

来源: /src

Deploy Path: WEB-INF/classes

部署路径: WEB-INF/classes

回答by Igor B

If you use a Maven in your project, this is a solution for you:

如果您在项目中使用 Maven,这是适合您的解决方案:

  1. Delete the project(s) in the Eclipse.
  2. create project from Maven sources (select your workspace directory).
  3. Check found pom.xml to import.
  1. 删除 Eclipse 中的项目。
  2. 从 Maven 源创建项目(选择您的工作区目录)。
  3. 检查找到要导入的 pom.xml。

Restart the Tomcat.

重启Tomcat。

回答by hshib

Since I had difficulty finding where this "server overview" is, I like to add that you just double click on a server under the "servers" view. I kept on right click and look at the "Properties" and was not getting to this information.

由于我很难找到这个“服务器概览”的位置,我想补充一点,您只需双击“服务器”视图下的服务器即可。我一直右键单击并查看“属性”,但没有获得此信息。

回答by Eduard

Try to look into servers explorer and it will show you what state is your application at and if its deployed.

尝试查看服务器资源管理器,它会显示您的应用程序处于什么状态以及是否已部署。