<p>Im getting a error while running sonar-scanner on a (self-hosted) vsts agent. The agent (visual studio team services) is running on a kubernetes cluster (linux).</p>

<p>In VSTS i added the Sonarqube prepare and run analyses (retrieved via the VSTS marketplace). At the run analyses i get the following error:</p>

<pre><code>2018-04-17T13:41:17.7246126Z 13:41:17.718 ERROR: Error during SonarQube Scanner execution
2018-04-17T13:41:17.7257629Z 13:41:17.718 ERROR: Unable to load component class org.sonar.scanner.report.ActiveRulesPublisher
2018-04-17T13:41:17.7289820Z 13:41:17.719 ERROR: Caused by: Unable to load component interface org.sonar.api.batch.rule.ActiveRules
</code></pre>

<p>Full verbose logging of the sonar-scanner:</p>

<pre><code>    2018-04-17T13:40:55.4491103Z Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF8
    2018-04-17T13:40:55.9843800Z INFO: Scanner configuration file: /vsts/agent/_work/_tasks/SonarQubeAnalyze_6d01813a-9589-4b15-8491-8164aeb38055/4.1.1/sonar-scanner/conf/sonar-scanner.properties
    2018-04-17T13:40:55.9872383Z INFO: Project root configuration file: NONE
    2018-04-17T13:40:56.0773880Z 13:40:56.071 INFO: SonarQube Scanner 3.1.0.1141
    2018-04-17T13:40:56.0788506Z 13:40:56.076 INFO: Java 1.8.0_162 Oracle Corporation (64-bit)
    2018-04-17T13:40:56.0805405Z 13:40:56.076 INFO: Linux 4.9.0-5-amd64 amd64
    2018-04-17T13:40:56.4592573Z 13:40:56.458 DEBUG: keyStore is : 
    2018-04-17T13:40:56.4608365Z 13:40:56.459 DEBUG: keyStore type is : jks
    2018-04-17T13:40:56.4620170Z 13:40:56.460 DEBUG: keyStore provider is : 
    2018-04-17T13:40:56.4631954Z 13:40:56.460 DEBUG: init keystore
    2018-04-17T13:40:56.4643759Z 13:40:56.461 DEBUG: init keymanager of type SunX509
    2018-04-17T13:40:56.5660597Z 13:40:56.564 DEBUG: Create: /root/.sonar/cache
    2018-04-17T13:40:56.5696355Z 13:40:56.568 INFO: User cache: /root/.sonar/cache
    2018-04-17T13:40:56.5709625Z 13:40:56.569 DEBUG: Create: /root/.sonar/cache/_tmp
    2018-04-17T13:40:56.5752714Z 13:40:56.574 DEBUG: Extract sonar-scanner-api-batch in temp...
    2018-04-17T13:40:56.5940510Z 13:40:56.592 DEBUG: Get bootstrap index...
    2018-04-17T13:40:56.5952154Z 13:40:56.593 DEBUG: Download: https://&lt;url&gt;/batch/index
    2018-04-17T13:40:56.7993378Z 13:40:56.798 DEBUG: Get bootstrap completed
    2018-04-17T13:40:56.8215666Z 13:40:56.818 DEBUG: Download https://&lt;url&gt;/batch/file?name=sonar-scanner-engine-shaded-6.5.jar to /root/.sonar/cache/_tmp/fileCache5321971657904640201.tmp
    2018-04-17T13:41:02.6399191Z 13:41:02.638 DEBUG: Create isolated classloader...
    2018-04-17T13:41:02.6506592Z 13:41:02.649 DEBUG: Start temp cleaning...
    2018-04-17T13:41:02.6644082Z 13:41:02.663 DEBUG: Temp cleaning done
    2018-04-17T13:41:02.6656506Z 13:41:02.663 DEBUG: Execution getVersion
    2018-04-17T13:41:02.6669835Z 13:41:02.665 INFO: SonarQube server 6.5.0
    2018-04-17T13:41:02.6684967Z 13:41:02.665 INFO: Default locale: "en_US", source code encoding: "UTF-8" (analysis is platform dependent)
    2018-04-17T13:41:02.6701596Z 13:41:02.666 DEBUG: Work directory: /vsts/agent/_work/1/s/.scannerwork
    2018-04-17T13:41:02.6713389Z 13:41:02.667 DEBUG: Execution execute
    2018-04-17T13:41:02.9257781Z 13:41:02.924 DEBUG: Publish global mode
    2018-04-17T13:41:03.0332419Z 13:41:03.032 INFO: Load global settings
    2018-04-17T13:41:03.1301467Z 13:41:03.128 DEBUG: GET 200 https://&lt;url&gt;/api/settings/values.protobuf | time=89ms
    2018-04-17T13:41:03.1423184Z 13:41:03.140 INFO: Load global settings (done) | time=109ms
    2018-04-17T13:41:03.1546880Z 13:41:03.153 INFO: User cache: /root/.sonar/cache
    2018-04-17T13:41:03.3769269Z 13:41:03.375 INFO: Load plugins index
    2018-04-17T13:41:03.3867504Z 13:41:03.385 DEBUG: GET 200 https://&lt;url&gt;/deploy/plugins/index.txt | time=9ms
    2018-04-17T13:41:03.3882935Z 13:41:03.387 INFO: Load plugins index (done) | time=12ms
    2018-04-17T13:41:03.3894980Z 13:41:03.388 DEBUG: Load plugins
    2018-04-17T13:41:03.3919841Z 13:41:03.390 DEBUG: Download plugin sonar-csharp-plugin-5.10.1.1411.jar to /root/.sonar/cache/_tmp/fileCache5198949102678735871.tmp
    2018-04-17T13:41:03.4017607Z 13:41:03.399 DEBUG: GET 200 https://&lt;url&gt;/deploy/plugins/csharp/sonar-csharp-plugin-5.10.1.1411.jar | time=9ms
    2018-04-17T13:41:06.7030760Z 13:41:06.699 DEBUG: Download plugin sonar-python-plugin-1.8.0.1496.jar to /root/.sonar/cache/_tmp/fileCache5837697557641973805.tmp
    2018-04-17T13:41:06.7140570Z 13:41:06.712 DEBUG: GET 200 https://&lt;url&gt;/deploy/plugins/python/sonar-python-plugin-1.8.0.1496.jar | time=11ms
    2018-04-17T13:41:07.7937342Z 13:41:07.792 DEBUG: Download plugin sonar-java-plugin-4.12.0.11033.jar to /root/.sonar/cache/_tmp/fileCache3113521041013245867.tmp
    2018-04-17T13:41:07.8036767Z 13:41:07.802 DEBUG: GET 200 https://&lt;url&gt;/deploy/plugins/java/sonar-java-plugin-4.12.0.11033.jar | time=10ms
    2018-04-17T13:41:09.1704132Z 13:41:09.169 DEBUG: Download plugin sonar-scm-git-plugin-1.2.jar to /root/.sonar/cache/_tmp/fileCache3652847485025121764.tmp
    2018-04-17T13:41:09.1814559Z 13:41:09.179 DEBUG: GET 200 https://&lt;url&gt;/deploy/plugins/scmgit/sonar-scm-git-plugin-1.2.jar | time=10ms
    2018-04-17T13:41:10.1258417Z 13:41:10.124 DEBUG: Download plugin sonar-flex-plugin-2.3.jar to /root/.sonar/cache/_tmp/fileCache1763014158619511232.tmp
    2018-04-17T13:41:10.1434478Z 13:41:10.141 DEBUG: GET 200 https://&lt;url&gt;/deploy/plugins/flex/sonar-flex-plugin-2.3.jar | time=17ms
    2018-04-17T13:41:10.5811390Z 13:41:10.579 DEBUG: Download plugin sonar-xml-plugin-1.4.3.1027.jar to /root/.sonar/cache/_tmp/fileCache4278096937563691973.tmp
    2018-04-17T13:41:10.5931521Z 13:41:10.591 DEBUG: GET 200 https://&lt;url&gt;/deploy/plugins/xml/sonar-xml-plugin-1.4.3.1027.jar | time=12ms
    2018-04-17T13:41:13.0089908Z 13:41:13.006 DEBUG: Download plugin sonar-php-plugin-2.10.0.2087.jar to /root/.sonar/cache/_tmp/fileCache8869518949034818200.tmp
    2018-04-17T13:41:13.0190680Z 13:41:13.017 DEBUG: GET 200 https://&lt;url&gt;/deploy/plugins/php/sonar-php-plugin-2.10.0.2087.jar | time=11ms
    2018-04-17T13:41:13.9587794Z 13:41:13.956 DEBUG: Download plugin sonar-scm-svn-plugin-1.5.0.715.jar to /root/.sonar/cache/_tmp/fileCache8353866177366095107.tmp
    2018-04-17T13:41:13.9686573Z 13:41:13.966 DEBUG: GET 200 https://&lt;url&gt;/deploy/plugins/scmsvn/sonar-scm-svn-plugin-1.5.0.715.jar | time=10ms
    2018-04-17T13:41:15.7441037Z 13:41:15.740 DEBUG: Download plugin sonar-javascript-plugin-3.1.1.5128.jar to /root/.sonar/cache/_tmp/fileCache1134031791761299423.tmp
    2018-04-17T13:41:15.7552087Z 13:41:15.753 DEBUG: GET 200 https://&lt;url&gt;/deploy/plugins/javascript/sonar-javascript-plugin-3.1.1.5128.jar | time=10ms
    2018-04-17T13:41:16.6007888Z 13:41:16.598 DEBUG: Load plugins (done) | time=13210ms
    2018-04-17T13:41:16.6656267Z 13:41:16.664 DEBUG: API compatibility mode is enabled on plugin Git [scmgit] (built with API lower than 5.2)
    2018-04-17T13:41:16.8080245Z 13:41:16.806 DEBUG: API compatibility mode is enabled on plugin SVN [scmsvn] (built with API lower than 5.2)
    2018-04-17T13:41:16.8782356Z 13:41:16.877 DEBUG: Plugins:
    2018-04-17T13:41:16.8803313Z 13:41:16.877 DEBUG:   * C# 5.10.1.1411 (csharp)
    2018-04-17T13:41:16.8814834Z 13:41:16.877 DEBUG:   * SonarPython 1.8.0.1496 (python)
    2018-04-17T13:41:16.8826606Z 13:41:16.878 DEBUG:   * SonarJava 4.12.0.11033 (java)
    2018-04-17T13:41:16.8838164Z 13:41:16.878 DEBUG:   * Git 1.2 (scmgit)
    2018-04-17T13:41:16.8849469Z 13:41:16.878 DEBUG:   * Flex 2.3 (flex)
    2018-04-17T13:41:16.8861132Z 13:41:16.878 DEBUG:   * SonarXML 1.4.3.1027 (xml)
    2018-04-17T13:41:16.8872441Z 13:41:16.878 DEBUG:   * SonarPHP 2.10.0.2087 (php)
    2018-04-17T13:41:16.8884157Z 13:41:16.878 DEBUG:   * SVN 1.5.0.715 (scmsvn)
    2018-04-17T13:41:16.8895519Z 13:41:16.879 DEBUG:   * SonarJS 3.1.1.5128 (javascript)
    2018-04-17T13:41:17.2954878Z 13:41:17.294 INFO: Process project properties
    2018-04-17T13:41:17.3024512Z 13:41:17.301 DEBUG: Process project properties (done) | time=7ms
    2018-04-17T13:41:17.3187780Z 13:41:17.317 INFO: Load project repositories
    2018-04-17T13:41:17.3400387Z 13:41:17.339 DEBUG: GET 200 https://&lt;url&gt;/batch/project.protobuf?key=&lt;key&gt; | time=20ms
    2018-04-17T13:41:17.3772015Z 13:41:17.376 INFO: Load project repositories (done) | time=59ms
    2018-04-17T13:41:17.4391020Z 13:41:17.438 DEBUG: Available languages:
    2018-04-17T13:41:17.4407025Z 13:41:17.438 DEBUG:   * C# =&gt; "cs"
    2018-04-17T13:41:17.4419498Z 13:41:17.439 DEBUG:   * Python =&gt; "py"
    2018-04-17T13:41:17.4431469Z 13:41:17.440 DEBUG:   * Java =&gt; "java"
    2018-04-17T13:41:17.4447051Z 13:41:17.440 DEBUG:   * Flex =&gt; "flex"
    2018-04-17T13:41:17.4459538Z 13:41:17.440 DEBUG:   * XML =&gt; "xml"
    2018-04-17T13:41:17.4471153Z 13:41:17.440 DEBUG:   * PHP =&gt; "php"
    2018-04-17T13:41:17.4483109Z 13:41:17.440 DEBUG:   * JavaScript =&gt; "js"
    2018-04-17T13:41:17.4494550Z 13:41:17.445 INFO: Load quality profiles
    2018-04-17T13:41:17.4667036Z 13:41:17.465 DEBUG: GET 200 https://&lt;url&gt;/api/qualityprofiles/search.protobuf?projectKey=&lt;key&gt; | time=20ms
    2018-04-17T13:41:17.4718216Z 13:41:17.471 INFO: Load quality profiles (done) | time=26ms
    2018-04-17T13:41:17.4787808Z 13:41:17.478 INFO: Load active rules
    2018-04-17T13:41:17.5539598Z 13:41:17.552 DEBUG: GET 200 https://&lt;url&gt;/api/rules/search.protobuf?f=repo,name,severity,lang,internalKey,templateKey,params,actives,createdAt&amp;activation=true&amp;qprofile=AWLTddaUW_zM7o53qFW6&amp;p=1&amp;ps=500 | time=73ms
    2018-04-17T13:41:17.6794770Z 13:41:17.678 INFO: ------------------------------------------------------------------------
    2018-04-17T13:41:17.6808969Z 13:41:17.678 INFO: EXECUTION FAILURE
    2018-04-17T13:41:17.6823237Z 13:41:17.678 INFO: ------------------------------------------------------------------------
    2018-04-17T13:41:17.6838138Z 13:41:17.678 INFO: Total time: 21.735s
    2018-04-17T13:41:17.7207625Z 13:41:17.718 INFO: Final Memory: 8M/109M
    2018-04-17T13:41:17.7229316Z 13:41:17.718 INFO: ------------------------------------------------------------------------
    2018-04-17T13:41:17.7246126Z 13:41:17.718 ERROR: Error during SonarQube Scanner execution
    2018-04-17T13:41:17.7257629Z 13:41:17.718 ERROR: Unable to load component class org.sonar.scanner.report.ActiveRulesPublisher
    2018-04-17T13:41:17.7289820Z 13:41:17.719 ERROR: Caused by: Unable to load component interface org.sonar.api.batch.rule.ActiveRules
    2018-04-17T13:41:17.7301826Z 13:41:17.728 ERROR: 
    2018-04-17T13:41:17.7318487Z 13:41:17.728 ERROR: Re-run SonarQube Scanner using the -X switch to enable full debug logging.
    2018-04-17T13:41:17.7530568Z ##[error]/vsts/agent/_work/_tasks/SonarQubeAnalyze_6d01813a-9589-4b15-8491-8164aeb38055/4.1.1/sonar-scanner/bin/sonar-scanner failed with return code: 1
</code></pre>

<p>The class <code>org.sonar.api.batch.rule.ActiveRules</code> is defined in <code>sonar-plugin-api</code>, so I think the bug is caused by a plugin.</p>

<p>I see you use <code>C# 5.10.1.1411</code>. I found this issue: <a href="https://github.com/SonarSource/sonar-csharp/issues/307" rel="nofollow noreferrer">ActiveRulesPublisher issue for C# 5.10.1</a>. The reporter uses exactly the same version as you (<code>5.10.1.1411</code>). Steps which should solve your problem:</p>

<ul>
<li>stop the SonarQube server</li>
<li>purge the <code>{SONAR_QUBE}/data/es</code> folder</li>
<li>restart the SonarQube server</li>
<li>relaunch the project analysis</li>
</ul>
