当前位置: 代码迷 >> Java Web开发 >> hibernate使用proxool时无法载入proxool.xml的有关问题
  详细解决方案

hibernate使用proxool时无法载入proxool.xml的有关问题

热度:16   发布时间:2016-04-17 15:29:05.0
hibernate使用proxool时无法载入proxool.xml的问题
我刚接触hibernate,问题简单了大家别见笑。我在使用proxool做连接池的时候,发现如果在web.xml中加入以下代码就提示org.hibernate.HibernateException:   Proxool   Provider   unable   to   load   JAXP   configurator   file:   proxool.xml   ,去掉这些代码倒是可以正常运行,是不是这样多此一举啊?

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>


proxool.xml如下:
<?xml   version= "1.0 "   encoding= "ISO-8859-1 "?>
<!--   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://127.0.0.1/crub </driver-url>
                <driver-class> com.mysql.jdbc.Driver </driver-class>
                <driver-properties>
                        <property   name= "user "   value= "test "/>
                        <property   name= "password "   value= "test "/>
                </driver-properties>
                <maximum-connection-count> 30 </maximum-connection-count>
                <house-keeping-test-sql> select   CURRENT_DATE </house-keeping-test-sql>
        </proxool>
</something-else-entirely>


hibernate.cfg.xml   如下:

<?xml   version= '1.0 '   encoding= 'UTF-8 '?>
<!DOCTYPE   hibernate-configuration   PUBLIC
                    "-//Hibernate/Hibernate   Configuration   DTD   3.0//EN "
                    "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd ">

<!--   Generated   by   MyEclipse   Hibernate   Tools.                                       -->
<hibernate-configuration>

<session-factory>
    <property   name= "hibernate.proxool.pool_alias "> DBpool </property>
  相关解决方案