spring+quartz+ibatis 运行一段时间就无不保存数据。。求助!!急!!

jjoott 2011-04-08 10:26:37
我用quartz每分钟保存一条数据 这样运行半个小时就无法再像数据库里插入数据了
我有了c3po,我感觉ibatis在插入数据后没有释放连接(ibatis 自动提交,关闭)


debug = true
c3p0.acquireIncrement = 3
c3p0.idleConnectionTestPeriod = 60
c3p0.initialPoolSize = 3
c3p0.maxIdleTime = 40
c3p0.maxPoolSize = 50
c3p0.maxStatements = 200
c3p0.minPoolSize = 2
c3p0.numHelperThreads = 10


quartz配置

<bean id="monitorScheduler" class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
<property name="dataSource" ref="dataSource"/>
<property name="applicationContextSchedulerContextKey" value="applicationContextKey"></property>
<property name="configLocation" value="classpath:scheduler.properties"></property>
</bean>

<bean id="tomcatMonitor" class="com.rm.scheduler.monitor.TomcatMonitor"></bean>
<bean id="tomcat" class="org.springframework.scheduling.quartz.JobDetailBean">
<property name="jobClass">
<value>com.rm.scheduler.job.TomcatMonitorJob</value>
</property>
<property name="jobDataAsMap">
<map>
<entry key="tomcatMonitor">
<ref bean="tomcatMonitor"/>
</entry>
</map>
</property>
</bean>

<bean id="schedulerService" class="com.rm.scheduler.service.SchedulerServiceImp">
<property name="scheduler" ref="monitorScheduler"></property>
<property name="jobDetailMap">
<map>
<entry key="tomcat"><ref bean="tomcat"/></entry>
</map>
</property>
</bean>


web.xml

<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>
<listener>
<listener-class>
org.springframework.web.util.IntrospectorCleanupListener
</listener-class>
</listener>

还出现过一次内存溢出的问题
...全文
222 5 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
jjoott 2011-04-09
  • 打赏
  • 举报
回复
这问题可能出在哪啊?
xiaotugege 2011-04-09
  • 打赏
  • 举报
回复
你肯定摸了小鸡鸡。不然不会这样。。。
哈哈 开玩笑。
检查你自己的程序吧。配置肯定是没问题的。因为能运行就不能说明定时器有问题啊。。
jjoott 2011-04-08
  • 打赏
  • 举报
回复
这样写有问题吗?
jjoott 2011-04-08
  • 打赏
  • 举报
回复
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:jdbc="http://www.springframework.org/schema/jdbc"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc-3.0.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd">

<context:property-placeholder location="classpath:init.properties"/>
<!-- <bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName" value="${datasource.driverClass}"/>
<property name="url" value="${datasource.url}"/>
<property name="username" value="${datasource.username}"/>
<property name="password" value="${datasource.password}"/>
</bean>
-->
<bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource">
<property name="driverClass" value="${datasource.driverClass}"></property>
<property name="jdbcUrl" value="${datasource.url}"></property>
<property name="user" value="${datasource.username}"></property>
<property name="password" value="${datasource.password}"></property>
<property name="acquireIncrement" value="${c3p0.acquireIncrement}"></property>
<property name="minPoolSize" value="${c3p0.minPoolSize}"></property>
<property name="maxPoolSize" value="${c3p0.maxPoolSize}"></property>
<property name="maxIdleTime" value="${c3p0.maxIdleTime}"></property>
<property name="idleConnectionTestPeriod" value="${c3p0.idleConnectionTestPeriod}"></property>
<property name="maxStatements" value="${c3p0.maxStatements}"></property>
<property name="numHelperThreads" value="${c3p0.numHelperThreads}"></property>
</bean>

<bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="dataSource"/>
</bean>


<tx:advice id="wdTxAdvice" transaction-manager="transactionManager">
<tx:attributes>
<tx:method name="*" rollback-for="PROPAGATION_REQUIRED,-Exception" />
</tx:attributes>
</tx:advice>
<aop:config proxy-target-class="true">
</aop:config>

<tx:annotation-driven transaction-manager="transactionManager" />

<bean id="sqlMapClient" class="org.springframework.orm.ibatis.SqlMapClientFactoryBean">
<property name="configLocation" value="classpath:SqlMapClient.xml"/>
<property name="dataSource" ref="dataSource"/>
</bean>
</beans>
  • 打赏
  • 举报
回复
怎么把dataSource注入过来了,不知道你的事务管理怎么实现的,你好好检查下吧。

67,549

社区成员

发帖
与我相关
我的任务
社区描述
J2EE只是Java企业应用。我们需要一个跨J2SE/WEB/EJB的微容器,保护我们的业务核心组件(中间件),以延续它的生命力,而不是依赖J2SE/J2EE版本。
社区管理员
  • Java EE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