关于httpclient (java.lang.IllegalStateException)

多线程时使用httpclient-4.1.2.jar包的new DefaultHttpClient()构造客户端报错!

Invalid use of SingleClientConnManager: connection still allocated.Make sure to release the connection before allocating another one.java.lang.IllegalStateException: Invalid use of SingleClientConnManager: connection still allocated.Make sure to release the connection before allocating another one....

解决办法:加上 new ThreadSafeClientConnManager()  即可解决该问题


HttpClient httpclient = new DefaultHttpClient(new ThreadSafeClientConnManager());

猜你喜欢

转载自sundayha.iteye.com/blog/1727859
今日推荐