调用rest地址时异常:Invalid use of BasicClientConnManager: connection still allocated.
2015-02-02 11:52
866 查看
Caused by: java.lang.IllegalStateException: Invalid use of BasicClientConnManager: connection still allocated.
Make sure to release the connection before allocating another one.
使用Resteasy进行restful方式调用时出现上面的异常,原因大概是由于HttpClient做多线程rest调用导致。代码是:
改为:
Make sure to release the connection before allocating another one.
使用Resteasy进行restful方式调用时出现上面的异常,原因大概是由于HttpClient做多线程rest调用导致。代码是:
RegisterBuiltin.register(ResteasyProviderFactory.getInstance()); yourClassName = ProxyFactory.create(yourClassName.class, url);
改为:
ClientConnectionManager cm = new ThreadSafeClientConnManager(); HttpClient httpClient = new DefaultHttpClient(cm); ClientExecutor executor = new ApacheHttpClient4Executor(httpClient); RegisterBuiltin.register(ResteasyProviderFactory.getInstance()); yourClassName = ProxyFactory.create(yourClassName.class, url, executor);即可解决上面的异常问题
相关文章推荐
- Invalid use of BasicClientConnManager: connection still allocated.
- Invalid use of BasicClientConnManager: connection still allocated.
- Invalid use of BasicClientConnManager: connection still allocated解决方案
- httpclient 释放连接的问题 Invalid use of SingleClientConnManager: connection still allocated
- httpclient4.1.2抓数据Invalid use of SingleClientConnManager: connection still allocated解决方案
- Invalid use of SingleClientConnManager: connection still allocated解决方案
- Invalid use of SingleClientConnManager: connection still allocatedMake sure to release the connectio
- W/SingleClientConnManager(1155):Invalid use of SingleClientConnManager: connection still allocated.
- Invalid use of SingleClientConnManager: connection still allocated.
- 由于httpClient调用导致的ESTABLISHED过多和 Connection rest by peer 异常
- org.apache.http.impl.conn.PoolingClientConnectionManager
- 连接数据库时的异常:TNS:listener does not currently know of SID given in connect descriptor The Connection descriptor used by the client was: localhost:1521:orc
- org.apache.http.conn.ClientConnectionManager
- mongodb导数据是的错误:[conn56] AssertionException handling request, closing client connection: 10334 Invalid BSONObj size: -1431247360 (0x00E6B0AA) first ele
- SmartGwt: attempt to use DataSource of type iscServer without SmartClient Server option.
- xml读取异常Invalid byte 1 of 1-byte UTF-8 sequence
- Dom4j无法以UTF-8保存xml文件,出现异常:Invalid byte 2 of 2-byte UTF-8 sequence
- "ClientAbortException: java.net.SocketException: Connection reset by peer: socket write error"异常出现的原因
- invalid+use+of+non-static+member+function+问题
- Implementation of a Custom String Manager (Basic Method)