SSh框架Struts2在web.xml中配置Spring监听器与proxool.xml的问题(数据库连接池)

Spring3 下使用proxool做连接池的时候出现异常
ERROR 2015-01-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 的实现的补丁

 

 

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>

Web.xml配置改为:

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>

 

proxool-listenerCfg.jar 下载地址:http://pan.baidu.com/s/1ntFVSmd

你可能感兴趣的:(struts2)