Java Tomcat RemoveBandoned属性导致异常
我试图将RemoveBandoned属性添加到运行Tomcat 5.5的环境中的资源中。在添加此属性之前,在此环境中运行的servlet工作正常。添加属性后,将立即引发异常,如下所示: 异常javax.naming.NamingException:未找到属性RemoveBandoned的set方法 我不明白为什么会这样。一旦我删除该属性,servlet就会再次工作 下面是在我的环境中显示的整个上下文标记:Java Tomcat RemoveBandoned属性导致异常,java,tomcat,servlets,configuration,Java,Tomcat,Servlets,Configuration,我试图将RemoveBandoned属性添加到运行Tomcat 5.5的环境中的资源中。在添加此属性之前,在此环境中运行的servlet工作正常。添加属性后,将立即引发异常,如下所示: 异常javax.naming.NamingException:未找到属性RemoveBandoned的set方法 我不明白为什么会这样。一旦我删除该属性,servlet就会再次工作 下面是在我的环境中显示的整个上下文标记: <Context path="/emscribe" docBase="emscrib
<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"
/>
您的例外情况:
javax.naming.NamingException: No set method found for property: removeAbandoned.
声明无法从资源中指定的类型中找到方法getRemoveBandoned()
和setRemoveBandoned(布尔RemoveBandoned)
removeAdandoned
属性只能与Apache一起使用
因此,您的资源jdbc/emscribe
类型不能是com.mchange.v2.c3p0.ComboPooledDataSource
,而是org.apache.commons.dbcp.BasicDataSource
希望这能有所帮助。RemoveAndOned不适用于cp30连接池。它适用于旧tomcat版本上的DBCP或tomcat 7中引入的apache连接池