java 如何运行两台Tomcat服务器 v7.0

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

How can I run two Tomcat server v7.0

javatomcattomcat7

提问by gamo

I'm working with Tomcat server v7.0. I need to run two Tomcat server at a same time on same machine. After I run the first Tomcat server and try to run second Tomcat server I got this error.

我正在使用 Tomcat 服务器 v7.0。我需要在同一台机器上同时运行两个 Tomcat 服务器。在我运行第一个 Tomcat 服务器并尝试运行第二个 Tomcat 服务器后,我收到此错误。

Several ports (8005, 8080, 8009) required by Tomcat v7.0 Server at localhost (2) are already in use. The server may already be running in another process, or a system process may be using the port. To start this server you will need to stop the other process or change the port number(s).

本地主机 (2) 上的 Tomcat v7.0 服务器所需的多个端口 (8005、8080、8009) 已在使用中。服务器可能已经在另一个进程中运行,或者系统进程可能正在使用该端口。要启动此服务器,您需要停止其他进程或更改端口号。

Any solution?

有什么解决办法吗?

Thank you.

谢谢你。

回答by CodeNewbie

Double click on your second Tomcat server instance from the Servers view. On the left hand side of the window, you see the ports that have been specified for the current instance. You need to change those ports before starting a second server instance.

在 Servers 视图中双击您的第二个 Tomcat 服务器实例。在窗口的左侧,您会看到为当前实例指定的端口。您需要在启动第二个服务器实例之前更改这些端口。

Tomcat settings

Tomcat设置

(I am guessing you are using Eclipse. This screenshot is from Eclipse.)

(我猜你正在使用 Eclipse。这个截图来自 Eclipse。)

回答by Pankaj Sharma

goto \conf\server.xmldirectory and modify the port number for send tomcat server.

转到\conf\server.xml目录并修改发送 tomcat 服务器的端口号。

<Server port="8005" shutdown="SHUTDOWN">

 <Connector port="8080" protocol="HTTP/1.1" 
               connectionTimeout="20000" 
               redirectPort="8443" />
 <Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />

change above ports to some free and available ports.

将上面的端口更改为一些免费和可用的端口。

回答by Deepam Singla

Problem here is that you are already running the tomcat on those ports. so when you try to run tomcat as second process, it will try to occupy those port and they are pre-occupied by first process. the solution to this problem is to assign different ports to the second tomcat. To do that in tomcat installation directory-->conf-->server.xml needs to be modified. There are 3 places that you need to make changes

这里的问题是您已经在这些端口上运行了 tomcat。因此,当您尝试将 tomcat 作为第二个进程运行时,它会尝试占用这些端口并且它们被第一个进程预先占用。这个问题的解决办法是给第二个tomcat分配不同的端口。要做到这一点,需要在tomcat安装目录-->conf-->server.xml中进行修改。有3个地方需要修改

  <Server port="8005" 
  <Connector port="8080" 
  <Connector port="8009"

change the port number with some random port number and you are good to go. if it does not work change the ports again . it may be possibe that the port you use is already used by some other process :)

使用一些随机端口号更改端口号,您就可以开始了。如果它不起作用再次更改端口。您使用的端口可能已被某些其他进程使用:)