Questo contenuto non è disponibile nella lingua selezionata.
Appendix A. Java IPv4 and IPv6 properties
You can use Java properties to configure IPv4 and IPv6 addresses. You can subsequently export these properties to Tomcat and use address values to specify Tomcat bindings.
A.1. Overview of Java IPv4 and IPv6 properties Copia collegamentoCollegamento copiato negli appunti!
Java provides two properties that you can use to configure IPv4 and IPv6 addresses:
- java.net.preferIPv4Stack (default: false)
-
If IPv6 is available, the underlying native socket is an IPv6 socket by default. This socket enables applications to connect and accept connections from IPv4 and IPv6 hosts. If applications use IPv4 sockets only, set this property to
true. However, applications that are using IPv4 sockets only cannot communicate with IPv6-only hosts. - java.net.preferIPv6Addresses (default: false)
-
If a host has both IPv4 and IPv6 addresses, and IPv6 is available, the default behavior is to use IPv4 addresses over IPv6. This allows backward compatibility. If applications depend on an IPv4 address representation, such as 192.168.1.1, set this property to
trueto change the preference, and use IPv6 addresses over IPv4 where possible.
A.2. Exporting Java IPv4 and IPv6 properties to Tomcat Copia collegamentoCollegamento copiato negli appunti!
You can export Java IPv4 and IPv6 properties to Tomcat by setting CATALINA_OPTS in the JWS_HOME/tomcat/bin/setenv.* file. On Red Hat Enterprise Linux, the setenv file has a .sh extension. On Windows Server, the setenv file has a .bat extension.
Procedure
If the
JWS_HOME/tomcat/bin/setenv.*file does not exist, create the file.NoteIf you are using Red Hat Enterprise Linux, create a
setenv.shfile. If you are using Windows Server, create asetenv.batfile.To export Java IPv4 and IPv6 properties to Tomcat, perform either of the following steps:
If you are using Red Hat Enterprise Linux, enter the following command:
export "CATALINA_OPTS=-Djava.net.preferIPv4Stack=YOUR_VALUE -Djava.net.preferIPv6Addresses=YOUR_VALUE"If you are using Windows Server, enter the following command:
set "CATALINA_OPTS=-Djava.net.preferIPv4Stack=YOUR_VALUE -Djava.net.preferIPv6Addresses=YOUR_VALUE"
A.3. Configuring Tomcat bindings Copia collegamentoCollegamento copiato negli appunti!
You can configure Tomcat bindings in the JWS_HOME/tomcat/conf/server.xml file by specifying the IPv6 address.
Procedure
-
Open the
JWS_HOME/tomcat/conf/server.xmlfile. To specify the Tomcat binding address, enter the following details:
<Server ... address="TOMCAT_BINDING_ADDRESS">To specify the HTTP connector address, enter the following details:
<Connector protocol="HTTP/1.1" ... address="HTTP_CONNECTOR_ADDRESS">To specify the AJP connector address, enter the following details:
<Connector protocol="AJP/1.3" ... address="AJP_CONNECTOR_ADDRESS">
Ensure that you replace TOMCAT_BINDING_ADDRESS, HTTP_CONNECTOR_ADDRESS, and AJP_CONNECTOR_ADDRESS with the correct IPv6 address.