<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>question Re: Controller Service is disabled in Archives of Support Questions (Read Only)</title>
    <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Controller-Service-is-disabled/m-p/233335#M70323</link>
    <description>&lt;P&gt;Thanks &lt;A rel="user" href="https://community.cloudera.com/users/18929/yaswanthmuppireddy.html" nodeid="18929" target="_blank"&gt;@Shu&lt;/A&gt;&lt;/P&gt;&lt;P&gt;I tried your suggestion  as below&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="41540-3.png" style="width: 761px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/14751i216AFA236E9A5341/image-size/medium?v=v2&amp;amp;px=400" role="button" title="41540-3.png" alt="41540-3.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;. However, I still get my connection disconnected... and I can't see in the log that "select CURRENT_TIMESTAMP()" is being executed ? is this normal ?&lt;/P&gt;&lt;P&gt;Also I dunno why the ConnectionPool is not showing that ExecuteScript is refering to it ? see below&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="41541-4.png" style="width: 756px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/14752i9DFF546430CEF865/image-size/medium?v=v2&amp;amp;px=400" role="button" title="41541-4.png" alt="41541-4.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Thanks a lot...&lt;/P&gt;</description>
    <pubDate>Sun, 18 Aug 2019 00:15:42 GMT</pubDate>
    <dc:creator>yahya_najjar</dc:creator>
    <dc:date>2019-08-18T00:15:42Z</dc:date>
    <item>
      <title>Controller Service is disabled</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Controller-Service-is-disabled/m-p/233333#M70321</link>
      <description>&lt;P&gt;Dear Forum&lt;/P&gt;&lt;P&gt;I have the below Nifi flow to fetch data from mysql table and then load it to another mysql table (data enrichment)&lt;/P&gt;&lt;P&gt;I used executescript processor to connect to DB and manipulate the data as below (image 1.png)&lt;/P&gt;&lt;P&gt;this is my code&lt;/P&gt;&lt;PRE&gt;import org.apache.nifi.controller.ControllerService
import groovy.sql.Sql
def lookup = context.controllerServiceLookup
def dbServiceName = databaseConnectionPoolName.value
def dbcpServiceId = lookup.getControllerServiceIdentifiers(ControllerService).find { 
    cs -&amp;gt; lookup.getControllerServiceName(cs) == dbServiceName
}
def conn = lookup.getControllerService(dbcpServiceId).getConnection()
def sql = new Sql(conn)
def sqlInsert = new Sql(conn)
try {
    flowFile = session.get()
    if(!flowFile) return
    //log.error("ExecuteScript: Line records Exception: " + dbServiceName )
    flowFile = session.write(flowFile, {inputStream, outputStream -&amp;gt; 
            inputStream.eachLine { line -&amp;gt;
                def String[] lineCellArr = ["", "", "", "", "", "", ""]
                def sqlSelectArr = ""
                if (line != null){
                    //log.error("ExecuteScript: Line records Exception: " + dbServiceName )
                    lineArr = line.split("\,", -1)
                    for(int i = 0; i &amp;lt; lineArr.length ; i++) {
                        lineCellArr[i] = lineArr[i];
                    }
                    sql.rows("SELECT * FROM Polygon.cells where cellId='" + lineCellArr[6] +"'").eachWithIndex { row, idx -&amp;gt;
                        sqlSelectArr = row.values().join(';').split("\;", -1)
                        outputStream.write((line.toString() + row.values().join(';') + ";" + sqlSelectArr[1]).getBytes())
                        def insertResult1 = sqlInsert.executeUpdate("INSERT IGNORE INTO Polygon.recharges (rechargeNumber, rechargeTime, serviceClass, rechargeValue, rechargeType, balanceAfter, rechargeLocation, towerName) VALUES ('" + lineCellArr[0] + "','" + lineCellArr[1] + "','"+ lineCellArr[2] + "','"+ lineCellArr[3] + "','"+ lineCellArr[4] + "','"+ lineCellArr[5] + "','"+ lineCellArr[6] + "','"+ sqlSelectArr[1] + "')")
                        def insertResult2 = sqlInsert.executeUpdate("INSERT INTO Polygon.rechargesSummary (rechargeDate, serviceClass, rechargeValue, rechargeCount, rechargeType, rechargeLocation, towerName, latitude , longitude, region, subRegion) VALUES ('" + lineCellArr[1] + "','"+ lineCellArr[2] + "','"+ lineCellArr[3] + "','1','"+ lineCellArr[4] + "','"+ lineCellArr[6] + "','" + sqlSelectArr[1] + "','"+ sqlSelectArr[2] + "','"+ sqlSelectArr[3] + "','"+ sqlSelectArr[4] + "','"+ sqlSelectArr[5] + "') on DUPLICATE KEY UPDATE rechargeValue = rechargeValue + '"+ lineCellArr[3] +"', rechargeCount = rechargeCount + 1")
                        //write results
                        outputStream.write((";" + insertResult1.toString() +insertResult2.toString() + " \n").getBytes())
                    }
                    attrMap = ['Type': "Vouchers", 'Company': "Zain"]
                }
            }
        } as StreamCallback)
    flowFile = session.putAllAttributes(flowFile, attrMap)
    session.transfer(flowFile, REL_SUCCESS)
} catch(e) {
    log.error('Scripting error', e)
    session.transfer(flowFile, REL_FAILURE)
}
conn.close()&lt;/PRE&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="41530-1.png" style="width: 795px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/14754i6300A4080E76373C/image-size/medium?v=v2&amp;amp;px=400" role="button" title="41530-1.png" alt="41530-1.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Everything works fine, but after couple of hours I start getting the below error&lt;/P&gt;&lt;PRE&gt;Caused by: javax.script.ScriptException: javax.script.ScriptException: java.lang.IllegalStateException: Cannot invoke method public abstract java.sql.Connection org.apache.nifi.dbcp.DBCPService.getConnection() throws org.apache.nifi.processor.exception.ProcessException on Controller Service with identifier 7e50134b-1000-115f-d673-ccc9fbd344fe because the Controller Service is disabled
        at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:159)
        at javax.script.AbstractScriptEngine.eval(AbstractScriptEngine.java:264)
        at org.apache.nifi.script.impl.GroovyScriptEngineConfigurator.eval(GroovyScriptEngineConfigurator.java:54)
        at org.apache.nifi.processors.script.ExecuteScript.onTrigger(ExecuteScript.java:220)
        ... 11 common frames omitted
