欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

启动Tomcat关于端口号被占用报错

程序员文章站 2022-05-30 21:13:18
...
严重: Error initializing endpoint
java.lang.Exception: Socket bind failed: [730048] ?????????×???(Э?é/???????/???)????í??
	at org.apache.tomcat.util.net.AprEndpoint.init(AprEndpoint.java:646)
	at org.apache.coyote.http11.Http11AprProtocol.init(Http11AprProtocol.java:107)
	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-12-4 15:48:21 org.apache.catalina.startup.Catalina load
严重: Catalina.start
LifecycleException:  Protocol handler initialization failed: java.lang.Exception: Socket bind failed: [730048] ?????????×???(Э?é/???????/???)????í??
	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-12-4 15:48:21 org.apache.catalina.startup.Catalina load

    昨天之前机器在启动tomcat时都是好好的,可是就在昨天出现了这个异常。刚开始以为是代码改错了影响了启动,可是找来找去也没有变动的影响代码。在网上一查,发现是端口号被占用了,重启了一下就好了。今天这个情况依然出现,重启也不好用。被占用的端口还杀不掉,只好修改tomcat里的配置端口号:

<Service name="ins-*-platform"> 
    <Connector executor="tomcatThreadPool" port="20020" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8448" URIEncoding="utf-8"/>
	  <Engine name="ins-*-platform" defaultHost="localhost">
      <Realm className="org.apache.catalina.realm.UserDatabaseRealm" resourceName="UserDatabase"/>
   		<Host appBase="webapps" name="localhost" deployXML="false" deployOnStartup="false" autoDeploy="false">
        <Context path="" docBase="ins-*-platform" reloadable="true">
          <ResourceLink global="jdbc/lietou" name="jdbc/lietou.rw" type="javax.sql.DataSourcer"/>
          <ResourceLink global="jdbc/god9" name="jdbc/god9.rw" type="javax.sql.DataSourcer"/>
          <ResourceLink global="jdbc/god9" name="jdbc/god9.ro" type="javax.sql.DataSourcer"/>
        </Context>
      </Host>
   </Engine>
  </Service>

 注意是:port="20020"被占用,改成其他的启动正常。

 

备注:

windows doc查看端口号命令如下:

netstat -ano

封杀端口号命令:

taskkill /f /pid 6784