You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Raffaele <r....@prismasw.it> on 2007/06/27 11:54:35 UTC
java.net.BindException: Address already in use: JVM_Bind:xxxx
Hi all,
I know there are other threads about this problem, but no one ever said the
solution!
I hope to find more accurate help because this problem is very tedious.
In particular, I have the exception (see the end of post) when I start
consecutively tomcat Embedded, for example:
- start tomcat embedded
- do some test
- close tomcat embedded calling Embedded.stop() as suggested in all articles
found on the net.
- start again tomcat embedded --> Exception
The only two solutions I found were:
1) wait some time the try again...
2) change ecah time the port
Don't tell me please to see if that port is already used by other
processes....The problem exists with all ports I try and no one process uses
the same port as tomcat.
Thanks in advance,
Best regards.
Raffaele
Exception in thread "main" java.lang.RuntimeException: LifecycleException:
Protocol handler initialization failed: java.net.BindException: Address
already in use: JVM_Bind:8080
at webrainbow.services.WebService.<init>(WebService.java:93)
at
webrainbow.services.WebServiceMainTest.<init>(WebServiceMainTest.java:25)
at webrainbow.services.WebServiceMainTest.main(WebServiceMainTest.java:37)
Caused by: LifecycleException: Protocol handler initialization failed:
java.net.BindException: Address already in use: JVM_Bind:8080
at org.apache.catalina.connector.Connector.initialize(Connector.java:1019)
at org.apache.catalina.startup.Embedded.start(Embedded.java:827)
at webrainbow.services.WebService.startTomcat(WebService.java:210)
at webrainbow.services.WebService.<init>(WebService.java:91)
... 2 more
--
View this message in context: http://www.nabble.com/java.net.BindException%3A-Address-already-in-use%3A-JVM_Bind%3Axxxx-tf3987312.html#a11321503
Sent from the Tomcat - User mailing list archive 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: java.net.BindException: Address already in use: JVM_Bind:xxxx
Posted by Kirst Martin Wolfgang <MK...@PortolanCS.com>.
Hi,
[... consecutively restart tomcat ...]
> The only two solutions I found were:
> 1) wait some time the try again...
> 2) change ecah time the port
In my ears it looks like you do not "unbind" the port.
I know, ist typical for Windows, when you kill a process,
which uses a port in an unclean way, than windows will block
this port for ~30 to 60 seconds. Only after this time,
anyone is able to bind to this port again.
I only can suggest two things:
- check, that when you .stop() tomcat the port is cleanly unbind/closed
- when you bind a socket you can set an option like "SO_REUSEADDR",
but this is more like a bad hack.
With this option set, multiple sockets can be opened and if your
process is the only one, all goes fine.
Sorry, I don't know where to set this option in java.
Greetings
Martin
---------------------------------------------------------------------
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