You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by k9...@operamail.com on 2012/07/22 17:03:26 UTC

Tomcat 7.0.27 listens only @IPv6 localhost, ignores 'use IPv4' JAVA_OPTS in tomcat.conf. How to correctly force IPv4?

I've installed

	rpm -qa | grep -i ^tomcat
		tomcat-lib-7.0.27-7.1.noarch
		tomcat-docs-webapp-7.0.27-7.1.noarch
		tomcat-javadoc-7.0.27-7.1.noarch
		tomcat-webapps-7.0.27-7.1.noarch
		tomcat-admin-webapps-7.0.27-7.1.noarch
		tomcat-servlet-3_0-api-7.0.27-7.1.noarch
		tomcat-7.0.27-7.1.noarch
		tomcat-el-2_2-api-7.0.27-7.1.noarch
		tomcat-jsp-2_2-api-7.0.27-7.1.noarch


with

  update-alternatives --config java
  There are 2 choices for the alternative java (providing
  /usr/bin/java).
  
    Selection    Path                                       Priority  
    Status
  ------------------------------------------------------------
    0            /usr/lib64/jvm/jre-1.7.0-openjdk/bin/java   17147    
    auto mode
  * 1            /usr/lib64/jvm/jre-1.7.0-openjdk/bin/java   17147    
  manual mode
    2            /usr/lib64/jvm/jre-1.7.0-sun/bin/java       1700     
    manual mode

on

	uname -a
		Linux svr 3.1.10-1.16-desktop #1 SMP PREEMPT Wed Jun 27
		05:21:40 UTC 2012 (d016078) x86_64 x86_64 x86_64
		GNU/Linux

IPv4 is enabled on the server.  The IPv6 stack is also enabled, and
necessarily configured as,

	grep bindv6only /etc/sysctl.conf
		net.ipv6.bindv6only = 1

I want Tomcat listening on the IPv4 localhost @ 127.0.0.1.

So, reading here -
http://tomcat.10.n6.nabble.com/Tomcat-uses-IPv6-td2164369.html#a2164371
- and elsewhere, I set

	vi /etc/tomcat/tomcat.conf
		...
		JAVA_OPTS="Djava.net.preferIPv4Stack=true
		-Djava.net.preferIPv4Addresses=true"
		CATALINA_OPTS="Djava.net.preferIPv4Stack=true
		-Djava.net.preferIPv4Addresses=true"
		...

now, @ tomcat start,

	ps ax | grep tomcat
	 6530 ?        Sl     0:03 /etc/alternatives/jre/bin/java
	 -Djava.net.preferIPv4Stack=true
	 -Djava.net.preferIPv4Addresses=true
	 -Djava.net.preferIPv4Stack=true
	 -Djava.net.preferIPv4Addresses=true -classpath
	 :/usr/share/tomcat/bin/bootstrap.jar:/usr/share/tomcat/bin/tomcat-juli.jar:/usr/share/java/commons-daemon.jar
	 -Dcatalina.base=/usr/share/tomcat
	 -Dcatalina.home=/usr/share/tomcat -Djava.endorsed.dirs=
	 -Djava.io.tmpdir=/var/cache/tomcat/temp
	 -Djava.util.logging.config.file=/usr/share/tomcat/conf/logging.properties
	 -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
	 org.apache.catalina.startup.Bootstrap start

but, Tomcat still listens only on IPv6

	netstat -pan --tcp | grep 8080
		tcp        0      0 :::8080                 :::*        
		           LISTEN      6530/java

and is unavailable/unreachable @ 127.0.0.1

	telnet 127.0.0.1 8080
		Trying 127.0.0.1...
		telnet: connect to address 127.0.0.1: Connection refused

	telnet ::1 8080
		Trying ::1...
		Connected to ::1.
		Escape character is '^]'.
		telnet>

has the method for getting Tomcat to listen only @ IPv4 changed for v7?

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: Tomcat 7.0.27 listens only @IPv6 localhost, ignores 'use IPv4' JAVA_OPTS in tomcat.conf. How to correctly force IPv4?

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Tim Watts [mailto:tim@cliftonfarm.org] 
> Subject: Re: Tomcat 7.0.27 listens only @IPv6 localhost, ignores 
> 'use IPv4' JAVA_OPTS in tomcat.conf. How to correctly force IPv4?

> Since you've told the OS to not allow IPv4 connections on IPv6 sockets,
> I believe you would need to configure a separate <Connector> on the same
> port for the IPv4 loopback address.

