标签:存在 target class file jpg min config ble rac
上篇博文讲到简易配置 proxool 连接池:http://www.cnblogs.com/linnuo/p/7232380.html
由于把说明注释留在了 proxool.xml 配置文件里导致配置后报错,原因如下:
hibernate.cfg.xml 代码片段:
<session-factory> <property name="show_sql">true</property> <property name="generate_statistics">false</property> <property name="connection.useUnicode">true</property> <property name="hibernate.dialect">org.hibernate.dialect.MySQL5Dialect</property> <property name="hibernate.connection.provider_class">org.hibernate.connection.ProxoolConnectionProvider</property> <property name="hibernate.proxool.xml">proxool.xml</property> <property name="hibernate.proxool.pool_alias">mysqldb</property> </session-factory>
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>mysqldb</alias> <!--proxool只能管理由自己产生的连接--> <driver-url>jdbc:mysql://127.0.0.1:3306/ucom?useUnicode=true&characterEncoding=UTF8</driver-url> <!-- JDBC驱动程序 --> <driver-class>com.mysql.jdbc.Driver</driver-class> <driver-properties> <property name="user" value="root"/> <property name="password" value="gdyl2017"/> </driver-properties> <!-- proxool自动侦察各个连接状态的时间间隔(毫秒),侦察到空闲的连接就马上回收,超时的销毁--> <house-keeping-sleep-time>90000</house-keeping-sleep-time> <!-- 指因未有空闲连接可以分配而在队列中等候的最大请求数,超过这个请求数的用户连接就不会被接受--> <maximum-new-connections>20</maximum-new-connections> <!-- 最少保持的空闲连接数--> <prototype-count>5</prototype-count> <!-- 允许最大连接数,超过了这个连接,再有请求时,就排在队列中等候,最大的等待请求数由maximum-new-connections决定--> <maximum-connection-count>100</maximum-connection-count> <!-- 最小连接数--> <minimum-connection-count>10</minimum-connection-count> <!-- 在分配连接前后是否进行有效性测试,这个是解决本问题的关键 --> <test-before-use>true</test-before-use> <test-after-use>true</test-after-use> <!-- 用于测试的SQL语句 一定要写(不知道问什么) --> <house-keeping-test-sql>SELECT CURRENT_USER</house-keeping-test-sql> </proxool> </something-else-entirely>
以上代码放在本地运行没问题,但是放到服务器报错
找了许久终于发现了问题:proxool.xml 文件里不能存在中文,包括注释
解决方案:
将 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>mysqldb</alias> <driver-url>jdbc:mysql://127.0.0.1:3306/ucom?useUnicode=true&characterEncoding=UTF8</driver-url> <driver-class>com.mysql.jdbc.Driver</driver-class> <driver-properties> <property name="user" value="root"/> <property name="password" value="gdyl2017"/> </driver-properties> <house-keeping-sleep-time>90000</house-keeping-sleep-time> <maximum-new-connections>20</maximum-new-connections> <prototype-count>5</prototype-count> <maximum-connection-count>100</maximum-connection-count> <minimum-connection-count>10</minimum-connection-count> <test-before-use>true</test-before-use> <test-after-use>true</test-after-use> <house-keeping-test-sql>SELECT CURRENT_USER</house-keeping-test-sql> </proxool> </something-else-entirely>
连接池报错 Proxool Provider unable to load JAXP configurator file: proxool.xml
标签:存在 target class file jpg min config ble rac
原文地址:http://www.cnblogs.com/linnuo/p/7262280.html