title: java.lang.AbstractMethodError: at org.apache.tomcat.dbcp.dbcp.DelegatingPreparedStatement.setCharacterStream(DelegatingPreparedStatement.java:328)
body: <p>I have a very pesky problem and i can't seem to find the answer anywhere.</p>
  
  <p>My application throws this exception when trying to persist a @Lob:</p>
  
  <pre><code>java.lang.AbstractMethodError
   at org.apache.tomcat.dbcp.dbcp.DelegatingPreparedStatement.setCharacterStream(DelegatingPreparedStatement.java:328)
   at org.apache.tomcat.dbcp.dbcp.DelegatingPreparedStatement.setCharacterStream(DelegatingPreparedStatement.java:328)
   at java.lang.reflect.Method.invoke(Method.java:601)
   at org.hibernate.engine.jdbc.internal.proxy.AbstractStatementProxyHandler.continueInvocation(AbstractStatementProxyHandler.java:122)
   at org.hibernate.engine.jdbc.internal.proxy.AbstractProxyHandler.invoke(AbstractProxyHandler.java:81)
   at $Proxy32.setCharacterStream(Unknown Source)
   at org.hibernate.type.descriptor.sql.ClobTypeDescriptor$3$1.doBind(ClobTypeDescriptor.java:83)
   at org.hibernate.type.descriptor.sql.BasicBinder.bind(BasicBinder.java:92)
   at org.hibernate.type.AbstractStandardBasicType.nullSafeSet(AbstractStandardBasicType.java:280)
   at org.hibernate.type.AbstractStandardBasicType.nullSafeSet(AbstractStandardBasicType.java:275)
   at org.hibernate.type.AbstractSingleColumnStandardBasicType.nullSafeSet(AbstractSingleColumnStandardBasicType.java:57)
   at org.hibernate.persister.entity.AbstractEntityPersister.dehydrate(AbstractEntityPersister.java:2747)
   at org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:3152)
   at org.hibernate.persister.entity.AbstractEntityPersister.updateOrInsert(AbstractEntityPersister.java:3087)
   at org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:3416)
   at org.hibernate.action.internal.EntityUpdateAction.execute(EntityUpdateAction.java:140)
   at org.hibernate.engine.spi.ActionQueue.execute(ActionQueue.java:362)
   at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:354)
   at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:276)
   at org.hibernate.event.internal.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:326)
   at org.hibernate.event.internal.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:52)
   at org.hibernate.internal.SessionImpl.flush(SessionImpl.java:1213)
   at org.hibernate.internal.SessionImpl.managedFlush(SessionImpl.java:402)
   at org.hibernate.engine.transaction.internal.jdbc.JdbcTransaction.beforeTransactionCommit(JdbcTransaction.java:101)
   ...(more)
  </code></pre>
  
  <p>I am running on Tomcat 6.0.36(also tried tomcat 7).</p>
  
  <p>MySQL 4.1.22 database.</p>
  
  <p>Code is compiled with jdk 7 and built with gradle.</p>
  
  <p>My dependencies are:</p>
  
  <pre><code>+--- javax.mail:mail:1.4 -&gt; 1.4.1
  |    \--- javax.activation:activation:1.1
  +--- org.slf4j:slf4j-api:1.5.6 -&gt; 1.6.1
  +--- log4j:log4j:1.2.13 -&gt; 1.2.16
  +--- org.apache.wicket:wicket:1.4.15
  |    \--- org.slf4j:slf4j-api:1.5.8 -&gt; 1.6.1
  +--- org.apache.wicket:wicket-extensions:1.4.15
  |    +--- org.apache.wicket:wicket:1.4.15 (*)
  |    \--- org.slf4j:slf4j-api:1.5.8 -&gt; 1.6.1
  +--- mysql:mysql-connector-java:5.1.26
  +--- com.microsoft.sqlserver:sqljdbc4:4.0
  +--- com.itextpdf:itextpdf:5.4.2
  +--- org.hibernate.javax.persistence:hibernate-jpa-2.0-api:1.0.0.Final -&gt; 1.0.1.Final
  +--- org.hibernate:hibernate-core:4.1.9.Final
  |    +--- antlr:antlr:2.7.7
  |    +--- org.jboss.logging:jboss-logging:3.1.0.GA
  |    +--- org.javassist:javassist:3.17.1-GA
  |    +--- org.jboss.spec.javax.transaction:jboss-transaction-api_1.1_spec:1.0.0.Final
  |    +--- dom4j:dom4j:1.6.1
  |    |    \--- xml-apis:xml-apis:1.0.b2
  |    +--- org.hibernate.javax.persistence:hibernate-jpa-2.0-api:1.0.1.Final
  |    \--- org.hibernate.common:hibernate-commons-annotations:4.0.1.Final
  |         \--- org.jboss.logging:jboss-logging:3.1.0.CR2 -&gt; 3.1.0.GA
  +--- org.hibernate:hibernate-entitymanager:4.1.9.Final
  |    +--- org.jboss.logging:jboss-logging:3.1.0.GA
  |    +--- org.javassist:javassist:3.17.1-GA
  |    +--- org.jboss.spec.javax.transaction:jboss-transaction-api_1.1_spec:1.0.0.Final
  |    +--- dom4j:dom4j:1.6.1 (*)
  |    +--- org.hibernate.javax.persistence:hibernate-jpa-2.0-api:1.0.1.Final
  |    +--- org.hibernate:hibernate-core:4.1.9.Final (*)
  |    \--- org.hibernate.common:hibernate-commons-annotations:4.0.1.Final (*)
  +--- foo.bar.data-services:foor-bar-data:2.0.0.275
  |    +--- org.slf4j:slf4j-api:1.6.1
  |    +--- org.hibernate:hibernate-core:4.1.6.Final -&gt; 4.1.9.Final (*)
  |    +--- org.hibernate.javax.persistence:hibernate-jpa-2.0-api::1.0.1.Final -&gt; 1.0.1.Final
  |    +--- org.slf4j:slf4j-log4j12:1.6.1
  |    |    +--- org.slf4j:slf4j-api:1.6.1
  |    |    \--- log4j:log4j:1.2.16
  |    +--- log4j:log4j:1.2.16
  |    \--- commons-configuration:commons-configuration:1.9
  |         +--- commons-lang:commons-lang:2.6
  |         \--- commons-logging:commons-logging:1.1.1
  +--- javax.transaction:jta:1.1
  +--- dom4j:dom4j:1.6.1 (*)
  +--- antlr:antlr:2.7.6 -&gt; 2.7.7
  +--- commons-collections:commons-collections:3.2.1
  +--- commons-configuration:commons-configuration:1.9 (*)
  +--- commons-dbcp:commons-dbcp:1.4
  |    \--- commons-pool:commons-pool:1.5.4 -&gt; 1.5.7
  +--- commons-pool:commons-pool:1.5.7
  +--- commons-logging:commons-logging:1.1.1
  +--- commons-dbutils:commons-dbutils:1.4
  +--- commons-lang:commons-lang:2.6
  +--- commons-io:commons-io:2.4
  +--- org.apache.commons:commons-email:1.2
  |    +--- javax.mail:mail:1.4.1 (*)
  |    \--- javax.activation:activation:1.1
  +--- javax.servlet:servlet-api:2.5
  +--- javax.servlet.jsp:jsp-api:2.1
  \--- org.slf4j:slf4j-log4j12:1.5.6 -&gt; 1.6.1 (*)
  </code></pre>
  
  <p>So looking at the exception, it seems like the application is trying to call the tomcat-dbcp.jar in the CATALINA_BASE/lib folder. But i would expect it to call my commons-dbcp.jar in my classpath.</p>
  
  <p>But frankly i'm at a loss, i tried a lot of things, but can't seem to get this working...
  Thanks in advance for your help. Tell me if you need more information.</p>
  
  <p><strong>EDIT 1:</strong></p>
  
  <p>server.xml</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;Server port="8005" shutdown="SHUTDOWN"&gt;
  
      &lt;Listener SSLEngine="on" className="org.apache.catalina.core.AprLifecycleListener"/&gt;
      &lt;Listener className="org.apache.catalina.core.JasperListener"/&gt;
      &lt;Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener"/&gt;
      &lt;Listener className="org.apache.catalina.mbeans.ServerLifecycleListener"/&gt;
      &lt;Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener"/&gt;
  
      &lt;GlobalNamingResources&gt;
          &lt;Resource auth="Container" description="User database that can be updated and saved" factory="org.apache.catalina.users.MemoryUserDatabaseFactory" name="UserDatabase" pathname="conf/tomcat-users.xml" type="org.apache.catalina.UserDatabase"/&gt;
          &lt;Resource auth="Container" driverClassName="com.mysql.jdbc.Driver" logAbandoned="true" maxActive="100" maxIdle="10" maxWait="10000" name="jdbc/foo" removeAbandoned="true" removeAbandonedTimeout="300" type="javax.sql.DataSource" url="jdbc:mysql://localhost:3306/foo?autoReconnect=true&amp;amp;dumpQueriesOnException=true" username="root" validationQuery="select 1"/&gt;     
          &lt;Resource auth="Container" driverClassName="com.mysql.jdbc.Driver" logAbandoned="true" maxActive="20" maxIdle="5" maxWait="10000" name="jdbc/bar" removeAbandoned="true" removeAbandonedTimeout="300" type="javax.sql.DataSource" url="jdbc:mysql://localhost:3306/bar?autoReconnect=true&amp;amp;dumpQueriesOnException=true" username="root" validationQuery="select 1"/&gt;
      &lt;/GlobalNamingResources&gt;
  
      &lt;Service name="Catalina"&gt;
          &lt;Connector connectionTimeout="20000" port="8080" protocol="HTTP/1.1" redirectPort="8443"/&gt;
          &lt;Connector port="8009" protocol="AJP/1.3" redirectPort="8443"/&gt;
  
          &lt;Engine defaultHost="localhost" name="Catalina"&gt;
              &lt;Realm className="org.apache.catalina.realm.UserDatabaseRealm" resourceName="UserDatabase"/&gt;
              &lt;Host appBase="webapps" autoDeploy="true" name="localhost" unpackWARs="true" xmlNamespaceAware="false" xmlValidation="false"&gt;
              &lt;Context docBase="foo" path="/foo" reloadable="true" source="org.eclipse.jst.j2ee.server:foo"/&gt;&lt;/Host&gt;
          &lt;/Engine&gt;
      &lt;/Service&gt;
  &lt;/Server&gt;
  </code></pre>