proxool连接池问题
我以WEB方式构造proxool连接池总是报:
2007-8-16 15:59:36 org.logicalcobwebs.proxool.ProxoolFacade registerConnectionPool
信息: Proxool 0.9.0RC3 (10-Jan-2007 01:38)
2007-8-16 15:59:36 org.logicalcobwebs.proxool.ProxoolDriver connect
严重: Problem
org.logicalcobwebs.proxool.ProxoolException: Attempt to refer to a unregistered pool by its alias 'dw'
at org.logicalcobwebs.proxool.ConnectionPoolDefinition.doChange(ConnectionPoolDefinition.java:250)
at org.logicalcobwebs.proxool.ConnectionPoolDefinition.<init>(ConnectionPoolDefinition.java:147)
at org.logicalcobwebs.proxool.ProxoolFacade.registerConnectionPool(ProxoolFacade.java:96)
at org.logicalcobwebs.proxool.ProxoolDriver.connect(ProxoolDriver.java:77)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at hr.bao.dao.DaoFactory.getProConnection(DaoFactory.java:17)
at hr.bao.dao.TestConn.findElement(TestConn.java:12)
at hr.bao.dao.TestConn.main(TestConn.java:27)
java.sql.SQLException: org.logicalcobwebs.proxool.ProxoolException: Attempt to refer to a unregistered pool by its alias 'dw'
at org.logicalcobwebs.proxool.ProxoolDriver.connect(ProxoolDriver.java:109)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at hr.bao.dao.DaoFactory.getProConnection(DaoFactory.java:17)
at hr.bao.dao.TestConn.findElement(TestConn.java:12)
at hr.bao.dao.TestConn.main(TestConn.java:27)
Exception in thread \"main\" java.lang.NullPointerException
at hr.bao.dao.TestConn.findElement(TestConn.java:13)
at hr.bao.dao.TestConn.main(TestConn.java:27)
代码如下:
连接工厂:
public static Connection getProConnection(){
try {
Class.forName(\"org.logicalcobwebs.proxool.ProxoolDriver\");
conn = DriverManager.getConnection(\"proxool.dw\");
} catch (SQLException e) {
e.printStackTrace();
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
return conn;
}
持久类:
public void findElement(){
try {
Connection conn = DaoFactory.getProConnection();
Statement st = conn.createStatement();
String sql = \"select DB_LINK from T_WH_ETL_JOBS\";
ResultSet rs = st.executeQuery(sql);
while(rs.next()){
System.out.println(rs.getString(1));
}
} catch (SQLException e) {
e.printStackTrace();
}
}
public static void main(String[] args) {
new TestConn().findElement();
}
Web.xml配置
<servlet>
<servlet-name>ServletConfigurator</servlet-name>
<servlet-class>org.logicalcobwebs.proxool.configuration.ServletConfigurator</servlet-class>
<init-param>
<param-name>propertyFile</param-name>
<param-value>WEB-INF\config\proxool.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
proxool.xml配置
<?xml version=\"1.0\" encoding=\"UTF-8\"?>
<something-else-entirely>
<proxool>
<alias>dw</alias>
<driver-url>jdbc:Oracle:thin:@10.66.3.106:1521:dwdvlp</driver-url>
<driver-class>oracle.jdbc.driver.OracleDriver</driver-class>
<driver-properties>
<property name=\"user\" value=\"wh\"/>
<property name=\"password\" value=\"wh\"/>
</driver-properties>
<maximum-connection-count>20</maximum-connection-count>
</proxool>
</something-else-entirely>
在线急等 不知道有没有知道是为什么