Tomcat5.5 acquisition of monitoring IPV6 and IPV4 modification method

Source: Internet
Author: User

Tomcat5.5 acquisition of monitoring IPV6 and IPV4 modification method

Today encountered a very strange problem, on the same machine application 1 and application 2, using the same tomcat, but the boot of the port is different, found that two applications will have a very strange problem: two applications listening to the port is listening state, but through Telnet 127.0.0.1 port It's strange that they can't connect. The problem occurs with the machine operating system for Windows server2008. The "8080" port in the following figure can be connected by telnet, but the "8088" Port is unsuccessful by Telnet, and the connection will report "An error that cannot be connected to the destination port". Look at the difference between two ports by using the netstat command, except that 8080 ports are bound to "0.0.0.0:8080" and 8088 ports do not have such a binding. The following figure:

Any strange phenomenon behind all hidden a problem, not to reach the end of the spirit of the final solution found on the internet, after testing, the following scheme is feasible. The solution is as follows:

Locate the Conf\server.xml file in the tomcat5.5 directory and add the red font content in the following code:

<connector port= "8080" maxhttpheadersize= "8192"

maxthreads= "minsparethreads=" maxsparethreads= "75"

Enablelookups= "false" redirectport= "8443" acceptcount= "100"

connectiontimeout= "20000" disableuploadtimeout= "true"/>

Add address= "0.0.0.0", after the modified content is as follows:

<connector port= "8080" maxhttpheadersize= "8192" address= "0.0.0.0"

maxthreads= "minsparethreads=" maxsparethreads= "75"

Enablelookups= "false" redirectport= "8443" acceptcount= "100"

connectiontimeout= "20000" disableuploadtimeout= "true"/>

The root cause of this problem is that when Tomcat5.5 is started, if system support IPV6 is detected, the default listener is IPV6 port, resulting in IPV4 unreachable. Using address= "0.0.0.0" means listening to any port under the IPV4 protocol stack.

IPV4 protocol to monitor any address should be configured: 0.0.0.0

IPV6 protocol listens for any address win configuration: 0:0:0:0:0:0:0:0

It is said that Tomcat6 and later versions do not have problems, the default listener is the IPV4 address port.

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.