sunyhaha 2010-01-21 19:00
浏览 195
已采纳

spring+struts2+hibernate 中如何用proxool配置连接池

自己在网上找了些spring配置proxool的例子,但都没有成功,不知道问题到底出在哪里!

applicationcontext.xml



proxool


oracle.jdbc.driver.OracleDriver


jdbc:oracle:thin:user/password@localhost:1521:myServer

    <property name="user"> 
      <value>tset</value>
    </property>
    <property name="password"> 
      <value>test</value>
    </property>

    <property name="houseKeepingSleepTime">
      <value>90000</value>
    </property>
    <property name="prototypeCount">
      <value>5</value>
    </property>
    <property name="maximumConnectionCount">
      <value>100</value>
    </property>
    <property name="minimumConnectionCount">
      <value>10</value>
    </property>
    <property name="trace">
      <value>true</value>
    </property>
    <property name="verbose">
      <value>true</value>
    </property>
</bean>

<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
    <property name="dataSource">
        <ref bean="dataSource"/>
    </property>
    <property name="hibernateProperties">
        <props>
            <prop key="hibernate.dialect">
                org.hibernate.dialect.Oracle9Dialect
            </prop>
        </props>
    </property>
    <property name="mappingResources">
        <list>
            <value>com/pojo/ServerInfo.hbm.xml</value>
            <value>com/pojo/MPermissionsMappingInfo.hbm.xml</value>
        </list>
    </property>
</bean>


<bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
    <property name="sessionFactory" ref="sessionFactory"/>
</bean>



<bean id="transactionInterceptor" class="org.springframework.transaction.interceptor.TransactionInterceptor">

    <property name="transactionManager" ref="transactionManager"/>  

    <property name="transactionAttributes">
        <props>
            <prop key="*">PROPAGATION_REQUIRED</prop>
        </props> 
    </property>



</bean>


<bean class="org.springframework.aop.framework.autoproxy.BeanNameAutoProxyCreator">

    <property name="beanNames">

        <list>
            <value>*Service</value>
        </list>

    </property>

    <property name="interceptorNames">
        <list>
            <value>transactionInterceptor</value>

        </list>
    </property>
</bean>

proxool.xml

<?xml version="1.0" encoding="UTF-8"?>


proxool
jdbc:oracle:thin:@localhost:1521:myServer
oracle.jdbc.driver.OracleDriver




10
select 1 from dual


web.xml

<filter>
  <filter-name>struts2</filter-name>
  <filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
</filter>
<filter-mapping>
  <filter-name>struts2</filter-name>
  <url-pattern>/*</url-pattern>
</filter-mapping>


<listener>
  <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>

<context-param> 
    <param-name>contextConfigLocation </param-name> 
    <param-value>/WEB-INF/classes/applicationContext.xml</param-value> 
</context-param>

<servlet>
<servlet-name>proxoolServletConfigurator</servlet-name>
<servlet-class>org.logicalcobwebs.proxool.configuration.ServletConfigurator</servlet-class>
<init-param>
  <param-name>xmlFile</param-name>
  <param-value>WEB-INF/proxool.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>



proxooladmin
org.logicalcobwebs.proxool.admin.servlet.AdminServlet


proxooladmin
/proxooladmin


按照以上配置文件设置后运行在tomcat中有如下错误:

严重: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'datasource' defined in ServletContext resource [/WEB-INF/classes/applicationContext.xml]: Instantiation of bean failed; nested exception is java.lang.AbstractMethodError: org.springframework.aop.framework.autoproxy.BeanNameAutoProxyCreator.determineConstructor(Ljava/lang/Class;Ljava/lang/String;)Ljava/lang/reflect/Constructor;
Caused by: java.lang.AbstractMethodError: org.springframework.aop.framework.autoproxy.BeanNameAutoProxyCreator.determineConstructor(Ljava/lang/Class;Ljava/lang/String;)Ljava/lang/reflect/Constructor;
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.determineConstructorFromBeanPostProcessors(AbstractAutowireCapableBeanFactory.java:743)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:716)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:387)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:251)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:156)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:248)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:160)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:287)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:352)
at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:244)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:187)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:49)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3934)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4429)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:526)
at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:987)
at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:909)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:495)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1206)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:314)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:722)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
at org.apache.catalina.core.StandardService.start(StandardService.java:516)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
at org.apache.catalina.startup.Catalina.start(Catalina.java:583)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
2010-1-21 17:42:31 org.apache.catalina.core.StandardContext start
严重: Error listenerStart

先谢过!

  • 写回答

4条回答 默认 最新

  • hefeidaxia 2010-01-22 10:37
    关注

    你先查看一下你的lib文件夹下,看看是否有重名的包,我以前做项目的时候出过这问题,好像是asm包的冲突,记不清楚了,你那面应该有两个,一个是asm.jar 另一个是 asm**.jar删除一个,留一个新的就行了,看到重复的包就删除了吧。没处理过这问题的永远都是在那里乱猜,你遇到这样的问题也当学习知识了吧,跟以后打基础,注意积累和总结,记不住的就写在博客上也行。

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(3条)

报告相同问题?

悬赏问题

  • ¥20 关于线性结构的问题:希望能从头到尾完整地帮我改一下,困扰我很久了
  • ¥20 设计一个二极管稳压值检测电路
  • ¥15 内网办公电脑进行向日葵
  • ¥15 如何输入双曲线的参数a然后画出双曲线?我输入处理函数加上后就没有用了,不知道怎么回事去掉后双曲线可以画出来
  • ¥50 WPF Lidgren.Network.Core2连接问题
  • ¥15 soildworks装配体的尺寸问题
  • ¥100 有偿寻云闪付SDK转URL技术
  • ¥30 基于信创PC发布的QT应用如何跨用户启动后输入中文
  • ¥20 非root手机,如何精准控制手机流量消耗的大小,如20M
  • ¥15 远程安装一下vasp