首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 软件管理 > 软件架构设计 >

XApool连接池报空指针异常解决

2012-08-27 
XApool连接池报空指针错误解决at org.enhydra.jdbc.pool.GenericPool.getFromPool(GenericPool.java:200)

XApool连接池报空指针错误解决

at org.enhydra.jdbc.pool.GenericPool.getFromPool(GenericPool.java:200) at org.enhydra.jdbc.pool.GenericPool.checkOut(GenericPool.java:351) at org.enhydra.jdbc.pool.StandardPoolDataSource.getConnection(StandardPoolDataSource.java:194) at org.enhydra.jdbc.pool.StandardPoolDataSource.getConnection(StandardPoolDataSource.java:164) at my.jotm.test.Client.getConnection(Client.java:63) java.sql.SQLException: SQLException in StandardPoolDataSource:getConnection exception: java.sql.SQLException: SQLException in  StandardPoolDataSource:getConnection no connection available java.lang.NullPointerException

?
发现这是XApool1.5的一个bug

解决方法:

--- xapool/org/enhydra/jdbc/pool/GenericPool.java-1.13 2005-06-14 21:57:10.756790600 -0500 +++ xapool/org/enhydra/jdbc/pool/GenericPool.java 2005-06-15 13:11:09.601072300 -0500 @@ -189,6 +189,12 @@             o = (GenerationObject) e.nextElement();        life = (Long) unlocked.get(o); +      if (life == null) { +   // Fix for #303462; note that this fixes the problem, but Enumeration's on Hashtable's  +   // are by definition somewhat unpredictable; a more robust fix may be in order +   log.debug("GenericPool:getFromPool fix for #303462 encountered"); +   continue; +      }        unlocked.remove(o);        // In any case the object will be removed.        // Prevents others accessing the object while we are 

?

?

下载xapool源码包,然后在orgif (life == null) continue;

?

之后重新编译打包即可。

?

注:xapool1.5是在jdk1.4的版本下编译的,所以记得在打包修改时,将IDE的J2SE版本改为1.4。

?

?

以下提供我已经编译好的jar包,使用中如果看到bad version的错误,请自行编译。

热点排行