近日使用hibernate+proxool连接池时,总是报异常:
Proxool Provider unable to load JAXP configurator file: proxool.xml
org.logicalcobwebs.proxool.ProxoolException: Parsing failed.
这个是hibernate.cfg.xml文件
<hibernate-configuration> <session-factory>
<property name="hibernate.connection.provider_class">
org.hibernate.connection.ProxoolConnectionProvider
</property>
<property name="hibernate.proxool.pool_alias">DBPool</property>
<property name="hibernate.proxool.xml">proxool.xml</property> 
<property name="dialect">
org.hibernate.dialect.MySQLDialect
</property>
<property name="show_sql">true</property>
<property name="hibernate.proxool.existing_pool">true</property>
<mapping resource="com/neu/eshop/buyerAccount/dto/BuyerAccount.hbm.xml" />
<mapping resource="com/neu/eshop/buyer/dto/Buyer.hbm.xml" />
<mapping resource="com/neu/eshop/buyerAddress/dto/BuyerAddress.hbm.xml" />
<mapping resource="com/neu/eshop/brand/dto/Brand.hbm.xml" /> 
<mapping resource="com/neu/eshop/seller/dto/Seller.hbm.xml" />
<mapping resource="com/neu/eshop/store/dto/Store.hbm.xml" />
<mapping resource="com/neu/eshop/goods/dto/Goods.hbm.xml" />
<mapping resource="com/neu/eshop/influentialMan/dto/InfluentialMan.hbm.xml" />
<mapping resource="com/neu/eshop/category/dto/Category.hbm.xml" /> </session-factory></hibernate-configuration>
这个是proxool.xml文件
<?xml version="1.0" encoding="UTF-8"?>
<!--
  the proxool configuration can be embedded within your own application's.
  Anything outside the "proxool" tag is ignored.
-->
<something-else-entirely>
  <proxool>
    <alias>DBPool</alias>
    <driver-url>jdbc:mysql://localhost:3306/tool</driver-url>
    <driver-class>com.mysql.jdbc.Driver</driver-class>
    <driver-properties>
      <property name="user" value="root" />
      <property name="password" value="123" />
    </driver-properties>
    <house-keeping-test-sql>select CURRENT_DATE</house-keeping-test-sql>
    <house-keeping-sleep-time>90000</house-keeping-sleep-time>
    <simultaneous-build-throttle>20</simultaneous-build-throttle>
    <maximum-connection-count>100</maximum-connection-count>
    <minimum-connection-count>10</minimum-connection-count>
    <maximum-connection-lifetime>3600000</maximum-connection-lifetime>
  </proxool>
</something-else-entirely>都放置在根路径下,用的是proxool-0.8.3.jar但不知道问什么总是报错?

解决方案 »

  1.   

    你的配置少了一部,还要修改web.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/classes/proxool.xml</param-value>
          </init-param>
          <load-on-startup>1</load-on-startup>
        </servlet>这样弄进去以后,肯定没问题。