You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Hans Müller <Ha...@gmx.net> on 2006/08/01 13:49:54 UTC

Tomcat 5.5 and IPv6 configuration

Hello guys,

currently I'm trying to set-up a standalone Tomcat 5.5.17 server in an IPv6 environment on a FreeBSD 6.1 machine. Unfortunately, Tomcat refuses to start. Here is the relevant content of the catalina.out log-file:

SEVERE: StandardServer.await: create[8005]:
java.net.BindException: Can't assign requested address
        at java.net.PlainSocketImpl.socketBind(Native Method)
        at java.net.PlainSocketImpl.bind(PlainSocketImpl.java:359)
        at java.net.ServerSocket.bind(ServerSocket.java:319)
        at java.net.ServerSocket.<init>(ServerSocket.java:185)
        at org.apache.catalina.core.StandardServer.await(StandardServer.java:372)
        at org.apache.catalina.startup.Catalina.await(Catalina.java:615)
        at org.apache.catalina.startup.Catalina.start(Catalina.java:575)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:294)
        at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:432)

I googled for a solution to this problem, but the only one I found (several times) was to disable the IPv6 support of the JVM by calling it with -Djava.net.preferIPv4Stack=true -Djava.net.preferIPv4Addresses. Since I explicitely want to use IPv6 this is no solution for me.

Then I looked at the particular portion of the source code which causes the exception and I found that the IPv4 address 127.0.0.1 is actually hardcoded several times there (in StandardServer.java, Catalina.java and some others). Of course, the JVM cannot create an IPv6 address using this IPv4 representation. Therefore I changed "127.0.0.1" to "localhost", recompiled Tomcat and happily discovered that it is working now.

BUT... since I can read everywhere that Tomcat should be IPv6 compliant, this code-change doesn't seem to be the real solution to me. Firtly I'm not the only one who is using IPv6 and secondly the developers are definitely not that stupid to hardcode an IPv4 address and thereby break IPv6 compatibility. So, I'd like to ask you if there is a configuration-only way to solve this issue, i.e. to avoid that StandardServer is being called?

I am using the server-minimal.xml file that is being shipped with Tomcat and an IPv6 capable JVM 1.5.

Hans
-- 


Echte DSL-Flatrate dauerhaft für 0,- Euro*. Nur noch kurze Zeit!
"Feel free" mit GMX DSL: http://www.gmx.net/de/go/dsl

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


Re: Tomcat 5.5 and IPv6 configuration

Posted by Hans Müller <Ha...@gmx.net>.
Hi and thanks for your reply.

> I've never had the problem you describe. I use Linux though. On my machine the 
> shutdown port binds to IPv6 representation of 127.0.0.1:
> 
> tcp6       0      0 ::ffff:127.0.0.1:8007   :::*                    LISTEN     
> 7970/java

I made some more tests and I think my problem is due to a
Java/FreeBSD/IPv6 incompatibility of some sort which prevents Java to
fallback to the IPv6 representation ::ffff:127.0.0.1. When I run a
test-app (which I took from another thread regarding this topic, see
below) on a Linux machine it actually behaves as expected and binds to
the address ::ffff:127.0.0.1. However, when I run it on any of my
FreeBSD machines with an IPv6 capable JVM, it throws exactly the same
BindException as the Tomcat when trying to create an IPv6 address from a
given IPv4 representation.