That shouldn't be necessary.  But since the OP hasn't told us what his <Connector> configuration is, we can only speculate.  An address setting of "0.0.0.0" in the sole <Connector> might be adequate.  Need real information.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Tomcat 7.0.27 listens only @IPv6 localhost, ignores 'use IPv4' JAVA_OPTS in tomcat.conf. How to correctly force IPv4?

Posted by k9...@operamail.com.
Hi,

On Sun, Jul 22, 2012, at 03:57 PM, Tim Watts wrote:
> But doing so would close the door on ::1, turning "prefer" into
> "require".  Whereas binding on ::* allows both IPv6 & 4 in.  I guess
> what's confusing in all this is that the "preferences" just deal with
> "outbound" addresses and connections (e.g. preferIPv4Stack means the JVM
> will send out IPv4 packets etc.).
> 
> It's worth noting that, even if it did behave this way, you would still
> have needed to specify the loopback address.  Otherwise Tomcat would
> have been accessible on any IPv4 address configured on the node.  Just
> setting those properties would never have been sufficient for what you
> were really after.

I've read a bunch trying to get this straight.  Lots of noise, and I was
still off track on the outbound vs inbound behavior.

"@ bug" insist that the behavior as is - which has managed to confuse
quite a few others as well, resulting in numerous suggestions to 'file a
bug' - is simply "a config problem" on my end,   It seems they're happy
with that, and that this is expected/clear behavior.  To each their own
...

Thanks for being patient and taking the time to clarify.  Again, noted &
appreciated!

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Tomcat 7.0.27 listens only @IPv6 localhost, ignores 'use IPv4' JAVA_OPTS in tomcat.conf. How to correctly force IPv4?

Posted by Tim Watts <ti...@cliftonfarm.org>.
On Sun, 2012-07-22 at 11:21 -0700, k9157@operamail.com wrote:
> On Sun, Jul 22, 2012, at 02:08 PM, Tim Watts wrote:
> > By default, Tomcat will listen on port 8080 on all available addresses
> > (IPv6 and 4, barring configuration settings at the OS level).  The key
> > "word" in those java.net properties is "prefer" (i.e. not "require").
> > So the door is still open to IPv6 even with these properties.
> 
> 
> I still would presume that, given the specification of "prefer", when
> localhost is referenced, given the choice of either IPv4 or IPv6 in a
> functional dual-stack, that it *would* prefer and select IPv4, i.e.,
> 127.0.0.1.
> 
But doing so would close the door on ::1, turning "prefer" into
"require".  Whereas binding on ::* allows both IPv6 & 4 in.  I guess
what's confusing in all this is that the "preferences" just deal with
"outbound" addresses and connections (e.g. preferIPv4Stack means the JVM
will send out IPv4 packets etc.).

It's worth noting that, even if it did behave this way, you would still
have needed to specify the loopback address.  Otherwise Tomcat would
have been accessible on any IPv4 address configured on the node.  Just
setting those properties would never have been sufficient for what you
were really after.

> apparently, not the case.
> 
> clarification noted.
> 
> cheers.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 


Re: Tomcat 7.0.27 listens only @IPv6 localhost, ignores 'use IPv4' JAVA_OPTS in tomcat.conf. How to correctly force IPv4?

Posted by k9...@operamail.com.

On Sun, Jul 22, 2012, at 08:42 PM, André Warnier wrote:
> You still have a Connector listening on port 8009 (and IPv6). You may
> want to disable that  one too (the AJP connector), to match your above desires.

Of course.  Now at,

netstat -pan --tcp | grep java
tcp        0      0 127.0.0.1:8080          0.0.0.0:*              
LISTEN      29141/java          
tcp        0      0 127.0.0.1:8005          0.0.0.0:*              
LISTEN      29141/java          
tcp        0      0 127.0.0.1:8009          0.0.0.0:*              
LISTEN      29141/java          

thanks!

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Tomcat 7.0.27 listens only @IPv6 localhost, ignores 'use IPv4' JAVA_OPTS in tomcat.conf. How to correctly force IPv4?

Posted by André Warnier <aw...@ice-sa.com>.
By the way,

k9157@operamail.com wrote:
 >
(previously) :
No.  I want Tomcat7 to listen ONLY on one address: the IPv4 loopback @
127.0.0.1.  No other IPv4 addresses, and no IPv6 addresses at all.
---

and

> netstat -pan --tcp | grep java
> 	tcp        0      0 127.0.0.1:8080          0.0.0.0:*           
> 	   LISTEN      25254/java
> 	tcp        0      0 127.0.0.1:8005          :::*                
> 	   LISTEN      25254/java
> 	tcp        0      0 :::8009                 :::*                
> 	   LISTEN      25254/java
> 

