Hi Folks,

I need to get an instance of DBCPService inside my ScriptedLookupService
and for that I'm following Matt's post
http://funnifi.blogspot.com.br/2016/04/sql-in-nifi-with-executescript.html

In my groovy class I've overrided the initialize method and performing the
lookup there but I'm getting the following error:

*java.lang.UnsupportedOperationException: Cannot obtain Controller Service
Identifiers for service type interface
org.apache.nifi.controller.ControllerService without providing a Process
Group Identifier*


@Override
  void initialize(ControllerServiceInitializationContext context) throws
InitializationException {
    log = context.logger
    /* Get sql-connection */
    def lookup = context.controllerServiceLookup
    def dbcpServiceId =
lookup.getControllerServiceIdentifiers(ControllerService).find {
      cs -> lookup.getControllerServiceName(cs) == 'MySQLConnectionPool'
    }
    conn = lookup.getControllerService(dbcpServiceId)?.getConnection()
    log.info("sql conn {}", conn)
  }

Is there other way to find service identifiers?

Regards,

Reply via email to