码迷,mamicode.com
首页 > 其他好文 > 详细

tomcat使用指南(二)-修改端口

时间:2015-02-02 15:55:23      阅读:183      评论:0      收藏:0      [点我收藏+]

标签:tomcat   端口   修改端口   tomcat7   

当要启动两个tomcat,或者8080端口已被其他程序占用时,就需要修改tomcat的默认端口。

修改server.xml,首先把8080端口改为8081:
    <Connector port="8080" protocol="HTTP/1.1" 
               connectionTimeout="20000" 
               redirectPort="8443" />

此时启动,会报错:
SEVERE: Failed to initialize end point associated with ProtocolHandler ["ajp-bio-8009"]
Throwable occurred: java.net.BindException: The socket name is already in use. <null>:8009
修改server.xml,首先把8009端口改为8010:
    <!-- Define an AJP 1.3 Connector on port 8009 -->
    <Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />

此时启动,会报错:
SEVERE: StandardServer.await: create[localhost:8005]: 
Throwable occurred: java.net.BindException: The socket name is already in use.
修改server.xml,首先把8005端口改为8006:
<Server port="8005" shutdown="SHUTDOWN">

注意:如果在unix下拷贝长xml配置,会自动换行,比如报错:
Throwable occurred: org.xml.sax.SAXParseException: Attribute name "cr" associated with an element type "Context" must be followed by the ‘ = ‘ character.
是因为<Context path="" docBase="F:\code\trunk\mapp\thfund\web\thfund\web" debug="5" reloadable="true" crossContext="true">
到crossContext这里,cr就换行了,下一行是ossContext。

本文出处:
http://blog.csdn.net/ouyida3
201.2.2

tomcat使用指南(二)-修改端口

标签:tomcat   端口   修改端口   tomcat7   

原文地址:http://blog.csdn.net/ouyida3/article/details/43409119

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!