users@jersey.java.net

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

From: Tim Edwards <Edwards.T_at_cambridgeassessment.org.uk>
Date: Wed, 10 Jun 2009 09:10:40 +0100

Hi,

Not sure if it is the cause here, but I have experienced this exception
on the client side of one of our projects (although it does not use
Jersey). The basic problem is, if running on Windows, it will only allow
a certain number of ports to be open simultaneously and if you exceed
that limit then you will receive that exception.

We experienced it when running a suite of integration tests with 3000
odd cases, although we were not using that may ports at once, it takes
time for windows to recycle the port once you have finished with it, so
a lot of ports get left in a unusable state and eventually run out. It
was a random exception that didn't always happen or happen in the same
place but you could see all the ports being used by running a netstat.

We managed to alleviate the problem slightly through better use of
HttpClient but it has not solved it completely. You can set the maximum
port limit in Windows via the registry but that's not a particularly
nice "fix".

Cheers,
Tim



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


On Jun 9, 2009, at 7:28 PM, Gehl, Pascal wrote:

> Thanks for the answer.
>
> But this exception occurs in my already running instance on the client

> side when the client API tries to send a HTTP post, not at startup.
>

I misunderstood your original email, when you were describing the
similarity.

I see the exception occurs when the client is attempting to open the
connection, even before any bytes are written.

Are you saying this only occurs with a POST request? if so what about a
GET request?

How many requests do you make for this to occur?


It is indeed an odd exception on the client side. I have never observed
this before (we have some tests that start embedded servers and use the
client API). It is not clear to me if the error message is being sent
from the server to the client, i would presume it would be since this is
really associated with the server side, implying some issue with the
server side configuration as Tatu suggests.

Paul.

> Pascal
>
> -----Original Message-----
> From: Tatu Saloranta [mailto:tsaloranta_at_gmail.com]
> Sent: Tuesday, June 09, 2009 12:10 PM
> To: users_at_jersey.dev.java.net
> Subject: Re: [Jersey] Weird exception: java.lang.BindException:
> Address
> already in use.
>
> On Tue, Jun 9, 2009 at 8:32 AM, Gehl, Pascal<Pascal.Gehl_at_nuance.com>
> wrote:
>> I don't have 2 servers listening on the same port on the same
>> machine.
>
> I wouldn't be so sure. Exception basically says that yes, there is
> already a process that listens to the port.
>
> The most common case is that you already have a running instance --
> possibly one that has not cleanly shut down when it should have -- and

> try to start a new one. It could be due to startup script not ensuring

> previous instance is not properly shut down, or not waiting for that
> to occur.
>
> Btw, this is a general web server startup problem, and quite possibly
> not specific to Jersey. You can try googling for it, or check out your

> servlet container's FAQ, since it is a very common issue.
>
> Hope this helps,
>
> -+ Tatu +-
>
> ---------------------------------------------------------------------
> 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
>


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



 Click
https://www.mailcontrol.com/sr/wQw0zmjPoHdJTZGyOCrrhg==
h3sjGTelFxQnR1Q7l6e!9bxE+P8w3h9RYiELIeSJhirLg== to report this email as
spam.


If you are not the intended recipient, employee or agent responsible for delivering the message to the intended recipient, you are hereby notified that any dissemination or copying of this communication and its attachments is strictly prohibited.
If you have received this communication and its attachments in error, please return the original message and attachments to the sender using the reply facility on e-mail.
Internet communications are not secure and therefore Cambridge Assessment (the brand name for the University of Cambridge Local Examinations Syndicate, the constituent elements of which are CIE, ESOL and OCR [Oxford Cambridge and RSA Examinations is a Company Limited by Guarantee Registered in England. Registered office: 1 Hills Road, Cambridge CB1 2EU. Company number: 3484466]) does not accept legal responsibility for the contents of this message.
Any views or opinions presented are solely those of the author and do not necessarily represent those of Cambridge Assessment unless otherwise specifically stated.
The information contained in this email may be subject to public disclosure under the Freedom of Information Act 2000. Unless the information is legally exempt from disclosure, the confidentiality of this email and your reply cannot be guaranteed.