【问题标题】:Override Tomcat connectionTimeout property覆盖 Tomcat connectionTimeout 属性
【发布时间】:2014-06-03 21:41:15
【问题描述】:

是否可以覆盖已存储在 /tomcat/conf/server.xml 中的 Tomcat7 connectionTimeout 属性。我的意思是在我的 application-context.xml 文件中设置一个属性,例如

<bean id="dataSourceC3p0" class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close">
    <property name="driverClass"  value="${jdbc.driverClassName}" />
    <property name="jdbcUrl" value="${jdbc.url}" />
    <property name="user" value="${jdbc.username}" />
    <property name="password" value="${jdbc.password}" />
    <property name="maxPoolSize" value="20" />
    <property name="maxStatements" value="0" />
    <property name="minPoolSize" value="5" />
    <property name="numHelperThreads" value="5"/>
    <property name="connectionTimeout" value="200000"/>
</bean>

虽然,最后一行抛出错误:

org.springframework.beans.NotWritablePropertyException: Invalid property 'connectionTimeout'

当我只评论最后一个属性时,所有其他属性都可以

NotWritablePropertyException 只是告诉我没有其他方法可以正确设置此值?

感谢进阶

【问题讨论】:

  • 如果您正在使用它,您可以在母版页中创建一个方法或其他内容,以便每次触发回发时您都可以增加 timeout 属性并将其分配给静态变量是您想要连接超时还是命令超时..?
  • 我想对存储在 server.xml 中的 ConnectionTimeout 值使用另一个值,这样我就可以为每个应用程序使用不同的值

标签: jsf tomcat


【解决方案1】:

属性名称错误..

看看这个文档: http://www.databaseskill.com/4369778/

 <! - When the connection pool is used when the client calls the getConnection () 
 waiting to acquire a new connection timeout before throwing
 SQLException, if set to 0 wait indefinitely. Milliseconds. Default: 0 ->

 <property name="checkoutTimeout"> 100 </ property>

希望有帮助

【讨论】:

    猜你喜欢
    • 2018-03-12
    • 2021-07-22
    • 1970-01-01
    • 2013-07-19
    • 1970-01-01
    • 1970-01-01
    • 2023-03-12
    • 1970-01-01
    相关资源
    最近更新 更多