Eclipse 在哪里使用 WTP 部署 Web 应用程序?
我有一个网络应用程序(WAR 文件)。当我使用 WTP 工具通过 Eclipse 3.5 部署它时,我能够从 Eclipse 中启动 Tomcat 服务器并查看应用程序的所有页面。但是,我在 Tomcat 主目录的 webapps 文件夹中看不到我的 WAR 文件(或其分解格式)。我的印象是 Tomcat 读取其 webapps 文件夹下的所有 Web 应用程序。在这种情况下,Tomcat 如何读取我的应用程序?我使用 Tomcat 5.5.17 作为我的应用程序服务器。
I have a web application (WAR file). When I deploy it through Eclipse 3.5 using the WTP tools, I am able to start the Tomcat server from within Eclipse and view all the pages of the application. However I don't see my WAR file inside the webapps folder of Tomcat home directory (or for that matter its exploded format). I was under the impression that Tomcat reads all web applications under its webapps folder. How does Tomcat read my application in this case? I am using Tomcat 5.5.17 as my application server.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我最近必须了解有关此主题的更多详细信息以解决应用程序启动问题,因此我在这里记录下来。
应用程序部署在哪里?
这是由服务器配置决定的。双击服务器视图中的服务器可查看服务器“概述”。在“服务器位置”部分中,配置了默认值:
.metadata/.plugins/org.eclipse.wst.server.core/tmp0
wtpwebapps
code>此外,应用程序“模块”是在服务器配置的“模块”选项卡中定义的,其中指定应用程序路径、文档库和模块名称。例如,您将项目
myapp
部署到路径/MyApp
。因此,如果您的工作空间是
/home/me/workspace/myapp
,那么您的应用程序部署目录的路径是:部署了哪些应用程序文件?
部署的内容由项目属性中的“部署程序集”决定。程序集中的每个条目定义哪些文件部署到哪个路径。示例:
/src/main/java -> WEB-INF/classes
/src/main/resources -> WEB-INF/classes
/src/main/webapp -> /
Maven 依赖项 -> WEB-INF/lib
因此,如果您的源代码树中有文件
src/main/webapp/WEB-INF/web.xml
,它将被部署到:I recently have to figure out more detail on this topic to troubleshoot application startup issues so I note it here.
Where is the application deployed?
It is determined by the server configuration. Double click on the server in the servers view to look at the server "Overview". In the "Server Locations" section, there are default value configured:
.metadata/.plugins/org.eclipse.wst.server.core/tmp0
wtpwebapps
Also the application "module" is defined in the "Modules" tab of the server configuration which specify the application path, document base and the module name. For example, you deploy your project
myapp
to the path/MyApp
.So if your workspace is
/home/me/workspace/myapp
, the path to your application deployment directory is:What application files are deployed?
The contents of deployment is determined by "Deployment Assembly" in the project properties. Each entry in the assembly defines what files are deployed to what path. Example:
/src/main/java -> WEB-INF/classes
/src/main/resources -> WEB-INF/classes
/src/main/webapp -> /
Maven Dependencies -> WEB-INF/lib
So if you have the file
src/main/webapp/WEB-INF/web.xml
in your source tree, it will be deployed to:它只是在 Eclipse 提供给 Tomcat 的
context.xml
中定义。如果您想配置此行为,请双击服务器视图中的 Tomcat 实例并检查服务器位置部分。要实现您最初想要/预期的效果,您需要选择使用 Tomcat 安装,并在必要时指定部署路径。It's just all definied in the
context.xml
which Eclipse has given to Tomcat. If you want to configure this behaviour, then doubleclick the Tomcat instance in the servers view and check the Server locations section. To achieve what you initially want/expected, you need to select Use Tomcat installation and if necessary also specify the Deploy path.