首页 > 代码库 > tomcat使用指南(二)-修改端口
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:
此时启动,会报错:
SEVERE: StandardServer.await: create[localhost:8005]:
Throwable occurred: java.net.BindException: The socket name is already in use.
修改server.xml,首先把8005端口改为8006:
注意:如果在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">
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">
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使用指南(二)-修改端口
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。