users@jersey.java.net

Re: [Jersey] Weird exception: java.lang.BindException: Address already in use.

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Tue, 09 Jun 2009 16:08:54 +0200

On Jun 9, 2009, at 3:40 PM, Gehl, Pascal wrote:

> I have 2 components using REST/XML to communicate.
> When one of them tries to send a message to the other one I get this
> exception:
>
> Caused by: com.sun.jersey.api.client.ClientHandlerException:
> java.net.BindException: Address already in use: connect
> at
> com
> .sun.jersey.client.urlconnection.URLConnectionClientHandler.handle(UR
> LConnectionClientHandler.java:128)
> at com.sun.jersey.api.client.Client.handle(Client.java:397)
> at
> com.sun.jersey.api.client.WebResource.handle(WebResource.java:557)
> at
> com.sun.jersey.api.client.WebResource.access$300(WebResource.java:69)
> at
> com.sun.jersey.api.client.WebResource$Builder.post(WebResource.java:
> 499)
>
> The thing I don't understand is that I usually receive this exception
> when I try to start a second web container listening on the same
> port as
> another one on the same machine.
>

You cannot have two servers on the same machine listening on the same
port as they will conflict, you need to use different ports for each
server instance.

I am actually surprised you managed to start a second web server on
the same port, that should fail.

Paul.

> Why do I get that exception sending a HTTP POST ?
>
> Thanks in advance...
>
> Pascal
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>