我使用Netbeans 6.7来开发Java servlet。默认端口为 8080。例如,如何将端口号更改为 8083?
您可以使用“服务器”对话框上提供的属性编辑器更改端口。
从“工具”菜单中选择“服务器”项。替代文本 http://www.freeimagehosting.net/uploads/e8ed5c303e.png
此图像是从 6.8 中捕获的...但该对话框自 NetBeans 4.1 以来一直可用(几乎没有变化)。
这取决于您使用的 servlet 容器或应用程序服务器。
例如,在 tomcat 中,这是通过将
port
的 Connector
属性更改为 HTTP/1.1
中的 tomcat/conf/server.xml
来完成的。在其他容器中,它会与此类似 - 在配置中的某个位置。
1.只需在conf目录中搜索server.xml文件[在tomcat安装文件夹内]
2.搜索如下内容:
<Connector port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" />
<!-- A "Connector" using the shared thread pool-->
<!--
<Connector executor="tomcatThreadPool"
port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" />
来源: http://ohmjavaclasses.blogspot.com/2012/01/how-to-change-port-number-of-tomcat.html