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

当要启动两个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.youkuaiyun.com/ouyida3
201.2.2

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值