0

我正在尝试将 removeAbandoned 属性添加到运行 Tomcat 5.5 的环境中的资源中。在添加此属性之前,在此环境中运行的 servlet 可以正常工作。一旦我添加了属性,就会引发如下异常:

异常 javax.naming.NamingException:找不到属性的设置方法:removeAbandoned。

我不明白为什么会这样。一旦我删除该属性,servlet 就会再次工作。

下面是在我的环境中出现的整个 Context 标记:

<Context path="/emscribe" docBase="emscribe" debug="0" reloadable="true"  
crossContext="true"> 

 <Logger className="org.apache.catalina.logger.FileLogger" prefix="emscribe_log." 
 suffix=".txt" timestamp="true"/> 

 <Resource name="jdbc/emscribe" auth="Container" 
 type="com.mchange.v2.c3p0.ComboPooledDataSource" driverClass="com.mysql.jdbc.Driver"  
  maxPoolSize="100"  minPoolSize="5"   

 acquireIncrement="5"  removeAbandoned="true"
  user="aUserID"  

 password="aPassword"

 factory="org.apache.naming.factory.BeanFactory"   

  jdbcUrl="jdbc:mysql://127.000.71.101/emscribedx?autoReconnect=true" 
 /> 
4

2 回答 2

2

你的例外:

javax.naming.NamingException: No set method found for property: removeAbandoned.

声明它找不到方法getRemoveAbandoned()setRemoveAbandoned(boolean removeAbandoned)资源中指定的类型。

removeAdandoned属性只能与 Apache DBCP BasicDataSource一起使用。

So, your resource jdbc/emscribe type must not be com.mchange.v2.c3p0.ComboPooledDataSource but rather org.apache.commons.dbcp.BasicDataSource.

Hope this helps.

于 2013-01-23T19:28:57.907 回答
0

removeAdandoned would not work with cp30 connection pooling. Its for DBCP on older tomcat versions or apache connection pooling introduced in tomcat 7

于 2013-01-23T20:02:48.163 回答