ERROR - Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean wit
h name 'SessionFactory' defined in ServletContext resource [/WEB-INF/classes/app
licationContext.xml]: Initialization of bean failed; nested exception is org.hib
ernate.HibernateException: Proxool Provider unable to load JAXP configurator fil
e: proxool.xml
org.hibernate.HibernateException: Proxool Provider unable to load JAXP configura
tor file: proxool.xml
        at org.hibernate.connection.ProxoolConnectionProvider.configure(ProxoolC
onnectionProvider.java:125)
        at org.hibernate.connection.ConnectionProviderFactory.newConnectionProvi
der(ConnectionProviderFactory.java:80)
        at org.hibernate.cfg.SettingsFactory.createConnectionProvider(SettingsFa
ctory.java:362)
        at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:
60)
        at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:1463
)
        at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.jav
a:1004)
        at org.springframework.orm.hibernate3.LocalSessionFactoryBean.newSession
Factory(LocalSessionFactoryBean.java:825)
        at org.springframework.orm.hibernate3.LocalSessionFactoryBean.afterPrope
rtiesSet(LocalSessionFactoryBean.java:751)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBean
Factory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1091)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBean
Factory.createBean(AbstractAutowireCapableBeanFactory.java:396)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean
(AbstractBeanFactory.java:233)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean
(AbstractBeanFactory.java:145)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.
preInstantiateSingletons(DefaultListableBeanFactory.java:277)
        at org.springframework.context.support.AbstractApplicationContext.refres
h(AbstractApplicationContext.java:313)
        at org.springframework.web.context.support.AbstractRefreshableWebApplica
tionContext.refresh(AbstractRefreshableWebApplicationContext.java:139)
        at org.springframework.web.context.ContextLoader.createWebApplicationCon
text(ContextLoader.java:252)
        at org.springframework.web.context.ContextLoader.initWebApplicationConte
xt(ContextLoader.java:190)
        at org.springframework.web.context.ContextLoaderServlet.init(ContextLoad
erServlet.java:83)
        at javax.servlet.GenericServlet.init(GenericServlet.java:82)
        at com.caucho.server.http.Application.createServlet(Application.java:311
4)
        at com.caucho.server.http.Application.loadServlet(Application.java:3065)        at com.caucho.server.http.Application.initServlets(Application.java:1923
)
        at com.caucho.server.http.Application.init(Application.java:1849)
        at com.caucho.server.http.VirtualHost.init(VirtualHost.java:728)
        at com.caucho.server.http.ServletServer.initHosts(ServletServer.java:887
)
        at com.caucho.server.http.ServletServer.initInternal(ServletServer.java:
729)
        at com.caucho.server.http.ServletServer.init(ServletServer.java:538)
        at com.caucho.server.http.ResinServer.init(ResinServer.java:415)
        at com.caucho.server.http.ResinServer.main(ResinServer.java:1176)
        at com.caucho.server.http.HttpServer.main(HttpServer.java:103)
Caused by: org.logicalcobwebs.proxool.ProxoolException: Parsing failed.
        at org.logicalcobwebs.proxool.configuration.JAXPConfigurator.configure(J
AXPConfigurator.java:91)
        at org.logicalcobwebs.proxool.configuration.JAXPConfigurator.configure(J
AXPConfigurator.java:107)
        at org.hibernate.connection.ProxoolConnectionProvider.configure(ProxoolC
onnectionProvider.java:120)
        ... 29 more
Caused by: org.xml.sax.SAXException: You must define the driver-class and the dr
iver-url.
        at org.logicalcobwebs.proxool.configuration.XMLConfigurator.endElement(X
MLConfigurator.java:176)
        at com.caucho.xml.XmlParser.popNode(XmlParser.java:883)
        at com.caucho.xml.XmlParser.closeTag(XmlParser.java:784)
        at com.caucho.xml.XmlParser.parseNode(XmlParser.java:357)
        at com.caucho.xml.XmlParser.parseInt(XmlParser.java:246)
        at com.caucho.xml.AbstractParser.parse(AbstractParser.java:615)
        at javax.xml.parsers.SAXParser.parse(SAXParser.java:345)
        at org.logicalcobwebs.proxool.configuration.JAXPConfigurator.configure(J
AXPConfigurator.java:87)
        ... 31 moreproxool.xml 和applicationContext.xml都放在classpath下
如果用datasource 那种就可以正确链接数据库

解决方案 »

  1.   

    proxool.xml配置如下
    <?xml version="1.0" encoding="UTF-8"?>
    <something-else-entirely>
      <proxool>
        <alias>DBPool</alias>
        <driver-url>jdbc:inetdae7:localhost:1433?database=motherol&amp;charset=GBK</driver-url>
        <driver-class>com.inet.tds.TdsDriver</driver-class>
        <driver-properties>
          <property name="user" value="sa"></property>
          <property name="password" value="sa"></property>
        </driver-properties>
        <maximum-connection-count>100</maximum-connection-count>
        <minimum-connection-count>20</minimum-connection-count>
        <prototype-count>5</prototype-count>
        <house-keeping-sleep-time>50000</house-keeping-sleep-time>
        <maximum-active-time>300000</maximum-active-time> 
        <maximum-connection-lifetime>3600000</maximum-connection-lifetime>
    <simultaneous-build-throttle>5</simultaneous-build-throttle>
        <verbose>true</verbose>   
        <trace>true</trace> 
        <house-keeping-test-sql>select getdate()</house-keeping-test-sql>
      </proxool>
    </something-else-entirely>applicationContext.xml配置如下
    <bean id="SessionFactory"
    class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
    <!-- <property name="dataSource">
    <ref bean="dataSourse" />
    </property>
    -->
    <property name="hibernateProperties">
    <props>
    <prop key="hibernate.dialect">
    org.hibernate.dialect.SQLServerDialect
    </prop>
    <prop key="hibernate.show_sql">true</prop>

    <!-- <prop key="hibernate.proxool.existing_pool">true</prop> -->

    <prop key="hibernate.cglib.use_reflection_optimizer">
    true
    </prop>
    <prop key="hibernate.connection.provider_class">
    org.hibernate.connection.ProxoolConnectionProvider
    </prop>
    <prop key="hibernate.proxool.xml">proxool.xml</prop>
    <prop key="hibernate.proxool.pool_alias">DBPool</prop>

    <!-- 缓存设置默认是EhCache -->
    <prop key="hibernate.cache.provider_class">
    org.hibernate.cache.EhCacheProvider
    </prop>
    <!-- enable the query cache -->
    <prop key="hibernate.cache.use_query_cache">true</prop> <!-- store the second-level cache entries in a more human-friendly format -->
    <prop key="hibernate.cache.use_structured_entries">
    true
    </prop>
    </props>
    </property>
    <property name="mappingResources">
    <list>
    <value>admin/model/Admin.hbm.xml</value>
                                    。。
      

  2.   

    驱动com.inet.tds.TdsDriver  和 com.microsoft.jdbc.sqlserver.SQLServerDriver 都测试过了是一样的错
    如果<prop key="hibernate.proxool.existing_pool">true </prop> 则就出现没有适当的驱动问题?