You still have a Connector listening on port 8009 (and IPv6). You may want to disable that 
one too (the AJP connector), to match your above desires.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Tomcat 7.0.27 listens only @IPv6 localhost, ignores 'use IPv4' JAVA_OPTS in tomcat.conf. How to correctly force IPv4?

Posted by k9...@operamail.com.
Hi,

On Sun, Jul 22, 2012, at 02:08 PM, Tim Watts wrote:
> > No.  I want Tomcat7 to listen ONLY on one address: the IPv4 loopback @
> > 127.0.0.1.  No other IPv4 addresses, and no IPv6 addresses at all.
> > 
> Oh, that's easy: specify address="127.0.0.1" on your <Connector>.  

it certainly appears to be:

vi /etc/tomcat/server.xml

	...
	  <Connector port="8080" protocol="HTTP/1.1"
+                      address="127.0.0.1"
	               connectionTimeout="20000"
	               redirectPort="8443" />
	...


service tomcat start
netstat -pan --tcp | grep java
	tcp        0      0 127.0.0.1:8080          0.0.0.0:*           
	   LISTEN      25254/java
	tcp        0      0 127.0.0.1:8005          :::*                
	   LISTEN      25254/java
	tcp        0      0 :::8009                 :::*                
	   LISTEN      25254/java

Thanks!

> By default, Tomcat will listen on port 8080 on all available addresses
> (IPv6 and 4, barring configuration settings at the OS level).  The key
> "word" in those java.net properties is "prefer" (i.e. not "require").
> So the door is still open to IPv6 even with these properties.


I still would presume that, given the specification of "prefer", when
localhost is referenced, given the choice of either IPv4 or IPv6 in a
functional dual-stack, that it *would* prefer and select IPv4, i.e.,
127.0.0.1.

apparently, not the case.

clarification noted.

cheers.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Tomcat 7.0.27 listens only @IPv6 localhost, ignores 'use IPv4' JAVA_OPTS in tomcat.conf. How to correctly force IPv4?

Posted by Tim Watts <ti...@cliftonfarm.org>.
On Sun, 2012-07-22 at 10:32 -0700, k9157@operamail.com wrote:
> Hi,
> 
> On Sun, Jul 22, 2012, at 01:24 PM, Tim Watts wrote:
> > On Sun, 2012-07-22 at 08:03 -0700, k9157@operamail.com wrote:
> > > 		Linux svr 3.1.10-1.16-desktop #1 SMP PREEMPT Wed Jun 27
> > > 		05:21:40 UTC 2012 (d016078) x86_64 x86_64 x86_64
> > > 		GNU/Linux
> > > 
> > > IPv4 is enabled on the server.  The IPv6 stack is also enabled, and
> > > necessarily configured as,
> > > 
> > > 	grep bindv6only /etc/sysctl.conf
> > > 		net.ipv6.bindv6only = 1
> > > 
> > > I want Tomcat listening on the IPv4 localhost @ 127.0.0.1.
> > 
> > So you want Tomcat to listen on all IPv6 addresses plus the IPv4
> > loopback address but no other IPv4 addresses?
> 
> No.  I want Tomcat7 to listen ONLY on one address: the IPv4 loopback @
> 127.0.0.1.  No other IPv4 addresses, and no IPv6 addresses at all.
> 
Oh, that's easy: specify address="127.0.0.1" on your <Connector>.  

By default, Tomcat will listen on port 8080 on all available addresses
(IPv6 and 4, barring configuration settings at the OS level).  The key
"word" in those java.net properties is "prefer" (i.e. not "require").
So the door is still open to IPv6 even with these properties.

BTW, not that it will impact you, but it's java.net.preferIPv6Addreses
(defaults to false):
>         -Djava.net.preferIPv4Addresses=true

> Specifying a listener proptocol, address & port should be a fairly
> commonplace undertaking ...
> 
> > Since you've told the OS to not allow IPv4 connections on IPv6 sockets,
> > I believe you would need to configure a separate <Connector> on the same
> > port for the IPv4 loopback address.
> 
> Not sure if this, then, still holds.
> 
Sounds like you don't need an additional <Connector>.  Just modify the
existing one.

> I'd understaood that those 'use IPv4' -D options should do exactly what
> I intend to here.   Apparently not, though ...
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 


Re: Tomcat 7.0.27 listens only @IPv6 localhost, ignores 'use IPv4' JAVA_OPTS in tomcat.conf. How to correctly force IPv4?

Posted by k9...@operamail.com.
Hi,

