users@jersey.java.net

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

From: Gehl, Pascal <Pascal.Gehl_at_nuance.com>
Date: Tue, 9 Jun 2009 11:32:22 -0400

I don't have 2 servers listening on the same port on the same machine.

I just wrote that I found this exception weird because I usually have it
when I accidentally try to start 2 servers using the same port on the
same machine.

I have this exception when my component tries to send a message to
another component on another machine using jersey client API.

And I only have one instance of each component (jetty servlet
containers) running on different machines on different ports.

Pascal

This message contains privileged and confidential information. If you
are not the intended recipient, please both contact me to alert me of
the error and delete the message.


-----Original Message-----
From: Paul.Sandoz_at_Sun.COM [mailto:Paul.Sandoz_at_Sun.COM]
Sent: Tuesday, June 09, 2009 10:09 AM
To: users_at_jersey.dev.java.net
Subject: Re: [Jersey] Weird exception: java.lang.BindException: Address
already in use.


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
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
For additional commands, e-mail: users-help_at_jersey.dev.java.net