nifi-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Eric Chaves <>
Subject DBCP Error Cannot get a connection, pool error Timeout waiting for idle object
Date Thu, 16 Nov 2017 15:49:38 GMT
Hi guys,

I've made a lot of changes on my script processor and now I'm properly
getting an instance of DBCPService however when I try to use the connection
I got the error org.apache.commons.dbcp.SQLNestedException: Cannot get a
connection, pool error Timeout waiting for idle object.

I know the connection is ok because the upstream processor  uses the same
DBCP instance to access the same database.

the code I'm using on my InvokeScriptedProcessor is:

  void onTrigger(ProcessContext context, ProcessSessionFactory
sessionFactory) throws ProcessException {
    def session = sessionFactory.createSession()
      def flowFile = session.get()
      if(!flowFile) return
      def properties = context.getProperties()"Properties {}", properties)
      def String lookupKey =
context.getProperty(LOOKUP_FIELD)?.evaluateAttributeExpressions()?.getValue()'Lookup key {}', lookupKey)
      def dbcpService =
      def Integer queryTimeout =
      def con = dbcpService.getConnection()
      def st = con.createStatement()
      def selectQuery = "select * from PERSONS where id=${lookupKey}""Executing query {}", selectQuery)
      boolean results = st.execute(selectQuery)"Results {}-{}", lookupKey, results)
      session.transfer(flowFile, REL_SUCCESS)
    } catch (final Throwable t) {
      log.error('{} failed to process due to {}', [this, t] as Object[])
      throw t

Any hints?

View raw message