Troubleshooting Server-based Tomcat port occupancy issues

Source: Internet
Author: User

    今天上午部署项目时发现8080端口已被占用。我知道只要在tomcat安装目录的conf文件夹下把service.xml文件中的端口号改成其他的就可以:
<Connector port="8080" protocol="HTTP/1.1"               connectionTimeout="20000"               redirectPort="8443" />
把8080改成其他的如:8088.但是本着“不仅要知其然,还要知其所以然”的原则,我想为什么我要妥协?端口号被占用凭什么就要我这个项目来改,8080究竟被谁占用了?    于是我在网上找了一些资料,说的很详细。比如QQ音乐、迅雷或者其他的一些类似的东西都会占用端口号的,打开cmd查看一下端口的使用情况

1. Open cmd

2. Find the port number of Pid:netstat-a-O (with PID to see exactly which application is occupied)

3. Forcibly close the Ntsd-c q-p pid (the PID number that is queried)

It turns out that Oracle, which was newly installed yesterday, is haunting. It turns out that the 8080 port is typically used because Tomcat, the Oracle built-in HTTP service, occupies 8080 ports. Then we can stop the Oracle.exe in the Task Manager or disable or modify the Oracle Xdb port with the Oracledatabase Configuration asistant
Troubleshooting Tomcat Port-occupied issues

What does the P s:netstat command do?
The function of the netstat command is to display network connections, routing tables, and network interface information to let users know which network connections are currently in operation.

The general format of the command is:

netstat [options]

The meanings of the options in the command are as follows:

-a displays all sockets, including those being monitored.
-C Displays it again every 1 seconds until the user interrupts it.
-I displays information for all network interfaces, in the same format as "Ifconfig-e".
-N Displays the network connection situation by replacing the name with the network IP address.
-R Displays the core routing table in the same format as "Route-e".
-T shows the connection condition of the TCP protocol.
-U Displays the connection condition of the UDP protocol.
-V Displays the work in progress.

-a displays the address of any associated protocol control block. Mainly used for debugging
-a displays the status of all sockets. In general, the socket associated with the server process is not displayed
-I displays the status of the auto-configuration interface. The interface state that is configured after the initial boot of the system is not in the output column
Usage of-M print network memory
-N Print the actual address, not the interpretation of the address or display the host, network name and other symbols
-R Print Route selection table
-F address-family Prints statistics and control block information for the address cluster given the name. So far, the only supported address cluster is inet
-I interface only print the interface state given the name
-P Protocol-name Print only the statistics and protocol control block information for the protocol that gives the name
-S print statistics for each protocol
-T replaces queue Length information with time information in the output display.

Column headings for the netstat command
The name of the name interface
Maximum transmission unit of the Mtu interface
The network where the Net/dest interface resides
IP address of the address interface
IPKTS Number of packets received
Ierrs number of packets that were corrupted when received
OPKTS Number of packets sent
Oeers number of packets that were corrupted when sent
Collisions number of network conflicts logged by this interface

Some common options for netstat:
netstat-s– this option to display their statistics separately according to each protocol. If your application (such as a Web browser) is running slowly, or you cannot display data such as a Web page, you can use this option to view the information displayed. You need to take a closer look at the rows of the statistics, find the keywords that went wrong, and then identify the problem.
netstat-e– This option is used to display statistical data about Ethernet. The items it lists include the total number of bytes sent, the number of errors, the number of deletes, the number of datagrams, and the number of broadcasts. These statistics have both the number of datagrams sent and the number of datagrams received. This option can be used to count some basic network traffic).
netstat-r– This option to display information about the routing table, similar to what you see later when you use the route Print command. In addition to showing valid routes, the currently active connection is displayed.
netstat-a– This option displays a list of all valid connection information, including established connections (established), and also those connected to the Listener connection request (LISTENING).
bnetstat-n– shows all valid connections that have been established.
? awkphp Classic? state meaning in Netstat-an

Meaning of state in Netstat-an
LISTEN: Listening for connection requests from a remote TCP port
Syn-sent: Wait for a matching connection request after sending the connection request
Syn-received: Wait for confirmation of connection request after receiving and sending a connection request
Established: Represents an open connection
Fin-wait-1: Waiting for a remote TCP connection interrupt request, or confirmation of a previous connection interrupt request
Fin-wait-2: Waiting for connection interrupt request from remote TCP
Close-wait: Waiting for a connection interrupt request from a local user
CLOSING: Waiting for remote TCP to confirm connection interruption
Last-ack: Waiting for acknowledgement of the original connection interrupt request to the remote TCP
Time-wait: Wait enough time to ensure that the remote TCP receives a connection interrupt request acknowledgement
CLOSED: No connection status
Actually can man netstat, look at the stat part of the explanation

Statethe State of  the Socket. Since There is no statesinchRaw mode andUsually no states usedinchUDP, this column is Leftblank. Normally this can One  ofSeveral values:establishedtheSocketFa= anEstablished connection. Syn_senttheSocketis actively attempting toEstablishaConnection. SYN_RECVA connection request has been received from  theNetwork. Fin_wait1theSocketis closed, and  theConnection is shutting down. Fin_wait2connection is closed, and  the SocketIs waiting for aShutdown from  theRemote end.Time_waittheSocketIs waiting After Close  toHandle packets Stillinch  theNetwork. CLOSED theSocketIs notbeing used. Close_waitthe Remote End have  shut down, waiting   for the socket  to close.Last_ackthe Remote End  have shut down,   and the socket  is closed. Waiting  for acknowledgement.LISTEN theSocketIs listening forIncoming connections. Such Sockets is notIncludedinch  theOutput unless you specify the–listening (-L)or–all (-a) option. Closingboth sockets is shut down but we still don ' t has all of our data sent. Unknownthe State of  the Socketis unknown.

Troubleshooting Server-based Tomcat port occupancy issues

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.