On Sun, Jul 22, 2012, at 01:24 PM, Tim Watts wrote:
> On Sun, 2012-07-22 at 08:03 -0700, k9157@operamail.com wrote:
> > 		Linux svr 3.1.10-1.16-desktop #1 SMP PREEMPT Wed Jun 27
> > 		05:21:40 UTC 2012 (d016078) x86_64 x86_64 x86_64
> > 		GNU/Linux
> > 
> > IPv4 is enabled on the server.  The IPv6 stack is also enabled, and
> > necessarily configured as,
> > 
> > 	grep bindv6only /etc/sysctl.conf
> > 		net.ipv6.bindv6only = 1
> > 
> > I want Tomcat listening on the IPv4 localhost @ 127.0.0.1.
> 
> So you want Tomcat to listen on all IPv6 addresses plus the IPv4
> loopback address but no other IPv4 addresses?

No.  I want Tomcat7 to listen ONLY on one address: the IPv4 loopback @
127.0.0.1.  No other IPv4 addresses, and no IPv6 addresses at all.

Specifying a listener proptocol, address & port should be a fairly
commonplace undertaking ...

> Since you've told the OS to not allow IPv4 connections on IPv6 sockets,
> I believe you would need to configure a separate <Connector> on the same
> port for the IPv4 loopback address.

Not sure if this, then, still holds.

I'd understaood that those 'use IPv4' -D options should do exactly what
I intend to here.   Apparently not, though ...

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Tomcat 7.0.27 listens only @IPv6 localhost, ignores 'use IPv4' JAVA_OPTS in tomcat.conf. How to correctly force IPv4?

Posted by Tim Watts <ti...@cliftonfarm.org>.
On Sun, 2012-07-22 at 08:03 -0700, k9157@operamail.com wrote:
> 		Linux svr 3.1.10-1.16-desktop #1 SMP PREEMPT Wed Jun 27
> 		05:21:40 UTC 2012 (d016078) x86_64 x86_64 x86_64
> 		GNU/Linux
> 
> IPv4 is enabled on the server.  The IPv6 stack is also enabled, and
> necessarily configured as,
> 
> 	grep bindv6only /etc/sysctl.conf
> 		net.ipv6.bindv6only = 1
> 
> I want Tomcat listening on the IPv4 localhost @ 127.0.0.1.

So you want Tomcat to listen on all IPv6 addresses plus the IPv4
loopback address but no other IPv4 addresses?

Since you've told the OS to not allow IPv4 connections on IPv6 sockets,
I believe you would need to configure a separate <Connector> on the same
port for the IPv4 loopback address.


> 
> So, reading here -
> http://tomcat.10.n6.nabble.com/Tomcat-uses-IPv6-td2164369.html#a2164371
> - and elsewhere, I set
> 
> 	vi /etc/tomcat/tomcat.conf
> 		...
> 		JAVA_OPTS="Djava.net.preferIPv4Stack=true
> 		-Djava.net.preferIPv4Addresses=true"
> 		CATALINA_OPTS="Djava.net.preferIPv4Stack=true
> 		-Djava.net.preferIPv4Addresses=true"
> 		...
> 
> now, @ tomcat start,
> 
> 	ps ax | grep tomcat
> 	 6530 ?        Sl     0:03 /etc/alternatives/jre/bin/java
> 	 -Djava.net.preferIPv4Stack=true
> 	 -Djava.net.preferIPv4Addresses=true
> 	 -Djava.net.preferIPv4Stack=true
> 	 -Djava.net.preferIPv4Addresses=true -classpath
> 	 :/usr/share/tomcat/bin/bootstrap.jar:/usr/share/tomcat/bin/tomcat-juli.jar:/usr/share/java/commons-daemon.jar
> 	 -Dcatalina.base=/usr/share/tomcat
> 	 -Dcatalina.home=/usr/share/tomcat -Djava.endorsed.dirs=
> 	 -Djava.io.tmpdir=/var/cache/tomcat/temp
> 	 -Djava.util.logging.config.file=/usr/share/tomcat/conf/logging.properties
> 	 -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
> 	 org.apache.catalina.startup.Bootstrap start
> 
> but, Tomcat still listens only on IPv6
> 
> 	netstat -pan --tcp | grep 8080
> 		tcp        0      0 :::8080                 :::*        
> 		           LISTEN      6530/java
> 
> and is unavailable/unreachable @ 127.0.0.1
> 
> 	telnet 127.0.0.1 8080
> 		Trying 127.0.0.1...
> 		telnet: connect to address 127.0.0.1: Connection refused
> 
> 	telnet ::1 8080
> 		Trying ::1...
> 		Connected to ::1.
> 		Escape character is '^]'.
> 		telnet>
> 
> has the method for getting Tomcat to listen only @ IPv4 changed for v7?
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 


