eclipse eclipse中的Tomcat错误

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

Tomcat error in eclipse

eclipsetomcat

提问by Raj

I have a problem with eclipse that says the ports are already in use (80, 8009), When I change the ports I receive an error: Tomcat v6 at localhost failed to start.

我的 eclipse 有一个问题,说端口已经在使用 (80, 8009),当我更改端口时,我收到一个错误:本地主机上的 Tomcat v6 无法启动。

When I debug Tomcat I receive this error:

当我调试 Tomcat 时,我收到此错误:

11-Mar-2011 21:11:40 org.apache.catalina.core.AprLifecycleListener init
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files\Java\jdk1.6.0_21\bin;.;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:/Program Files/Java/jre6/bin/client;C:/Program Files/Java/jre6/bin;C:/Program Files/Java/jre6/lib/i386;C:\Program Files\Java\jdk1.5.0_09\bin;C:\Program Files\QuickTime\QTSystem\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Program Files\apache-ant-1.8.1\bin;C:\Program Files\Subversion\bin;C:\Program Files\Java\jdk1.6.0_21\bin;C:\Users\Rajin\Desktop\eclipse-jee-helios-SR1-win32\eclipse;
11-Mar-2011 21:11:41 org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:EducationGamesApp' did not find a matching property.
11-Mar-2011 21:11:41 org.apache.coyote.http11.Http11Protocol init
INFO: Initializing Coyote HTTP/1.1 on http-8080
11-Mar-2011 21:11:41 org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 635 ms
11-Mar-2011 21:11:41 org.apache.catalina.core.StandardService start
INFO: Starting service Catalina
11-Mar-2011 21:11:41 org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/6.0.29
11-Mar-2011 21:11:41 org.apache.coyote.http11.Http11Protocol start
INFO: Starting Coyote HTTP/1.1 on http-8080
11-Mar-2011 21:11:41 org.apache.jk.common.ChannelSocket init
INFO: JK: ajp13 listening on /0.0.0.0:8008
11-Mar-2011 21:11:41 org.apache.jk.server.JkMain start
INFO: Jk running ID=0 time=0/29  config=null
11-Mar-2011 21:11:41 org.apache.catalina.startup.Catalina start
INFO: Server startup in 390 ms
11-Mar-2011 21:11:41 org.apache.catalina.core.StandardServer await
SEVERE: StandardServer.await: create[8005]: 
java.net.BindException: Address already in use: JVM_Bind
    at java.net.PlainSocketImpl.socketBind(Native Method)
    at java.net.PlainSocketImpl.bind(PlainSocketImpl.java:365)
    at java.net.ServerSocket.bind(ServerSocket.java:319)
    at java.net.ServerSocket.<init>(ServerSocket.java:185)
    at org.apache.catalina.core.StandardServer.await(StandardServer.java:373)
    at org.apache.catalina.startup.Catalina.await(Catalina.java:662)
    at org.apache.catalina.startup.Catalina.start(Catalina.java:614)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)

Thanks

谢谢

采纳答案by David Lantos

Find out which application hold the port(s) by running

通过运行找出哪个应用程序持有端口

  • Windows: netstat -no
  • Linux: netstat -anp
  • 视窗: netstat -no
  • Linux: netstat -anp

Look for 8005, 8080, 8009ports listening on either 127.0.0.1or 0.0.0.0. Lookup the PID (process id) in Task Manager (Windows) or ps(Linux) to find out which program it is, terminate it, and try starting Tomcat again.

寻找8005, 8080,8009侦听127.0.0.1或 的端口0.0.0.0。在任务管理器 (Windows) 或ps(Linux) 中查找 PID(进程 ID)以找出它是哪个程序,将其终止,然后再次尝试启动 Tomcat。

回答by mindas

By default, Tomcat is using two ports: one for HTTP connector and one as "Server" port. If you open tomcat/conf/server.xml, you will see these ports defined:

默认情况下,Tomcat 使用两个端口:一个用于 HTTP 连接器,另一个用作“服务器”端口。如果您打开tomcat/conf/server.xml,您将看到定义的这些端口:

<?xml version='1.0' encoding='utf-8'?>
  <Server port="8005" shutdown="SHUTDOWN">
  ...
  <Service name="Catalina">
    <Connector port="8080" protocol="HTTP/1.1" ...
    ...
    <Connector port="8009" protocol="AJP/1.3" ...
  </Service>
</Server>

As you can see, port 8009 is used for AJP connector and 8080 for HTTP connector.

如您所见,端口 8009 用于 AJP 连接器,8080 用于 HTTP 连接器。

You need to ensure none of these three ports are being used by your system (another Tomcat or just another application) and if they are, you need to change these values to something else.

您需要确保您的系统(另一个 Tomcat 或只是另一个应用程序)没有使用这三个端口中的任何一个,如果是,则需要将这些值更改为其他值。

回答by PRATHIP

download TCP view sw from the following link and unzip it. http://technet.microsoft.com/en-us/sysinternals/bb897437.aspx. see in the localport column is there any process worked in 8080 port . right click and end the process. then try to start the TomCat server. its really worked for me..

从以下链接下载 TCP view sw 并解压。http://technet.microsoft.com/en-us/sysinternals/bb897437.aspx。在 localport 列中查看是否有任何进程在 8080 端口中工作。右键单击并结束该过程。然后尝试启动 TomCat 服务器。它真的对我有用..

回答by bnguyen82

The actual cause of this issue was the host file presented at WINDOWS_INSTALLTION/windows/System32/drivers/etc, where in which your old IP address was mapped against localhost like below:

此问题的实际原因是 WINDOWS_INSTALLTION/windows/System32/drivers/etc 中的主机文件,其中您的旧 IP 地址映射到本地主机,如下所示:

127.0.0.1 localhost

192.168.XXX.XX localhost

127.0.0.1 本地主机

192.168.XXX.XX 本地主机

This second line was the main culprit, there are two ways of solving this:

第二行是罪魁祸首,有两种解决方法:

  • Remove 192.168.XXX.XX localhost line completely from host file
  • Replace old IP with new IP in your host file i.e instead of 192.168.XXX.XX localhost change it to 192.168.XXX.YY localhost
  • 从主机文件中完全删除 192.168.XXX.XX localhost 行
  • 在您的主机文件中用新 IP 替换旧 IP,即代替 192.168.XXX.XX localhost 将其更改为 192.168.XXX.YY localhost

Refer this blog for more details: http://mprabhat.wordpress.com/2012/11/05/tomcat-java-net-bindexception-cannot-assign-requested-address-jvm_bind/

有关更多详细信息,请参阅此博客:http: //mprabhat.wordpress.com/2012/11/05/tomcat-java-net-bindexception-cannot-assign-requested-address-jvm_bind/

回答by Karthik H

No Circus,

没有马戏团,

1.Simply download this "apr-1.5.1-win32-src.zip" from https://apr.apache.org/download.cgi

1. 只需从https://apr.apache.org/download.cgi下载这个“apr-1.5.1-win32-src.zip”

  1. Extract the folder

  2. place it in the folder, that is in reach of Tomcat, in you case(C:\Users\Rajin\Desktop\eclipse-jee-helios-SR1-win32\eclipse).

  3. Re-run the application/ restart the server.

  1. 解压文件夹

  2. 将它放在 Tomcat 可以访问的文件夹中,在你的情况下(C:\Users\Rajin\Desktop\eclipse-jee-helios-SR1-win32\eclipse)。

  3. 重新运行应用程序/重新启动服务器。