幸福勾勾手吧 关注:11贴子:35
  • 0回复贴,共1

spring监听器

只看楼主收藏回复

Spring3 下使用proxool做连接池的时候出现异常
ERROR 2010-07-06 12:27:10,328 [org.logicalcobwebs.proxool.ProxoolDriver] [Problem]org.logicalcobwebs.proxool.ProxoolException: Attempt to refer to a unregistered pool by its alias 'ums' at org.logicalcobwebs.proxool.ConnectionPoolDefinition.doChange(ConnectionPoolDefinition.java:246) at org.logicalcobwebs.proxool.ConnectionPoolDefinition.<init>(ConnectionPoolDefinition.java:143) at org.logicalcobwebs.proxool.ProxoolFacade.registerConnectionPool(ProxoolFacade.java:96) at org.logicalcobwebs.proxool.ProxoolDriver.connect(ProxoolDriver.java:77) at java.sql.DriverManager.getConnection(DriverManager.java:582) at java.sql.DriverManager.getConnection(DriverManager.java:154)
原因:
org.springframework.web.context.ContextLoaderListener 加载先于proxool
解决办法:将proxool 也改成listener加载并先于spring
由于proxool 还没有listener的实现,所以自己写了一个以listener方式加载proxool 的实现的补丁proxool-listenerCfg.jar
点击下载
http://dl2.iteye.com/upload/attachment/0085/7837/85354586-03bb-3eb4-b835-a93940189902.jar
下载补丁修改web.xml
Xml代码 <servlet>
<servlet-name>ServletConfigurator</servlet-name>
<servlet-class>org.logicalcobwebs.proxool.configuration.ServletConfigurator </servlet-class>
<init-param>
<param-name>xmlFile</param-name>
<param-value>WEB-INF/proxool.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
改为:
Xml代码 <context-param>
<param-name>proxoolConfigLocation</param-name>
<param-value>WEB-INF/proxool.xml</param-value>
</context-param>
<listener>
<listener-class>org.logicalcobwebs.proxool.configuration.ListenerConfigurator</listener-class>
</listener>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>


IP属地:湖北1楼2013-06-15 02:35回复