RE: Tomcat 7.0.27 listens only @IPv6 localhost, ignores 'use IPv4' JAVA_OPTS in tomcat.conf. How to correctly force IPv4?

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: k9157@operamail.com [mailto:k9157@operamail.com] 
> Subject: Re: Tomcat 7.0.27 listens only @IPv6 localhost, ignores 
> 'use IPv4' JAVA_OPTS in tomcat.conf. How to correctly force IPv4?

>   <Service name="Catalina">
>     <Connector port="8080" protocol="HTTP/1.1"
>                connectionTimeout="20000"
>                redirectPort="8443" />
>     <Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />

> > Have you installed APR?

> yes.

Let's try two things, one at a time.  First, turn off APR by setting the port 8080 protocol to:
	"org.apache.coyote.http11.Http11NioProtocol"

Second (even if the above works), set the protocol back to the default and add address="0.0.0.0" and see what happens.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Tomcat 7.0.27 listens only @IPv6 localhost, ignores 'use IPv4' JAVA_OPTS in tomcat.conf. How to correctly force IPv4?

Posted by k9...@operamail.com.
> What happens if you install a real Tomcat from tomcat.apache.org

same issue

> What do your <Connector> elements in your server.xml file look like?

It's out-of-the-box:

  ...
  <Service name="Catalina">
    <Connector port="8080" protocol="HTTP/1.1"
               connectionTimeout="20000"
               redirectPort="8443" />
    <Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />
    <Engine name="Catalina" defaultHost="localhost">
  ...

> Have you installed APR?

yes.

	apr-2-config --version
		2.0.0
	svn info `apr-2-config --srcdir` | egrep "URL|Revision"
		URL: https://svn.apache.org/repos/asf/apr/apr/trunk
		Revision: 1363601

> What's in the Tomcat logs

@ start,

	ps ax | grep -i java
		21972 ?        Sl     0:03
		/etc/alternatives/jre/bin/java
		-Djava.net.preferIPv4Stack=true
		-Djava.net.preferIPv4Addresses=true -classpath
		:/usr/share/tomcat/bin/bootstrap.jar:/usr/share/tomcat/bin/tomcat-juli.jar:/usr/share/java/commons-daemon.jar
		-Dcatalina.base=/usr/share/tomcat
		-Dcatalina.home=/usr/share/tomcat -Djava.endorsed.dirs=
		-Djava.io.tmpdir=/var/cache/tomcat/temp
		-Djava.util.logging.config.file=/usr/share/tomcat/conf/logging.properties
		-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
		org.apache.catalina.startup.Bootstrap start

