Tomcat端口被占用

早起我打开很长时间没有用的myelipse,结果就出错了。。。。。

报异常如下:

 

2013-9-28 11:10:40 org.apache.catalina.core.AprLifecycleListener init
信息: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Users\hongye\AppData\Local\Genuitec\Common\binary\com.sun.java.jdk.win32.x86_1.6.0.013\bin;D:\Tomcat 6.0\bin
2013-9-28 11:10:43 org.apache.coyote.http11.Http11Protocol init
严重: Error initializing endpoint
java.net.SocketException: Unrecognized Windows Sockets error: 0: JVM_Bind
 at java.net.PlainSocketImpl.socketBind(Native Method)
 at java.net.PlainSocketImpl.bind(PlainSocketImpl.java:359)
 at java.net.ServerSocket.bind(ServerSocket.java:319)
 at java.net.ServerSocket.<init>(ServerSocket.java:185)
 at java.net.ServerSocket.<init>(ServerSocket.java:141)
 at org.apache.tomcat.util.net.DefaultServerSocketFactory.createSocket(DefaultServerSocketFactory.java:50)
 at org.apache.tomcat.util.net.JIoEndpoint.init(JIoEndpoint.java:538)
 at org.apache.coyote.http11.Http11Protocol.init(Http11Protocol.java:176)
 at org.apache.catalina.connector.Connector.initialize(Connector.java:1014)
 at org.apache.catalina.core.StandardService.initialize(StandardService.java:680)
 at org.apache.catalina.core.StandardServer.initialize(StandardServer.java:795)
 at org.apache.catalina.startup.Catalina.load(Catalina.java:524)
 at org.apache.catalina.startup.Catalina.load(Catalina.java:548)
 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.load(Bootstrap.java:261)
 at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
2013-9-28 11:10:43 org.apache.catalina.startup.Catalina load
严重: Catalina.start
LifecycleException:  Protocol handler initialization failed: java.net.SocketException: Unrecognized Windows Sockets error: 0: JVM_Bind
 at org.apache.catalina.connector.Connector.initialize(Connector.java:1016)
 at org.apache.catalina.core.StandardService.initialize(StandardService.java:680)
 at org.apache.catalina.core.StandardServer.initialize(StandardServer.java:795)
 at org.apache.catalina.startup.Catalina.load(Catalina.java:524)
 at org.apache.catalina.startup.Catalina.load(Catalina.java:548)
 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.load(Bootstrap.java:261)
 at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
2013-9-28 11:10:43 org.apache.catalina.startup.Catalina load
信息: Initialization processed in 6477 ms
2013-9-28 11:10:43 org.apache.catalina.core.StandardService start
信息: Starting service Catalina
2013-9-28 11:10:43 org.apache.catalina.core.StandardEngine start
信息: Starting Servlet Engine: Apache Tomcat/6.0.26
2013-9-28 11:10:43 org.apache.catalina.startup.HostConfig deployDescriptor
信息: Deploying configuration descriptor manager.xml
2013-9-28 11:10:45 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deploying web application directory docs
2013-9-28 11:10:45 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deploying web application directory ROOT
2013-9-28 11:10:45 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deploying web application directory servlet
2013-9-28 11:10:46 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deploying web application directory zz01
2013-9-28 11:10:47 org.apache.catalina.loader.WebappClassLoader validateJarFile
信息: validateJarFile(D:\Tomcat 6.0\webapps\zz01\WEB-INF\lib\servlet-api.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class
2013-9-28 11:10:49 org.apache.catalina.core.ApplicationContext log
信息: Initializing Spring root WebApplicationContext
log4j:WARN No appenders could be found for logger (org.springframework.web.context.ContextLoader).
log4j:WARN Please initialize the log4j system properly.
2013-9-28 11:10:54 org.apache.catalina.core.ApplicationContext log
信息: Set web app root system property: 'zz01.root' = [D:\Tomcat 6.0\webapps\zz01\]
2013-9-28 11:10:54 org.apache.catalina.core.ApplicationContext log
信息: Initializing log4j from [D:\Tomcat 6.0\webapps\zz01\WEB-INF\classes\log4j.properties]
2013-9-28 11:10:57 org.apache.coyote.http11.Http11Protocol start
严重: Error starting endpoint
java.net.SocketException: Unrecognized Windows Sockets error: 0: JVM_Bind
 at java.net.PlainSocketImpl.socketBind(Native Method)
 at java.net.PlainSocketImpl.bind(PlainSocketImpl.java:359)
 at java.net.ServerSocket.bind(ServerSocket.java:319)
 at java.net.ServerSocket.<init>(ServerSocket.java:185)
 at java.net.ServerSocket.<init>(ServerSocket.java:141)
 at org.apache.tomcat.util.net.DefaultServerSocketFactory.createSocket(DefaultServerSocketFactory.java:50)
 at org.apache.tomcat.util.net.JIoEndpoint.init(JIoEndpoint.java:538)
 at org.apache.tomcat.util.net.JIoEndpoint.start(JIoEndpoint.java:565)
 at org.apache.coyote.http11.Http11Protocol.start(Http11Protocol.java:203)
 at org.apache.catalina.connector.Connector.start(Connector.java:1087)
 at org.apache.catalina.core.StandardService.start(StandardService.java:534)
 at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
 at org.apache.catalina.startup.Catalina.start(Catalina.java:581)
 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)
