Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

java.lang.IllegalStateException: Already Connected Exception

843841Dec 13 2007 — edited Dec 14 2007
I get java.lang.IllegalStateException: Already Connected Exception while executing

HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setRequestMethod("POST");
(Exception here) conn.setDoOutput(true); // we want to send things
// the Content-type should be default, but we set it anyway
conn.setRequestProperty( "Content-type", "application/x-www-form-urlencoded" );
// the content-length should not be necessary, but we're cautious
conn.setRequestProperty( "Content-length", Integer.toString(body.length()));

Can any one please let me know how to get this thing fixed
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 11 2008
Added on Dec 13 2007
2 comments
867 views