Here is a more detailed stack trace:
Caused by: java.net.BindException: Address already in use: connect
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
at
java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
at java.net.Socket.connect(Socket.java:520)
at java.net.Socket.connect(Socket.java:470)
at sun.net.NetworkClient.doConnect(NetworkClient.java:157)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:387)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:522)
at sun.net.www.http.HttpClient.<init>(HttpClient.java:231)
at sun.net.www.http.HttpClient.New(HttpClient.java:304)
at sun.net.www.http.HttpClient.New(HttpClient.java:321)
at
sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConn
ection.java:813)
at
sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnecti
on.java:765)
at
sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.ja
va:690)
at
sun.net.www.protocol.http.HttpURLConnection.getOutputStream(HttpURLConne
ction.java:857)
at
com.sun.jersey.client.urlconnection.URLConnectionClientHandler$1$1.getOu
tputStream(URLConnectionClientHandler.java:200)
at
com.sun.jersey.api.client.CommittingOutputStream.commitWrite(CommittingO
utputStream.java:114)
at
com.sun.jersey.api.client.CommittingOutputStream.write(CommittingOutputS
tream.java:86)
at
sun.nio.cs.StreamEncoder$CharsetSE.writeBytes(StreamEncoder.java:336)
at
sun.nio.cs.StreamEncoder$CharsetSE.implFlushBuffer(StreamEncoder.java:40
4)
at
sun.nio.cs.StreamEncoder$CharsetSE.implFlush(StreamEncoder.java:408)
at sun.nio.cs.StreamEncoder.flush(StreamEncoder.java:152)
at java.io.OutputStreamWriter.flush(OutputStreamWriter.java:213)
at java.io.BufferedWriter.flush(BufferedWriter.java:236)
at
com.sun.jersey.multipart.impl.MultiPartWriter.writeTo(MultiPartWriter.ja
va:195)
at
com.sun.jersey.multipart.impl.MultiPartWriter.writeTo(MultiPartWriter.ja
va:68)
at
com.sun.jersey.api.client.TerminatingClientHandler.writeRequestEntity(Te
rminatingClientHandler.java:317)
at
com.sun.jersey.client.urlconnection.URLConnectionClientHandler._invoke(U
RLConnectionClientHandler.java:179)
at
com.sun.jersey.client.urlconnection.URLConnectionClientHandler.handle(UR
LConnectionClientHandler.java:126)
Pascal
-----Original Message-----
From: Gehl, Pascal
Sent: Tuesday, June 09, 2009 9:41 AM
To: users_at_jersey.dev.java.net
Subject: [Jersey] Weird exception: java.lang.BindException: Address
already in use.
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.
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