logs:

	==> catalina.2012-07-22.log <==
	Jul 22, 2012 10:46:04 AM
	org.apache.catalina.core.AprLifecycleListener init
	INFO: Loaded APR based Apache Tomcat Native library 1.1.23.

	==> catalina.out <==
	Jul 22, 2012 10:46:04 AM
	org.apache.catalina.core.AprLifecycleListener init
	INFO: Loaded APR based Apache Tomcat Native library 1.1.23.

	==> catalina.2012-07-22.log <==
	Jul 22, 2012 10:46:04 AM
	org.apache.catalina.core.AprLifecycleListener init
	INFO: APR capabilities: IPv6 [true], sendfile [true], accept
	filters [false], random [true].

	==> catalina.out <==
	Jul 22, 2012 10:46:04 AM
	org.apache.catalina.core.AprLifecycleListener init
	INFO: APR capabilities: IPv6 [true], sendfile [true], accept
	filters [false], random [true].

	==> catalina.2012-07-22.log <==
	Jul 22, 2012 10:46:04 AM org.apache.coyote.AbstractProtocol init
	INFO: Initializing ProtocolHandler ["http-apr-8080"]

	==> catalina.out <==
	Jul 22, 2012 10:46:04 AM org.apache.coyote.AbstractProtocol init
	INFO: Initializing ProtocolHandler ["http-apr-8080"]

	==> catalina.2012-07-22.log <==
	Jul 22, 2012 10:46:04 AM org.apache.coyote.AbstractProtocol init
	INFO: Initializing ProtocolHandler ["ajp-apr-8009"]

	==> catalina.out <==
	Jul 22, 2012 10:46:04 AM org.apache.coyote.AbstractProtocol init
	INFO: Initializing ProtocolHandler ["ajp-apr-8009"]

	==> catalina.2012-07-22.log <==
	Jul 22, 2012 10:46:04 AM org.apache.catalina.startup.Catalina
	load
	INFO: Initialization processed in 667 ms

	==> catalina.out <==
	Jul 22, 2012 10:46:04 AM org.apache.catalina.startup.Catalina
	load
	INFO: Initialization processed in 667 ms

	==> catalina.2012-07-22.log <==
	Jul 22, 2012 10:46:04 AM
	org.apache.catalina.core.StandardService startInternal
	INFO: Starting service Catalina

	==> catalina.out <==
	Jul 22, 2012 10:46:04 AM
	org.apache.catalina.core.StandardService startInternal
	INFO: Starting service Catalina

	==> catalina.2012-07-22.log <==
	Jul 22, 2012 10:46:04 AM org.apache.catalina.core.StandardEngine
	startInternal
	INFO: Starting Servlet Engine: Apache Tomcat/7.0.27

	==> catalina.out <==
	Jul 22, 2012 10:46:04 AM org.apache.catalina.core.StandardEngine
	startInternal
	INFO: Starting Servlet Engine: Apache Tomcat/7.0.27

	==> catalina.2012-07-22.log <==
	Jul 22, 2012 10:46:04 AM org.apache.catalina.startup.HostConfig
	deployDirectory
	INFO: Deploying web application directory
	/srv/tomcat/webapps/manager

	==> catalina.out <==
	Jul 22, 2012 10:46:04 AM org.apache.catalina.startup.HostConfig
	deployDirectory
	INFO: Deploying web application directory
	/srv/tomcat/webapps/manager

	==> catalina.2012-07-22.log <==
	Jul 22, 2012 10:46:04 AM org.apache.catalina.startup.HostConfig
	deployDirectory
	INFO: Deploying web application directory
	/srv/tomcat/webapps/examples

	==> catalina.out <==
	Jul 22, 2012 10:46:04 AM org.apache.catalina.startup.HostConfig
	deployDirectory
	INFO: Deploying web application directory
	/srv/tomcat/webapps/examples

	==> localhost.2012-07-22.log <==
	Jul 22, 2012 10:46:04 AM
	org.apache.catalina.core.ApplicationContext log
	INFO: ContextListener: contextInitialized()
	Jul 22, 2012 10:46:04 AM
	org.apache.catalina.core.ApplicationContext log
	INFO: SessionListener: contextInitialized()
	Jul 22, 2012 10:46:04 AM
	org.apache.catalina.core.ApplicationContext log
	INFO: ContextListener:
	attributeAdded('org.apache.jasper.compiler.TldLocationsCache',
	'org.apache.jasper.compiler.TldLocationsCache@304e5770')

	==> catalina.2012-07-22.log <==
	Jul 22, 2012 10:46:04 AM org.apache.catalina.startup.HostConfig
	deployDirectory
	INFO: Deploying web application directory
	/srv/tomcat/webapps/ROOT

	==> catalina.out <==
	Jul 22, 2012 10:46:04 AM org.apache.catalina.startup.HostConfig
	deployDirectory
	INFO: Deploying web application directory
	/srv/tomcat/webapps/ROOT

	==> catalina.2012-07-22.log <==
	Jul 22, 2012 10:46:05 AM org.apache.catalina.startup.HostConfig
	deployDirectory
	INFO: Deploying web application directory
	/srv/tomcat/webapps/docs

	==> catalina.out <==
	Jul 22, 2012 10:46:05 AM org.apache.catalina.startup.HostConfig
	deployDirectory
	INFO: Deploying web application directory
	/srv/tomcat/webapps/docs

	==> catalina.2012-07-22.log <==
	Jul 22, 2012 10:46:05 AM org.apache.catalina.startup.HostConfig
	deployDirectory
	INFO: Deploying web application directory
	/srv/tomcat/webapps/host-manager

	==> catalina.out <==
	Jul 22, 2012 10:46:05 AM org.apache.catalina.startup.HostConfig
	deployDirectory
	INFO: Deploying web application directory
	/srv/tomcat/webapps/host-manager

	==> catalina.2012-07-22.log <==
	Jul 22, 2012 10:46:05 AM org.apache.catalina.startup.HostConfig
	deployDirectory
	INFO: Deploying web application directory
	/srv/tomcat/webapps/sample

	==> catalina.out <==
	Jul 22, 2012 10:46:05 AM org.apache.catalina.startup.HostConfig
	deployDirectory
	INFO: Deploying web application directory
	/srv/tomcat/webapps/sample

	==> catalina.2012-07-22.log <==
	Jul 22, 2012 10:46:05 AM org.apache.coyote.AbstractProtocol
	start
	INFO: Starting ProtocolHandler ["http-apr-8080"]

	==> catalina.out <==
	Jul 22, 2012 10:46:05 AM org.apache.coyote.AbstractProtocol
	start
	INFO: Starting ProtocolHandler ["http-apr-8080"]

	==> catalina.2012-07-22.log <==
	Jul 22, 2012 10:46:05 AM org.apache.coyote.AbstractProtocol
	start
	INFO: Starting ProtocolHandler ["ajp-apr-8009"]

	==> catalina.out <==
	Jul 22, 2012 10:46:05 AM org.apache.coyote.AbstractProtocol
	start
	INFO: Starting ProtocolHandler ["ajp-apr-8009"]

	==> catalina.2012-07-22.log <==
	Jul 22, 2012 10:46:05 AM org.apache.catalina.startup.Catalina
	start
	INFO: Server startup in 760 ms

	==> catalina.out <==
	Jul 22, 2012 10:46:05 AM org.apache.catalina.startup.Catalina
	start
	INFO: Server startup in 760 ms


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: Tomcat 7.0.27 listens only @IPv6 localhost, ignores 'use IPv4' JAVA_OPTS in tomcat.conf. How to correctly force IPv4?

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: k9157@operamail.com [mailto:k9157@operamail.com] 
> Subject: Tomcat 7.0.27 listens only @IPv6 localhost, ignores 
> 'use IPv4' JAVA_OPTS in tomcat.conf. How to correctly force IPv4?

