Tomcat removeAbandoned属性导致异常

时间:2013-01-23 19:14:44

标签: java tomcat servlets configuration

我正在尝试将removeAbandoned属性添加到运行Tomcat 5.5的环境中的资源。在添加此属性之前,在此环境中运行的servlet工作正常。只要我添加属性,就会抛出异常,如下所示:

EXCEPTION javax.naming.NamingException:找不到属性的set方法: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" 
 /> 

1 个答案:

答案 0 :(得分:2)

您的例外:

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

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

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

因此,您的资源jdbc/emscribe类型不能是com.mchange.v2.c3p0.ComboPooledDataSource,而是org.apache.commons.dbcp.BasicDataSource

希望这有帮助。

相关问题