开发者

How to change to a different port for Java server in Netbeans to listen?

开发者 https://www.devze.com 2022-12-25 14:58 出处:网络
I use Netbeans 6.7 to develop Java servlet. It defaults to port 8080. How do I change the port number to 8083 fo开发者_StackOverflowr example?You can change the port, using the property editors availa

I use Netbeans 6.7 to develop Java servlet. It defaults to port 8080. How do I change the port number to 8083 fo开发者_StackOverflowr example?


You can change the port, using the property editors available on the Servers dialog.

Select the Servers item from the Tools menu.alt text http://www.freeimagehosting.net/uploads/e8ed5c303e.png

This image was captured from 6.8... but the dialog has been available (pretty much unchanged) since NetBeans 4.1.


This depends on the servlet container or application server you are using.

In tomcat, for example, this is done by changing the port attribute of the Connector for HTTP/1.1 in tomcat/conf/server.xml. In other containers it would be similar to this - somewhere in the configurations.


1.Just search server.xml file in the conf directory [within tomcat installation folder]

2.Search for content like following:

<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" />
  1. change the port attribute to any other port number.

source: http://ohmjavaclasses.blogspot.com/2012/01/how-to-change-port-number-of-tomcat.html


  1. GO to Tools > Servers.
  2. Dialog box opens up
  3. Change the port under "server port:" Try with increamenting or decreamenting the portnumber if it still takes time to run the jsp page
  4. Uninstall netbeans, glassfishserver, Tomcat open source code. then reinstall latest JAVA SE from the mother website www.netbeans.org.
0

精彩评论

暂无评论...
验证码 换一张
取 消