> I've installed
>	rpm -qa | grep -i ^tomcat
>		tomcat-lib-7.0.27-7.1.noarch
>		tomcat-docs-webapp-7.0.27-7.1.noarch
>		tomcat-javadoc-7.0.27-7.1.noarch
>		tomcat-webapps-7.0.27-7.1.noarch
>		tomcat-admin-webapps-7.0.27-7.1.noarch
>		tomcat-servlet-3_0-api-7.0.27-7.1.noarch
>		tomcat-7.0.27-7.1.noarch
>		tomcat-el-2_2-api-7.0.27-7.1.noarch
>		tomcat-jsp-2_2-api-7.0.27-7.1.noarch

What happens if you install a real Tomcat from tomcat.apache.org, rather than a mangled 3rd-party version?

What do your <Connector> elements in your server.xml file look like?

Have you installed APR?

What's in the Tomcat logs (assuming you can even find them with a 3rd-party installation)?

BTW. it's not necessary to set both CATALINA_OPTS and JAVA_OPTS.  JAVA_OPTS is used for both Tomcat startup and shutdown, CATALINA_OPTS only for startup.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Tomcat 7.0.27 listens only @IPv6 localhost, ignores 'use IPv4' JAVA_OPTS in tomcat.conf. How to correctly force IPv4?

Posted by k9...@operamail.com.
reading here on this issue:

	"Re: Tomcat is only listening with ip6 and not ip4"
	http://linux.derkeiler.com/Mailing-Lists/Debian/2009-12/msg01262.html

		" ... Thus you should report a bug against Tomcat. Also
		you can replace "net.ipv6.bindv6only=1" with
		"net.ipv6.bindv6only=0" in your /etc/sysctl.d/ as a
		temporary solution. ..."

filed -> 

Bug 53583 - Tomcat 7.0.27 ignores 'use IPv4' JAVA_OPTS in tomcat.conf,
listens only @IPv6 localhost when separate IPv4/IPv6 sockets are
specified
https://issues.apache.org/bugzilla/show_bug.cgi?id=53583

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Tomcat 7.0.27 listens only @IPv6 localhost, ignores 'use IPv4' JAVA_OPTS in tomcat.conf. How to correctly force IPv4?

Posted by k9...@operamail.com.
Hi,

On Sun, Jul 22, 2012, at 09:29 AM, Tony Anecito wrote:
> I do it at the OS level via the adaptor properties for windows. If your
> network does not support IPv6 I would disable it else you will get errors
> in your logs about IPv6 for like say DHCP assignment.

My network supports IPv6 just fine.

This server is configured for dual-stack, with separate sockets
specified for IPv4 & IPv6 as defined at:

	https://www.kernel.org/doc/man-pages/online/pages/man7/ipv6.7.html

		IPV6_V6ONLY (since Linux 2.4.21 and 2.6)
		              If this flag is set to true (nonzero),
		              then the socket is restricted to
		              sending and receiving IPv6 packets only. 
		              In this case, an IPv4 and an
		              IPv6 application can bind to a single port
		              at the same time.

		              If this flag is set to false (zero), then
		              the socket can be used to
		              send and receive packets to and from an
		              IPv6 address or an IPv4-mapped
		              IPv6 address.

		              The argument is a pointer to a boolean
		              value in an integer.

		              The default value for this flag is defined
		              by the contents of the file
		              /proc/sys/net/ipv6/bindv6only.  The
		              default value for that file is 0
		              (false).

In this config, any/all other apps on the box can be easily configured
to listen on IPv4 &/or IPv6.

