本文主要是介绍Invalid use of SingleClientConnManager: connection still allocated. 解决方法,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
在多线程环境下,使用 httpclient.xxx.jar包的 new DefaultHttpClient() ; 构造函数创建的client客户端将会引发以下这个错误:
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 DefaultHttpClient(new ThreadSafeClientConnManager()); 构造一个client客户端即可解决该问题
这篇关于Invalid use of SingleClientConnManager: connection still allocated. 解决方法的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!