Caused by: javax.script.ScriptException: java.lang.IllegalStateException: Cannot invoke method public abstract java.sql.Connection org.apache.nifi.dbcp.DBCPService.getConnection() throws org.apache.nifi.processor.exception.ProcessException on Controller Service with identifier 7e50134b-1000-115f-d673-ccc9fbd344fe because the Controller Service is disabled
        at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:355)
        at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:153)
        ... 14 common frames omitted
Caused by: java.lang.IllegalStateException: Cannot invoke method public abstract java.sql.Connection org.apache.nifi.dbcp.DBCPService.getConnection() throws org.apache.nifi.processor.exception.ProcessException on Controller Service with identifier 7e50134b-1000-115f-d673-ccc9fbd344fe because the Controller Service is disabled
        at org.apache.nifi.controller.service.StandardControllerServiceInvocationHandler.invoke(StandardControllerServiceInvocationHandler.java:84)
        at com.sun.proxy.$Proxy77.getConnection(Unknown Source)
        at org.apache.nifi.dbcp.DBCPService$getConnection.call(Unknown Source)
        at Script4.run(Script4.groovy:19)
        at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:352)
        ... 15 common frames omitted
2017-10-26 09:55:16,873 ERROR [Timer-Driven Process Thread-12] o.a.nifi.processors.script.ExecuteScript ExecuteScript[id=7e50130c-1000-115f-dab6-0ef65aa69de2] Failed to process session due to org.apache.nifi.processor.exception.ProcessException: javax.script.ScriptException: javax.script.ScriptException: java.lang.IllegalStateException: Cannot invoke method public abstract java.sql.Connection org.apache.nifi.dbcp.DBCPService.getConnection() throws org.apache.nifi.processor.exception.ProcessException on Controller Service with identifier 7e50134b-1000-115f-d673-ccc9fbd344fe because the Controller Service is disabled: {}
org.apache.nifi.processor.exception.ProcessException: javax.script.ScriptException: javax.script.ScriptException: java.lang.IllegalStateException: Cannot invoke method public abstract java.sql.Connection org.apache.nifi.dbcp.DBCPService.getConnection() throws org.apache.nifi.processor.exception.ProcessException on Controller Service with identifier 7e50134b-1000-115f-d673-ccc9fbd344fe because the Controller Service is disabled
        at org.apache.nifi.processors.script.ExecuteScript.onTrigger(ExecuteScript.java:230)
        at org.apache.nifi.controller.StandardProcessorNode.onTrigger(StandardProcessorNode.java:1119)
        at org.apache.nifi.controller.tasks.ContinuallyRunProcessorTask.call(ContinuallyRunProcessorTask.java:147)
        at org.apache.nifi.controller.tasks.ContinuallyRunProcessorTask.call(ContinuallyRunProcessorTask.java:47)
        at org.apache.nifi.controller.scheduling.TimerDrivenSchedulingAgent$1.run(TimerDrivenSchedulingAgent.java:128)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
        at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180)
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at java.lang.Thread.run(Thread.java:748)&lt;/PRE&gt;&lt;P&gt;When I restart the connectionpool, everything works fine for couple of hours till I get this error again,&lt;/P&gt;&lt;P&gt;could you please advise&lt;/P&gt;&lt;P&gt;Thanks a lot&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="41532-2.png" style="width: 758px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/14755i851F4399ABB1E8B5/image-size/medium?v=v2&amp;amp;px=400" role="button" title="41532-2.png" alt="41532-2.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 18 Aug 2019 00:16:03 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Controller-Service-is-disabled/m-p/233333#M70321</guid>
      <dc:creator>yahya_najjar</dc:creator>
      <dc:date>2019-08-18T00:16:03Z</dc:date>
    </item>
    <item>
      <title>Re: Controller Service is disabled</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Controller-Service-is-disabled/m-p/233334#M70322</link>
      <description>&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/14290/yahya-najjar.html" nodeid="14290" target="_blank"&gt;@Yahya Najjar&lt;/A&gt;