I need Tomcat to listen/respond on IPv4 localhost @ 127.0.0.1.

Atm, it appears to be ignoring instructions to do so.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Tomcat 7.0.27 listens only @IPv6 localhost, ignores 'use IPv4' JAVA_OPTS in tomcat.conf. How to correctly force IPv4?

Posted by Tony Anecito <ad...@yahoo.com>.
I do it at the OS level via the adaptor properties for windows. If your network does not support IPv6 I would disable it else you will get errors in your logs about IPv6 for like say DHCP assignment.
 
Regards,
-Tony

--- On Sun, 7/22/12, k9157@operamail.com <k9...@operamail.com> wrote:


From: k9157@operamail.com <k9...@operamail.com>
Subject: Tomcat 7.0.27 listens only @IPv6 localhost, ignores 'use IPv4' JAVA_OPTS in tomcat.conf. How to correctly force IPv4?
To: users@tomcat.apache.org
Date: Sunday, July 22, 2012, 9:03 AM



I've installed

    rpm -qa | grep -i ^tomcat
        tomcat-lib-7.0.27-7.1.noarch
        tomcat-docs-webapp-7.0.27-7.1.noarch
        tomcat-javadoc-7.0.27-7.1.noarch
        tomcat-webapps-7.0.27-7.1.noarch
        tomcat-admin-webapps-7.0.27-7.1.noarch
        tomcat-servlet-3_0-api-7.0.27-7.1.noarch
        tomcat-7.0.27-7.1.noarch
        tomcat-el-2_2-api-7.0.27-7.1.noarch
        tomcat-jsp-2_2-api-7.0.27-7.1.noarch


with

  update-alternatives --config java
  There are 2 choices for the alternative java (providing
  /usr/bin/java).
  
    Selection    Path                                       Priority  
    Status
  ------------------------------------------------------------
    0            /usr/lib64/jvm/jre-1.7.0-openjdk/bin/java   17147    
    auto mode
  * 1            /usr/lib64/jvm/jre-1.7.0-openjdk/bin/java   17147    
  manual mode
    2            /usr/lib64/jvm/jre-1.7.0-sun/bin/java       1700     
    manual mode

on

    uname -a
        Linux svr 3.1.10-1.16-desktop #1 SMP PREEMPT Wed Jun 27
        05:21:40 UTC 2012 (d016078) x86_64 x86_64 x86_64
        GNU/Linux

IPv4 is enabled on the server.  The IPv6 stack is also enabled, and
necessarily configured as,

    grep bindv6only /etc/sysctl.conf
        net.ipv6.bindv6only = 1

I want Tomcat listening on the IPv4 localhost @ 127.0.0.1.

So, reading here -
http://tomcat.10.n6.nabble.com/Tomcat-uses-IPv6-td2164369.html#a2164371
- and elsewhere, I set

    vi /etc/tomcat/tomcat.conf
        ...
        JAVA_OPTS="Djava.net.preferIPv4Stack=true
        -Djava.net.preferIPv4Addresses=true"
        CATALINA_OPTS="Djava.net.preferIPv4Stack=true
        -Djava.net.preferIPv4Addresses=true"
        ...

now, @ tomcat start,

    ps ax | grep tomcat
     6530 ?        Sl     0:03 /etc/alternatives/jre/bin/java
     -Djava.net.preferIPv4Stack=true
     -Djava.net.preferIPv4Addresses=true
     -Djava.net.preferIPv4Stack=true
     -Djava.net.preferIPv4Addresses=true -classpath
     :/usr/share/tomcat/bin/bootstrap.jar:/usr/share/tomcat/bin/tomcat-juli.jar:/usr/share/java/commons-daemon.jar
     -Dcatalina.base=/usr/share/tomcat
     -Dcatalina.home=/usr/share/tomcat -Djava.endorsed.dirs=
     -Djava.io.tmpdir=/var/cache/tomcat/temp
     -Djava.util.logging.config.file=/usr/share/tomcat/conf/logging.properties
     -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
     org.apache.catalina.startup.Bootstrap start

but, Tomcat still listens only on IPv6

    netstat -pan --tcp | grep 8080
        tcp        0      0 :::8080                 :::*        
                   LISTEN      6530/java

and is unavailable/unreachable @ 127.0.0.1

    telnet 127.0.0.1 8080
        Trying 127.0.0.1...
        telnet: connect to address 127.0.0.1: Connection refused

    telnet ::1 8080
        Trying ::1...
        Connected to ::1.
        Escape character is '^]'.
        telnet>

has the method for getting Tomcat to listen only @ IPv4 changed for v7?

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org