import java.net.*;
public class TestServer {
         public static void main (String[] args) throws Exception {
                 if (args.length   != 2) {
                         System.out.println("Usage: java TestServer
<host_address_ipv6> <port>");
                         System.exit(1);
                 }
                 System.out.println("Host Address="+args[0]);
                 System.out.println("Port        ="+args[1]);
                 ServerSocket ss = new ServerSocket();
                 ss.bind(new
                       InetSocketAddress(InetAddress.getByName(args[0]),
                        Integer.parseInt(args[1])));
                 System.out.println("ServerSocket Bound");
                 ss.accept();
         }
}

I know this is not a Java/FreeBSD list, but I would be glad if somebody
knows a solution and would post it here.

> Are you using APR? If so, is IPv6 support compiled in?

No, I'm not using ARP, just a plain Tomcat installation.

Regards,
Hans

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


Re: Tomcat 5.5 and IPv6 configuration

Posted by Markus Schönhaber <ma...@schoenhaber.de>.
Hans Müller wrote:
> currently I'm trying to set-up a standalone Tomcat 5.5.17 server in an IPv6
> environment on a FreeBSD 6.1 machine. Unfortunately, Tomcat refuses to
> start. Here is the relevant content of the catalina.out log-file:
>
> SEVERE: StandardServer.await: create[8005]:
> java.net.BindException: Can't assign requested address
[...]
> Then I looked at the particular portion of the source code which causes the
> exception and I found that the IPv4 address 127.0.0.1 is actually hardcoded
> several times there (in StandardServer.java, Catalina.java and some
> others). Of course, the JVM cannot create an IPv6 address using this IPv4
> representation. Therefore I changed "127.0.0.1" to "localhost", recompiled
> Tomcat and happily discovered that it is working now.
>
> BUT... since I can read everywhere that Tomcat should be IPv6 compliant,
> this code-change doesn't seem to be the real solution to me. Firtly I'm not
> the only one who is using IPv6 and secondly the developers are definitely
> not that stupid to hardcode an IPv4 address and thereby break IPv6
> compatibility. So, I'd like to ask you if there is a configuration-only way
> to solve this issue, i.e. to avoid that StandardServer is being called?

I've never had the problem you describe. I use Linux though. On my machine the 
shutdown port binds to IPv6 representation of 127.0.0.1:

tcp6       0      0 ::ffff:127.0.0.1:8007   :::*                    LISTEN     
7970/java

(I've changed the port from 8005 to 8007).

Are you using APR? If so, is IPv6 support compiled in?

Regards
  mks

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


Re: Tomcat 5.5 and IPv6 configuration

Posted by Martin Gainty <mg...@hotmail.com>.
Markus/Zhang

The only topic for IPv6 in J2SE 5 JavaDoc I found addresses correct 
formatting for v6 spec addresses
Documentation for InetAddress is located at
http://java.sun.com/j2se/1.5.0/docs/api/
which states
For IPv4 address format, please refer to Inet4Address#format;
For IPv6 address format, please refer to Inet6Address#format

With regards to IPv6 the documentation for proper formatting states
The preferred form is x:x:x:x:x:x:x:x, where the 'x's are the hexadecimal 
values of the eight 16-bit pieces of the address. This is the full form. For 
example,
1080:0:0:0:8:800:200C:417A

Viel Gluck,
Martin--
______________________________________________
Disclaimer and confidentiality note
Everything in this e-mail and any attachments relates to the official 
business of Sender. This transmission is of a confidential nature and Sender 
does not endorse distribution to any party other than intended recipient. 
Sender does not necessarily endorse content contained within this 
transmission.

>
>
>
>Markus Schรถnhaber wrote:
> >
> > Your first two questions are in no way Tomcat-specific.
> > Anyway...
> >
> > Ipv6Tomcat wrote:
> >>      yes,I had installed tomcat 5.0.28 simply in my machine(xp sp2)
> >> ,because my computer has deployed ipv4 and ipv6 address, when i install
> >> tomcat successfully, I just put the "http://localhost:8080" to 
>webbrowser
> >> to test tomcat.How can i know localhost refer to the ipv6 address?
> >
> > Use
> > netstat -n
> > to see the active connections.
> > netstat -na
> > will also show whether Tomcat has bound to an IPv6 address.
> > Or, even simpler, use the numeric IPv6 address in the URL, like
> > http://[::1]:8080
> >
> >>      secondly,How can i know my machine use ipv6 address? it seems that
> >> ipv4 address is default address(InetAddress.getByName("hostname")  
>return
> >> ipv4,not ipv6 address.).
> >
> > ipconfig /all
> >
> > BTW: you might want to take a look at this:
> > 
>http://www.microsoft.com/technet/itsolutions/network/evaluate/technol/tcpipfund/tcpipfund.mspx
> >
> >>      thirdly,i want to know if there is a deployment change for ipv6
> >> environment? just  modify the deployment file like server.xml etc.
> >
> > None that I know of.
> >
> > Regards
> >   mks
> >
> > ---------------------------------------------------------------------
> > To start a new topic, e-mail: users@tomcat.apache.org
> > To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> > For additional commands, e-mail: users-help@tomcat.apache.org
> >
> >
> >
>Hi mks:
>     Thank you for your detailed reply and sorry to reply you so slowly.May
>you have a nice weekend too.
>Yea,I have got it according to your suggestions.Thank you ,I am very glad 
>to
>write to you, it is a very good thing for me .I hope I can often 
>communicate
>with you. May you Happy..
>     Best wishes.
>     rock.
>--
>View this message in context: 
>http://www.nabble.com/Tomcat-5.5-and-IPv6-configuration-tf2033096.html#a5671064
>Sent from the Tomcat - User forum at Nabble.com.
>
>
>---------------------------------------------------------------------
>To start a new topic, e-mail: users@tomcat.apache.org
>To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>For additional commands, e-mail: users-help@tomcat.apache.org
>



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


Re: Tomcat 5.5 and IPv6 configuration

Posted by Ipv6Tomcat <zh...@cnic.cn>.

Markus Schönhaber wrote:
> 
> Your first two questions are in no way Tomcat-specific.
> Anyway...
> 
> Ipv6Tomcat wrote:
>>      yes,I had installed tomcat 5.0.28 simply in my machine(xp sp2)
>> ,because my computer has deployed ipv4 and ipv6 address, when i install
>> tomcat successfully, I just put the "http://localhost:8080" to webbrowser
>> to test tomcat.How can i know localhost refer to the ipv6 address?
> 
> Use
> netstat -n
> to see the active connections.
> netstat -na
> will also show whether Tomcat has bound to an IPv6 address.
> Or, even simpler, use the numeric IPv6 address in the URL, like
> http://[::1]:8080
> 
>>      secondly,How can i know my machine use ipv6 address? it seems that
>> ipv4 address is default address(InetAddress.getByName("hostname")  return
>> ipv4,not ipv6 address.).
> 
> ipconfig /all
> 
> BTW: you might want to take a look at this:
> http://www.microsoft.com/technet/itsolutions/network/evaluate/technol/tcpipfund/tcpipfund.mspx
> 
>>      thirdly,i want to know if there is a deployment change for ipv6
>> environment? just  modify the deployment file like server.xml etc.
> 
> None that I know of.
> 
> Regards
>   mks
> 
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 
> 
> 
Hi mks:
    Thank you for your detailed reply and sorry to reply you so slowly.May
you have a nice weekend too.
Yea,I have got it according to your suggestions.Thank you ,I am very glad to
write to you, it is a very good thing for me .I hope I can often communicate
with you. May you Happy..
    Best wishes.
    rock.
-- 
View this message in context: http://www.nabble.com/Tomcat-5.5-and-IPv6-configuration-tf2033096.html#a5671064
Sent from the Tomcat - User forum at Nabble.com.


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


Re: Tomcat 5.5 and IPv6 configuration

Posted by Markus Schönhaber <ma...@schoenhaber.de>.
Your first two questions are in no way Tomcat-specific.
Anyway...

Ipv6Tomcat wrote:
>      yes,I had installed tomcat 5.0.28 simply in my machine(xp sp2)
> ,because my computer has deployed ipv4 and ipv6 address, when i install
> tomcat successfully, I just put the "http://localhost:8080" to webbrowser
> to test tomcat.How can i know localhost refer to the ipv6 address?

Use
netstat -n
to see the active connections.
netstat -na
will also show whether Tomcat has bound to an IPv6 address.
Or, even simpler, use the numeric IPv6 address in the URL, like
http://[::1]:8080

>      secondly,How can i know my machine use ipv6 address? it seems that
> ipv4 address is default address(InetAddress.getByName("hostname")  return
> ipv4,not ipv6 address.).

ipconfig /all

BTW: you might want to take a look at this:
http://www.microsoft.com/technet/itsolutions/network/evaluate/technol/tcpipfund/tcpipfund.mspx

>      thirdly,i want to know if there is a deployment change for ipv6
> environment? just  modify the deployment file like server.xml etc.

None that I know of.

Regards
  mks

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


Re: Tomcat 5.5 and IPv6 configuration

Posted by Ipv6Tomcat <zh...@cnic.cn>.

Markus Schönhaber wrote:
> 
> I'd suggest that you simply install Tomcat. If you encounter a specific 
> problem, ask about it here. 
> 
hi, mks: 
Thank you for you reply so quickly.
     yes,I had installed tomcat 5.0.28 simply in my machine(xp sp2) ,because
my computer has deployed ipv4 and ipv6 address, when i install tomcat
successfully, I just put the "http://localhost:8080" to webbrowser to test
tomcat.How can i know localhost refer to the ipv6 address? 
     secondly,How can i know my machine use ipv6 address? it seems that ipv4
address is default address(InetAddress.getByName("hostname")  return
ipv4,not ipv6 address.).
     thirdly,i want to know if there is a deployment change for ipv6
environment? just  modify the deployment file like server.xml etc.

Thank you !
Best wishes.
rock.
-- 
View this message in context: http://www.nabble.com/Tomcat-5.5-and-IPv6-configuration-tf2033096.html#a5646216
Sent from the Tomcat - User forum at Nabble.com.


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


Re: Tomcat 5.5 and IPv6 configuration

Posted by Markus Schönhaber <ma...@schoenhaber.de>.
Ipv6Tomcat wrote:
> hello Hans and all guys:
>    Nice to see the question you provided.I have the same idea( use a
> configuration-only way ). Do you solve it?

Yes:
http://mail-archives.apache.org/mod_mbox/tomcat-users/200608.mbox/%3c20060802072352.242630@gmx.net%3e
Won't help you much when you're on Windows, though.

> I want to use tomcat 5 on ipv6 
> environment(winxp sp2 ,jdk1.5), could you give me some suggestions or ways
> about how can i deploy it ? thank you very much.

I'd suggest that you simply install Tomcat. If you encounter a specific 
problem, ask about it here.

Regards
  mks

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


Re: Tomcat 5.5 and IPv6 configuration

Posted by Ipv6Tomcat <zh...@cnic.cn>.
hello Hans and all guys:
   Nice to see the question you provided.I have the same idea( use a
configuration-only way ). Do you solve it? I want to use tomcat 5 on ipv6
environment(winxp sp2 ,jdk1.5), could you give me some suggestions or ways
about how can i deploy it ? thank you very much. 
   Best regards.
   rock.(zhangxg@cnic.cn)
-- 
View this message in context: http://www.nabble.com/Tomcat-5.5-and-IPv6-configuration-tf2033096.html#a5645215
Sent from the Tomcat - User forum at Nabble.com.


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