&lt;/P&gt;&lt;P&gt;Can you add &lt;STRONG&gt;validation query&lt;/STRONG&gt; in connection pool, as this &lt;STRONG&gt;Validation query used to validate connections before returning them. &lt;/STRONG&gt;When&lt;STRONG&gt; connection is invalid, it get's dropped and new valid connection will be returned. &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Query:&lt;/STRONG&gt;&lt;/P&gt;&lt;PRE&gt;select CURRENT_TIMESTAMP()&lt;/PRE&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="41539-connectionpool.png" style="width: 767px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/14753iAEC5AFEEC573E86E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="41539-connectionpool.png" alt="41539-connectionpool.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;This &lt;STRONG&gt;validation query&lt;/STRONG&gt; will &lt;STRONG&gt;take care of invalid connections&lt;/STRONG&gt; and &lt;STRONG&gt;drops invalid&lt;/STRONG&gt; connections and &lt;STRONG&gt;re enables connections&lt;/STRONG&gt;,&lt;/P&gt;&lt;P&gt;Validation Query helps you to &lt;STRONG&gt;maintain&lt;/STRONG&gt; connection pools never get disabled.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Note:- &lt;/STRONG&gt;Using validation might have some performance penalty.&lt;/P&gt;</description>
      <pubDate>Sun, 18 Aug 2019 00:15:49 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Controller-Service-is-disabled/m-p/233334#M70322</guid>
      <dc:creator>Shu_ashu</dc:creator>
      <dc:date>2019-08-18T00:15:49Z</dc:date>
    </item>
    <item>
      <title>Re: Controller Service is disabled</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Controller-Service-is-disabled/m-p/233335#M70323</link>
      <description>&lt;P&gt;Thanks &lt;A rel="user" href="https://community.cloudera.com/users/18929/yaswanthmuppireddy.html" nodeid="18929" target="_blank"&gt;@Shu&lt;/A&gt;&lt;/P&gt;&lt;P&gt;I tried your suggestion  as below&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="41540-3.png" style="width: 761px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/14751i216AFA236E9A5341/image-size/medium?v=v2&amp;amp;px=400" role="button" title="41540-3.png" alt="41540-3.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;. However, I still get my connection disconnected... and I can't see in the log that "select CURRENT_TIMESTAMP()" is being executed ? is this normal ?&lt;/P&gt;&lt;P&gt;Also I dunno why the ConnectionPool is not showing that ExecuteScript is refering to it ? see below&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="41541-4.png" style="width: 756px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/14752i9DFF546430CEF865/image-size/medium?v=v2&amp;amp;px=400" role="button" title="41541-4.png" alt="41541-4.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Thanks a lot...&lt;/P&gt;</description>
      <pubDate>Sun, 18 Aug 2019 00:15:42 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Controller-Service-is-disabled/m-p/233335#M70323</guid>
      <dc:creator>yahya_najjar</dc:creator>
      <dc:date>2019-08-18T00:15:42Z</dc:date>
    </item>
    <item>
      <title>Re: Controller Service is disabled</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Controller-Service-is-disabled/m-p/233336#M70324</link>
      <description>&lt;P&gt;Thanks @Shu, please check below&lt;/P&gt;</description>
      <pubDate>Thu, 26 Oct 2017 20:33:38 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Controller-Service-is-disabled/m-p/233336#M70324</guid>
      <dc:creator>yahya_najjar</dc:creator>
      <dc:date>2017-10-26T20:33:38Z</dc:date>
    </item>
    <item>
      <title>Re: Controller Service is disabled</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Controller-Service-is-disabled/m-p/233337#M70325</link>
      <description>&lt;P&gt;"Referencing Components" is done by the framework when you explicitly refer to a Component from another, such as selecting that DBCPConnectionPool from a drop-down list in PutSQL for example. With a scripting processor, the framework does not know what the script is doing, including whether it references a particular component or not.&lt;/P&gt;&lt;P&gt;Also DBCPConnectionPool does not log that it executes the Validation Query, that is performed by Apache DBCP "under the hood" when a connection is requested from the pool.&lt;/P&gt;&lt;P&gt;What is very weird about your situation is that the Controller Service (DBCPConnectionPool) becomes disabled, that should not be related to whether the connection pool gives back good/bad connections. Is there an error bulletin or something in the logs from the DBCPConnectionPool itself or the framework (not the ExecuteScript)?&lt;/P&gt;</description>
      <pubDate>Fri, 27 Oct 2017 00:04:16 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Controller-Service-is-disabled/m-p/233337#M70325</guid>
      <dc:creator>mburgess</dc:creator>
      <dc:date>2017-10-27T00:04:16Z</dc:date>
    </item>
    <item>
      <title>Re: Controller Service is disabled</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Controller-Service-is-disabled/m-p/233338#M70326</link>
      <description>&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/14290/yahya-najjar.html" nodeid="14290"&gt;@Yahya Najjar&lt;/A&gt;,&lt;/P&gt;&lt;P&gt;Can you once make sure you are referring to the correct &lt;STRONG&gt;controller service id&lt;/STRONG&gt; that having &lt;B&gt;validation query &lt;/B&gt;in it.&lt;/P&gt;&lt;P&gt;I think you have added &lt;STRONG&gt;dynamic property&lt;/STRONG&gt; in &lt;STRONG&gt;execute script processor&lt;/STRONG&gt; with &lt;B&gt;controller&lt;/B&gt; &lt;STRONG&gt;service id&lt;/STRONG&gt; in it and you are using the same controller service when you did your fetch and loading.&lt;/P&gt;&lt;P&gt;In your question the controller service id is &lt;STRONG&gt;7e50134b-1000-115f-d673-ccc9fbd344fe but&lt;/STRONG&gt; in the above &lt;STRONG&gt;screenshot &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;controller &lt;STRONG&gt;service id(588fa4bo...etc)&lt;/STRONG&gt; is different. &lt;/P&gt;&lt;P&gt;I think that is the reason why you are having facing issues still..!!&lt;/P&gt;</description>
      <pubDate>Fri, 27 Oct 2017 00:16:13 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Controller-Service-is-disabled/m-p/233338#M70326</guid>
      <dc:creator>Shu_ashu</dc:creator>
      <dc:date>2017-10-27T00:16:13Z</dc:date>
    </item>
    <item>
      <title>Re: Controller Service is disabled</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Controller-Service-is-disabled/m-p/233339#M70327</link>
      <description>&lt;P&gt;Thanks @Shu and @Matt for your answers,&lt;/P&gt;&lt;P&gt;@Shu, the controller service Id is different because I recreated it couple of times before posting the questions and comments &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;What I did is that I moved this part ( flowFile = session.get()
if(!flowFile) return )  before defining the connection, code is working since yesterday but Im not sure if this was the issue !&lt;/P&gt;&lt;P&gt;@Matt, for your question... I was not able to find any other logs, I got this behaviour only on Nifi 1.4, version 1.0 is working fine.&lt;/P&gt;&lt;PRE&gt;import org.apache.nifi.controller.ControllerService
import groovy.sql.Sql
flowFile = session.get()
if(!flowFile) return
def lookup = context.controllerServiceLookup
def dbServiceName = databaseConnectionPoolName.value
def dbcpServiceId = lookup.getControllerServiceIdentifiers(ControllerService).find { 
    cs -&amp;gt; lookup.getControllerServiceName(cs) == dbServiceName
}
def conn = lookup.getControllerService(dbcpServiceId).getConnection()
def sql = new Sql(conn)
def sqlInsert = new Sql(conn) &lt;/PRE&gt;</description>
      <pubDate>Sat, 28 Oct 2017 01:26:26 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Controller-Service-is-disabled/m-p/233339#M70327</guid>
      <dc:creator>yahya_najjar</dc:creator>
      <dc:date>2017-10-28T01:26:26Z</dc:date>
    </item>
    <item>
      <title>Re: Controller Service is disabled</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Controller-Service-is-disabled/m-p/233340#M70328</link>
      <description>&lt;P&gt;One silly question plz.. where can I find the below import source files ? which folder if I need to check the content or add more imports to them ?&lt;/P&gt;&lt;PRE&gt;import org.apache.nifi.controller.ControllerService

import groovy.sql.Sql&lt;/PRE&gt;</description>
      <pubDate>Sun, 29 Oct 2017 02:01:20 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Controller-Service-is-disabled/m-p/233340#M70328</guid>
      <dc:creator>yahya_najjar</dc:creator>
      <dc:date>2017-10-29T02:01:20Z</dc:date>
    </item>
  </channel>
</rss>