2013-9-28 11:10:57 org.apache.catalina.startup.Catalina start
严重: Catalina.start:
LifecycleException:  service.getName(): "Catalina";  Protocol handler start failed: java.net.SocketException: Unrecognized Windows Sockets error: 0: JVM_Bind
 at org.apache.catalina.connector.Connector.start(Connector.java:1094)
 at org.apache.catalina.core.StandardService.start(StandardService.java:534)
 at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
 at org.apache.catalina.startup.Catalina.start(Catalina.java:581)
 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)
2013-9-28 11:10:57 org.apache.catalina.startup.Catalina start
信息: Server startup in 14048 ms
2013-9-28 11:10:57 org.apache.catalina.core.StandardServer await
严重: 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:359)
 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)
2013-9-28 11:10:57 org.apache.coyote.http11.Http11Protocol pause
信息: Pausing Coyote HTTP/1.1 on http-8080

 

 

MyEclipse下java.net.SocketException: Unrecognized Windows Sockets error: 0: JVM_Bind异常
该问题一般为Tomcat端口被占用所致,解决办法如下:
1、查看Tomcat所使用的端口
打开Tomcat安装目录下的conf文件夹,如D:\Program Files (x86)\Apache Software Foundation\Tomcat 6.0\conf
找到server.xml文件
查看Tomcat配置的端口号(一般为8080)
 
connectionTimeout="20000"
redirectPort="8443" />
2、查看8080端口是否被占用
cmd下执行netstat -ano命令
C:\Users\Little Five>netstat -ano
活动连接
协议 本地地址 外部地址 状态 PID
TCP 0.0.0.0:8009 0.0.0.0:0 LISTENING 1256
TCP 0.0.0.0:8080 0.0.0.0:0 LISTENING 1256
TCP 127.0.0.1:2559 0.0.0.0:0 LISTENING 1512
TCP 127.0.0.1:5939 0.0.0.0:0  LISTENING 2288
可以看到8080端口被PID为1256的进程占用
3、追踪进程
(1)、cmd下执行tasklist|findstr "1256"命令
C:\Users\Little Five>tasklist|findstr "1256"
javaw.exe 1256 Console 1 81,864 K
可以看到javaw.exe进程为我们要找的进程,很有可能是之前启动的tomcat没被正常结束,当然也有可能是MyEclipse自身。
(2)、任务管理器追踪
任务管理器-->进程-->查看-->选择列-->勾选PID-->确定-->点PID列按PID排序-->结束刚找到的PID的进程,(一般会是JAVAW进程)
4、重启MyEclipse服务端,问题解决。

 

运行了一个早上,以为我把哪个服务器弄坏了,结果好好的。。。。我无语了

posted @ 2013-09-28 11:15  王红叶  阅读(3050)  评论(0编辑  收藏  举报