Tomcat部署2个项目

发布于 2024-11-28 21:40:37 字数 731 浏览 1 评论 0原文

我有一个要求,我需要使用一台服务器来运行两个完全不同的应用程序。

服务器计算机安装了 Apache Tomcat 6.0。其上部署了1个应用程序并成功运行了很长时间。最初,客户端通过调用 URL“http://machine-name/1stProjectName/initialPage”来连接到它。我还在该项目的 web.xml 中提到了“initialPage”作为欢迎页面。但不知何故,后来服务器维护团队更改了一些端口或相关内容,要连接到应用程序,现在必须使用 url“http://machine-name”或“http://machine-name/” initialPage”,即机器名称开始表现得像项目名称文件夹,因为现在如果我调用 url“http://machine-name/1stProjectName/initialPage”,它会给出 404 错误,指出“/1stProjectName/1stProjectName/initialPage”资源 无法使用。

现在,当我将第二个应用程序的 WAR 部署到 Tomcat 的 webapps 文件夹中时(就像我对第一个应用程序所做的那样),它会正确解压它。但是,问题是我如何连接到第二个项目。如果我使用“http://machine-name”,它将带我到第一个应用程序,如果我使用“http://machine-name/2ndProjectName/initialPage”,它会给我一个错误:“/1stProjectName/2ndProjectName/初始页面”不可用。

请帮助或引导我朝某个方向前进。 提前致谢。

I have a requirement that I need to use a single server machine to run 2 totally different applications.

The server machine has Apache Tomcat 6.0 installed. 1 of the applications is deployed on it and is running successfully for a long time. Initially, the clients used to connect to it by invoking the url "http://machine-name/1stProjectName/initialPage". I have also mentioned the "initialPage" as the Welcome Page in web.xml of this project. But somehow, later some ports or relating things were changed by the server maintenance team, and to connect to the application, now one has to use the url "http://machine-name" or "http://machine-name/initialPage", i.e. the machine name has started behaving like the project name folder because now if I invoke the url "http://machine-name/1stProjectName/initialPage", it gives 404 error saying that "/1stProjectName/1stProjectName/initialPage" resource not available.

Now, when I deploy the WAR of the second application into the webapps folder of Tomcat (just like I did for the first application), it unpacks it properly. But, the issue is how do I connect to this second project. If I use "http://machine-name", it takes me to the 1st application and if I use "http://machine-name/2ndProjectName/initialPage", it gives me an error that "/1stProjectName/2ndProjectName/initialPage" not available.

Kindly help or guide me in some direction.
Thanks in advance.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

沉溺在你眼里的海 2024-12-05 21:40:37

如果您操作正确,您的 URL 应该如下所示:

  1. 项目 1:http://host:port/war-name-1
  2. 项目 2:http://host:port/war -name-2

表示不更改content.xml来修改路径。

Your URLs should look like this if you did things properly:

  1. Project 1: http://host:port/war-name-1
  2. Project 2: http://host:port/war-name-2

That means no changes to content.xml to modify the path.

像极了他 2024-12-05 21:40:37

我会与您的“服务器维护团队”交谈,让他们知道您正在尝试做什么(因为他们是首先进行这些更改的人)。但在我看来,他们只是将路径映射到特定位置,即您的计算机名称根映射到 1stProjectName

I would talk to your "server maintenance team" and let them know what you are trying to do (since they are the ones who made these changes in the first place). But it sounds to me that they just mapped a path to a specific location, that is your machine-name root is mapped to 1stProjectName.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文