SonarCloud: Getting error when running ant and sonar connecting to sonar cloud - sonarqube

We have a setup where we use SonarQube with Ant and connect to SonarCloud (https://sonarcloud.io). This setup was always working from local developer machine and also from bitbucket pipelines. Since two days, we have been getting below error on local and bitbucket pipelines. Below is the stacktrace:
Project.sonar:
[sonar:sonar] Apache Ant(TM) version 1.10.5 compiled on July 10 2018
[sonar:sonar] SonarQube Ant Task version: 2.5
[sonar:sonar] Loaded from: file:<redacted_path>/sonarqube-ant-task-2.5.jar
[sonar:sonar] User cache: /Users/<user>/.sonar/cache
BUILD FAILED
<redacted_path>/build-sonar.xml:120: java.lang.IllegalStateException: not started
at org.sonarsource.scanner.api.EmbeddedScanner.checkLauncherExists(EmbeddedScanner.java:244)
at org.sonarsource.scanner.api.EmbeddedScanner.stop(EmbeddedScanner.java:164)
at org.sonarsource.scanner.ant.SonarQubeTask.launchAnalysis(SonarQubeTask.java:101)
at org.sonarsource.scanner.ant.SonarQubeTask.execute(SonarQubeTask.java:81)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:99)
at org.apache.tools.ant.Task.perform(Task.java:350)
at org.apache.tools.ant.Target.execute(Target.java:449)
at org.apache.tools.ant.Target.performTasks(Target.java:470)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1388)
at org.apache.tools.ant.Project.executeTarget(Project.java:1361)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:1251)
at org.apache.tools.ant.Main.runBuild(Main.java:834)
at org.apache.tools.ant.Main.startAnt(Main.java:223)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:284)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:101)
Below is the command that we use for running sonar:
ant compile Project.sonar -Dsonar.host.url=https://sonarcloud.io -Dsonar.organization=<org_name> -Dsonar.login=<token_which_has_all_privs>
We have tried changing the sonar.login token with a new one (thinking that old might have expired) but it didn't work with new one also.
I am not able to find any help anywhere else regarding this error since it does not say much. I see other errors like "WebApp did not start" but that seems to be related to the use case where SonarQube is running on local. But in our case we are connecting to https://sonarcloud.io host. We have also tried with sonar.login and sonar.password and it still fails.
Any help would be appreciated.
Update 1 for mc1arke question Is this sufficient? I can create a new basic build-sonar.xml and provide it but it will only have below content and some properties/variables specific for our environment.
Extract from build-sonar.xml looks as below:
<taskdef uri="antlib:org.sonar.ant" resource="org/sonar/ant/antlib.xml">
<classpath>
<pathelement location="${lib.dir}/sonarqube-ant-task-2.5.jar"/>
</classpath>
</taskdef>
<target name="Project.sonar">
<property name="sonar.projectKey" value="ProjectKey" />
<property name="sonar.projectName" value="ProjectName" />
<property name="sonar.projectVersion" value="1.0" />
<property name="sonar.sources" value="${src.dir}" />
<property name="sonar.binaries" value="${build.dir}" />
<property name="sonar.java.binaries" value="${build.dir}" />
<property name="sonar.java.libraries" value="${lib.dir}/*.jar"/>
<property name="sonar.java.test.libraries" value="${lib.dir}/*.jar"/>
<property name="sonar.java.source" value="1.8" />
<property name="sonar.exclusions" value="<some modules>"/>
<property name="sonar.jacoco.reportPath" value="${junit.reports}/coverage/jacoco.exec"/>
<property name="sonar.junit.reportsPath" value="${junit.reports}" />
<property name="sonar.jacoco.itReportPath" value="${junit.reports}/coverage/jacoco-it.exec"/>
<property name="sonar.coverage.exclusions" value="<some modules>"/>
<sonar:sonar/>
</target>
Update 2: I looked at the sonar code in EmbeddedScanner.java, IsolatedLauncherFactory.java, and IsolatedLauncherProxy.java which actually should be throwing the error. I also ran the ant command in -v mode and below is the output of it:
Project.sonar:
[antlib:org.sonar.ant] Could not load definitions from resource org/sonar/ant/antlib.xml. It could not be found.
[sonar:sonar] Apache Ant(TM) version 1.10.5 compiled on July 10 2018
[sonar:sonar] SonarQube Ant Task version: 2.5
[sonar:sonar] Loaded from: file:<redacted_path>/sonarqube-ant-task-2.5.jar
[sonar:sonar] keyStore is :
[sonar:sonar] keyStore type is : jks
[sonar:sonar] keyStore provider is :
[sonar:sonar] init keystore
[sonar:sonar] init keymanager of type SunX509
[sonar:sonar] User cache: /Users/<user.name>/.sonar/cache
[sonar:sonar] Extract sonar-scanner-api-batch in temp...
[sonar:sonar] Get bootstrap index...
[sonar:sonar] Download: https://sonarcloud.io/batch_bootstrap/index
[sonar:sonar] Get bootstrap completed
So looking at the code and its output I think below is the code flow:
EmbeddedScanner.checkLauncherExists() --> IsolatedLauncherFactory.createLauncher() --> JarDownloader.download() --> JarDownloader.getScannerEngineFiles() --> BootstrapIndexDownloader.getIndex()
From the log, it seems that the index was returned successfully. But either the JarDownloader.getScannerEngineFiles() or JarDownloader.download() failed because the log statement logger.debug("Create isolated classloader..."); right after List<File> jarFiles = jarDownloader.download() in IsolatedLauncherFactory.createLauncher() is not printed.
Reference: Sonar source code available here

Your issue is that sonar-ant-plugin does not seem to support SonarCloud. The plugin depends on an old version of sonar-scanner-api which attempts to retrieve a list of Jars to download by retrieving /batch_bootstrap/index from the remote SonarQube server. SonarCloud doesn't provide such a URL, but does have /bootstrap/index which newer versions of sonar-scanner-api do use.
Update: version 2.6.0.1426 of the scanner for Ant has been released to fix the issue.

Related

Network error using Chocolatey to install programs

I have tried just about everything on https://chocolatey.org/install
Here is the error I get using the method most strongly recommended:
Per their instructions, I used PowerShell to
'Set-ExecutionPolicy AllSigned'
I have also tried performing the install from PowerShell
with the following result:
I have also tried the "completely offline install" which involves manually downloading and extracting a nupkg file, but with similar results as the above. Do you have any insight into the errors I'm receiving? What should I do to get chocolatey installed?
Thank you in advance for any ideas you might have.
UPDATE: Click Here for the chocolatey log file. Snippet below to satisfy SO requirement:
2017-04-26 11:47:33,091 [DEBUG] - Configuration:
CommandName='install'|
CacheLocation='C:\Users\PARAGON\AppData\Local\Temp\chocolatey'|
ContainsLegacyPackageInstalls='True'|
CommandExecutionTimeoutSeconds='2700'|WebRequestTimeoutSeconds='30'|
Sources='https://chocolatey.org/api/v2/'|SourceType='normal'|
Debug='False'|Verbose='False'|Trace='False'|Force='False'|Noop='False'|
HelpRequested='False'|UnsuccessfulParsing='False'|RegularOutput='True'|
QuietOutput='False'|PromptForConfirmation='True'|AcceptLicense='False'|
AllowUnofficialBuild='False'|Input='choco'|AllVersions='False'|
SkipPackageInstallProvider='False'|PackageNames='choco'|
Prerelease='False'|ForceX86='False'|OverrideArguments='False'|
NotSilent='False'|ApplyPackageParametersToDependencies='False'|
ApplyInstallArgumentsToDependencies='False'|IgnoreDependencies='False'|
AllowMultipleVersions='False'|AllowDowngrade='False'|
ForceDependencies='False'|Information.PlatformType='Windows'|
Information.PlatformVersion='6.2.9200.0'|
Information.PlatformName='Windows 8'|
Information.ChocolateyVersion='0.10.5.0'|
Information.ChocolateyProductVersion='0.10.5'|
Information.FullName='choco, Version=0.10.5.0, Culture=neutral,
PublicKeyToken=79d02ea9cad655eb'|
Information.Is64BitOperatingSystem='True'|
Information.Is64BitProcess='True'|Information.IsInteractive='True'|
Information.IsUserAdministrator='True'|
Information.IsProcessElevated='True'|
Information.IsLicensedVersion='False'|Information.LicenseType='Foss'|
Features.AutoUninstaller='True'|Features.ChecksumFiles='True'|
Features.AllowEmptyChecksums='False'|
Features.AllowEmptyChecksumsSecure='True'|
Features.FailOnAutoUninstaller='False'|
Features.FailOnStandardError='False'|Features.UsePowerShellHost='True'|
Features.LogEnvironmentValues='False'|Features.VirusCheck='False'|
Features.FailOnInvalidOrMissingLicense='False'|
Features.IgnoreInvalidOptionsSwitches='True'|
Features.UsePackageExitCodes='True'|
Features.UseFipsCompliantChecksums='False'|
Features.ShowNonElevatedWarnings='True'|
Features.ShowDownloadProgress='True'|
Features.StopOnFirstPackageFailure='False'|
Features.UseRememberedArgumentsForUpgrades='False'|
Features.ScriptsCheckLastExitCode='False'|
ListCommand.LocalOnly='False'|
ListCommand.IncludeRegistryPrograms='False'|ListCommand.PageSize='25'|
ListCommand.Exact='False'|ListCommand.ByIdOnly='False'|
ListCommand.IdStartsWith='False'|ListCommand.OrderByPopularity='False'|
ListCommand.ApprovedOnly='False'|
ListCommand.DownloadCacheAvailable='False'|
ListCommand.NotBroken='False'|
ListCommand.IncludeVersionOverrides='False'|
UpgradeCommand.FailOnUnfound='False'|
UpgradeCommand.FailOnNotInstalled='False'|
UpgradeCommand.NotifyOnlyAvailableUpgrades='False'|
UpgradeCommand.ExcludePrerelease='False'|
NewCommand.AutomaticPackage='False'|
NewCommand.UseOriginalTemplate='False'|SourceCommand.Command='unknown'|
SourceCommand.Priority='0'|SourceCommand.BypassProxy='False'|
SourceCommand.AllowSelfService='False'|
FeatureCommand.Command='unknown'|
ConfigCommand.Command='unknown'|PinCommand.Command='unknown'|
Proxy.BypassOnLocal='True'| 2017-04-26 11:47:33,095 [DEBUG] - _
Chocolatey:ChocolateyInstallCommand - Normal Run Mode _ 2017-04-26
11:47:33,102 [INFO ] - Installing the following packages: 2017-04-26
11:47:33,111 [INFO ] - choco 2017-04-26 11:47:33,119 [INFO ] - By
installing you accept licenses for the packages. 2017-04-26
11:47:33,517 [WARN ] - [NuGet] An error occurred while loading
packages from 'https://chocolatey.org/api/v2/': The remote server
returned an error: (403) Forbidden. 2017-04-26 11:47:33,531 [ERROR] -
choco not installed. The package was not found with the source(s)
listed. If you specified a particular version and are receiving this
message, it is possible that the package name exists but the version
does not. Version: "" Source(s): "https://chocolatey.org/api/v2/"
2017-04-26 11:47:33,558 [WARN ] - Chocolatey installed 0/1 packages.
1 packages failed. See the log for details
(C:\ProgramData\chocolatey\logs\chocolatey.log). 2017-04-26
11:47:33,569 [INFO ] - 2017-04-26 11:47:33,577 [ERROR] - Failures
2017-04-26 11:47:33,586 [ERROR] - - choco - choco not installed. The
package was not found with the source(s) listed. If you specified a
particular version and are receiving this message, it is possible that
the package name exists but the version does not. Version: ""
Source(s): "https://chocolatey.org/api/v2/" 2017-04-26 11:47:33,596
[WARN ] - Enjoy using Chocolatey? Explore more amazing features to
take your experience to the next level at
https://chocolatey.org/compare 2017-04-26 11:47:33,606 [DEBUG] -
Sending message 'PostRunMessage' out if there are subscribers...
2017-04-26 11:47:33,613 [DEBUG] - Exiting with 1
My guess is that most likely you are running into a SSL/TLS issue. We just switched the certificates out on Monday, and the old certificate expired on Tuesday. My guess is that you need to update your certificates or you have a caching of the old certificate for some reason.
The other possibility is there is a proxy in the way that is stopping you from reaching out.
Don't forget about your chocolatey.config. Appears you got blocked but for anyone visiting this question these are the relevant keys you'll need to fill out. Unless you've been a bad boy and got your IP black listed.
<config>
<add key="cacheLocation" value="" description="Cache location if not TEMP folder." />
<add key="containsLegacyPackageInstalls" value="true" description="Install has packages installed prior to 0.9.9 series." />
<add key="commandExecutionTimeoutSeconds" value="2700" description="Default timeout for command execution. '0' for infinite (starting in 0.10.4)." />
<add key="proxy" value="" description="Explicit proxy location. Available in 0.9.9.9+." />
<add key="proxyUser" value="" description="Optional proxy user. Available in 0.9.9.9+." />
<add key="proxyPassword" value="" description="Optional proxy password. Encrypted. Available in 0.9.9.9+." />
<add key="webRequestTimeoutSeconds" value="30" description="Default timeout for web requests. Available in 0.9.10+." />
<add key="proxyBypassList" value="" description="Optional proxy bypass list. Comma separated. Available in 0.10.4+." />
<add key="proxyBypassOnLocal" value="true" description="Bypass proxy for local connections. Available in 0.10.4+." />

MSBuild.SonarQube.Runner.exe attempting to connect with h2 instead of SQL

The first 2 stages (prep, build) of an analysis from the command line with MSBuild.SonarQube.Runner.exe seem to work fine.
The properties in SonarQube.Analysis.xml are:
<Property Name="sonar.host.url">http://server-45:9000</Property>
<Property Name="sonar.login">admin</Property>
<Property Name="sonar.password">admin</Property>
<Property Name="sonar.jdbc.url">jdbc:jtds:sqlserver://server-46/SonarQube;instance=INSTANCE01;SelectMethod=Cursor</Property>
<Property Name="sonar.jdbc.driverClassName">com.microsoft.sqlserver.jdbc.SQLServerDriver</Property>
<Property Name="sonar.jdbc.username">sonarqube</Property>
<Property Name="sonar.jdbc.password">stackoverflow</Property>
The final stage fails with:
17:30:17.358 INFO - Create JDBC datasource for jdbc:h2:tcp://localhost/sonar
It appears to be ignoring the local xml settings file completely, finding the default one where the exe is which is identical and still trying to create a default h2 connection to a database.
Full log:
C:\Users\me\Documents\Visual Studio 2013\Projects\ClassLibrary9>MSBuild.SonarQube.Runner end
Default properties file was found at C:\Apps\MsSonarRunner\SonarQube.Analysis.xml
Loading analysis properties from C:\Apps\MsSonarRunner\SonarQube.Analysis.xml
Post-processing started.
WARNING: File is not under the project directory and cannot currently be analysed by SonarQube. File: C:\Users\me\AppData\Local\Temp\.NETFramework,Version=v4.5.AssemblyAttributes.cs, project: C:\Users\me\Documents\Visual Studio 2013\Projects\ClassLibrary9\ClassLibrary9\ClassLibrary9.csproj
The SONAR_RUNNER_HOME environment variable is not required and will be ignored.
SONAR_RUNNER_OPTS is not configured. Setting it to the default value of -Xmx1024m
Calling the sonar-runner...
C:\Users\me\Documents\Visual Studio 2013\Projects\ClassLibrary9\.sonarqube\bin\sonar-runner\bin\..
SonarQube Runner 2.4
Java 1.8.0_60 Oracle Corporation (64-bit)
Windows 8 6.2 amd64
SONAR_RUNNER_OPTS=-Xmx1024m
INFO: Error stacktraces are turned on.
INFO: Runner configuration file: C:\Users\me\Documents\Visual Studio 2013\Projects\ClassLibrary9\.sonarqube\bin\sonar-runner\bin\..\conf\sonar-runner.properties
INFO: Project configuration file: C:\Users\me\Documents\Visual Studio 2013\Projects\ClassLibrary9\.sonarqube\out\sonar-project.properties
INFO: Default locale: "en_GB", source code encoding: "UTF-8"
INFO: Work directory: C:\Users\me\Documents\Visual Studio 2013\Projects\ClassLibrary9\.sonarqube\out\.sonar
INFO: SonarQube Server 5.1.2
17:30:17.096 INFO - Load global repositories
17:30:17.295 INFO - Load global repositories (done) | time=200ms
17:30:17.296 INFO - Server id: 20151005162012
17:30:17.298 INFO - User cache: C:\Users\me\.sonar\cache
17:30:17.304 INFO - Install plugins
17:30:17.350 INFO - Install JDBC driver
17:30:17.358 INFO - Create JDBC datasource for jdbc:h2:tcp://localhost/sonar
INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
Total time: 0.817s
Final Memory: 8M/245M
INFO: ------------------------------------------------------------------------
17:30:17.415 Creating a summary markdown file...
Anyone any ideas here?
Thanks in advance.
Fixed.
This was a side effect of the following:
I copied batch files from another analysis over and the /s switch pointed to a completely different settings xml file. Doing the pre build run and the post build run with 2 different sets of settings causes this confusion.

spring xd Required module artifacts are either missing or invalid

I just started with spring xd and wanted to test out a simple hadoop job that I already have with single node config. I mostly followed (http://docs.spring.io/spring-xd/docs/1.2.1.RELEASE/reference/html)
the module jar file that I upload does not contain anything else just this file resources\config\spring-module.xml:
<!-- required since Hadoop Job is a class not an interface and we need to
use a Job with step scope to access #{jobParameters['...']} -->
<bean class="org.springframework.batch.core.scope.StepScope">
<property name="proxyTargetClass" value="true" />
</bean>
<batch:job id="testetl">
<batch:step id="testetl1">
<batch:tasklet ref="testjob" />
</batch:step>
</batch:job>
<hdp:jar-tasklet id="testjob"
jar="/home/hduser/libs/abhishek.jar">
</hdp:jar-tasklet>
On xd shell:
xd:>module upload --type job --name test_job --file /home/hduser/springxd/test-job-module-0.0.1-SNAPSHOT.jar --force
Successfully uploaded module 'job:test_job'
xd:>job create --name test_elt --definition "test_job" --deploy
Successfully created and deployed job 'test_elt'
But on server instance getting below exception and unable to start the job.
I tried bit different xml also but same error.
Not sure what is going wrong?
2015-09-22T21:49:24+0530 1.2.1.RELEASE INFO DeploymentsPathChildrenCache-0 container.DeploymentListener - Deploying module [ModuleDescriptor#1280cb40 moduleName = 'test_job', moduleLabel = 'test_job', group = 'test_elt', sourceChannelName = [null], sinkChannelName = [null], index = 0, type = job, parameters = map[[empty]], children = list[[empty]]]
2015-09-22T21:49:24+0530 1.2.1.RELEASE ERROR DeploymentsPathChildrenCache-0 container.DeploymentListener - **Exception deploying module
java.lang.IllegalArgumentException: Required module artifacts are either missing or invalid. Unable to determine module type for module definition**: 'job:test_job'.
at org.springframework.util.Assert.notNull(Assert.java:112) ~[spring-core-4.1.7.RELEASE.jar:4.1.7.RELEASE]
at org.springframework.xd.module.core.ModuleFactory.createSimpleModule(ModuleFactory.java:122) ~[spring-xd-module-1.2.1.RELEASE.jar:1.2.1.RELEASE]
at org.springframework.xd.module.core.ModuleFactory.createAndConfigureModuleInstance(ModuleFactory.java:98) ~[spring-xd-module-1.2.1.RELEASE.jar:1.2.1.RELEASE]
at org.springframework.xd.module.core.ModuleFactory.createModule(ModuleFactory.java:81) ~[spring-xd-module-1.2.1.RELEASE.jar:1.2.1.RELEASE]
at org.springframework.xd.dirt.module.ModuleDeployer.createModule(ModuleDeployer.java:181) ~[spring-xd-dirt-1.2.1.RELEASE.jar:1.2.1.RELEASE]
at org.springframework.xd.dirt.server.container.DeploymentListener.deployModule(DeploymentListener.java:363) [spring-xd-dirt-1.2.1.RELEASE.jar:1.2.1.RELEASE]
at org.springframework.xd.dirt.server.container.DeploymentListener.deployJobModule(DeploymentListener.java:291) [spring-xd-dirt-1.2.1.RELEASE.jar:1.2.1.RELEASE]
at org.springframework.xd.dirt.server.container.DeploymentListener.onChildAdded(DeploymentListener.java:181) [spring-xd-dirt-1.2.1.RELEASE.jar:1.2.1.RELEASE]
at org.springframework.xd.dirt.server.container.DeploymentListener.childEvent(DeploymentListener.java:149) [spring-xd-dirt-1.2.1.RELEASE.jar:1.2.1.RELEASE]
at org.apache.curator.framework.recipes.cache.PathChildrenCache$5.apply(PathChildrenCache.java:509) [curator-recipes-2.6.0.jar:na]
the module jar file that I upload does not contain anything else just this file resources\config\spring-module.xml:
To clarify, in the resulting .jar file, the xml file must be at
config\spring-module.xml
and not at
resources\config\spring-module.xml
(This resources bit is part of the canonical maven location where source files are usually put, as in src/main/resources)
jar tvf your-module.jar should read config/spring-module.xml and not resources/...

getting error wile integrating jococo with sonar in ant tasks

I want to use jococco code coverage for my sonar analysis an for that I have downloaded jococo jar and agent jars and also maven plugin jar of jococo, since my project is ant based so I have keep these files in my class path and in ant home lib also now i am using below tags for code coverage in sonar but still i am gettig the error that is ..Project coverage is set to 0% as no JaCoCo execution data has been dumped: , please advise how to overcome from this error , FOLKS PLEASE ADVISE
my build xml conating the following tasks for ant in sonar tag shown below..
<property key="sonar.java.coveragePlugin" value="jacoco" />
<property key="sonar.junit.reportsPath" value="${ps}/test-acceptance/com/sfm/ice/oa/report"/>
<property key="sonar.jacoco.reportPath" value="${ps}/jacoco/jacoco-ut.exec" />
<property key="sonar.jacoco.itReportPath" value="${ps}/jacoco/jacoco-it.exec" />
<property key="sonar.jacoco.itReportPath" value="${ps}/jacoco/jacoco-it.exec" />
and the logs i can see this error as show below ..
15:33:31.427 INFO - Retrieve SCM blame information with encoding UTF-8 done: 12742 ms
[20:03:31]15:33:31.431 INFO - Sensor ScmActivitySensor done: 12749 ms
[20:03:31]15:33:31.431 INFO - Sensor CpdSensor...
[20:03:31]15:33:31.432 INFO - SonarEngine is used
[20:03:31]15:33:31.664 INFO - Cross-project analysis disabled
[20:03:40]15:33:40.717 INFO - Sensor CpdSensor done: 9286 ms
[20:03:40]15:33:40.719 INFO - Sensor PmdSensor...
[20:03:40]15:33:40.721 INFO - Execute PMD 4.3...
[20:03:40]15:33:40.737 INFO - Java version: 1.5
[20:03:41]15:33:41.076 INFO - PMD configuration: /opt/app/glacier/buildAgent-8.0.3/work/Glacier/build/pmd.xml
[20:04:24]15:34:24.639 INFO - Execute PMD 4.3 done: 43918 ms
[20:04:24]15:34:24.850 INFO - Sensor PmdSensor done: 44131 ms
[20:04:24]15:34:24.850 INFO - Sensor JaCoCoItSensor...
[20:04:24]15:34:24.856 INFO - Project coverage is set to 0% as no JaCoCo execution data has been dumped: /opt/app/glacier/buildAgent-8.0.3/work/Glacier/${ops}/jacoco/jacoco-it.exec
[20:04:26]15:34:26.203 INFO - No information about coverage per test.
[20:04:26]15:34:26.203 INFO - Sensor JaCoCoItSensor done: 1353 ms
[20:04:26]15:34:26.204 INFO - Sensor JaCoCoOverallSensor...
[20:04:26]15:34:26.204 INFO - Sensor JaCoCoOverallSensor done: 0 ms
[20:04:26]15:34:26.205 INFO - Sensor SurefireSensor...
[20:04:26]15:34:26.206 INFO - parsing /opt/app/glacier/buildAgent-8.0.3/work/Glacier/${ops}/test-acceptance/com/rbsfm/ice/ioa/report
[20:04:26]15:34:26.207 INFO - Sensor SurefireSensor done: 2 ms
[20:04:26]15:34:26.207 INFO - Sensor CheckstyleSensor...
[20:04:26]15:34:26.209 INFO - Execute Checkstyle 5.6...
[20:04:26]15:34:26.218 INFO - Checkstyle configuration: /opt/app/glacier/buildAgent-8.0.3/work/Glacier/build/checkstyle.xml
[20:04:31]15:34:31.581 INFO - Execute Checkstyle 5.6 done: 5372 ms
[20:04:31]15:34:31.586 INFO - Sensor CheckstyleSensor done: 5379 ms
[20:04:31]15:34:31.587 INFO - Sensor InitialOpenIssuesSensor...
[20:04:34]15:34:34.650 INFO - Sensor InitialOpenIssuesSensor done: 3063 ms
[20:04:34]15:34:34.651 INFO - Sensor ProfileSensor...
[20:04:35]15:34:35.308 INFO - Sensor ProfileSensor done: 657 ms
[20:04:35]15:34:35.309 INFO - Sensor ProfileEventsSensor...
[20:04:35]15:34:35.319 INFO - Sensor ProfileEventsSensor done: 10 ms
[20:04:35]15:34:35.320 INFO - Sensor ProjectLinksSensor...
[20:04:35]15:34:35.333 INFO - Sensor ProjectLinksSensor done: 13 ms
[20:04:35]15:34:35.334 INFO - Sensor VersionEventsSensor...
[20:04:35]15:34:35.385 INFO - Sensor VersionEventsSensor done: 51 ms
[20:04:35]15:34:35.386 INFO - Sensor com.headway.plugins.sonar.S101Sensor#3ca021e3...
[20:04:35]15:34:35.415 INFO - Sensor com.headway.plugins.sonar.S101Sensor#3ca021e3 done: 29 ms
[20:04:35]15:34:35.416 INFO - Sensor JaCoCoSensor...
[20:04:35]15:34:35.419 INFO - Project coverage is set to 0% as no JaCoCo execution data has been dumped: /opt/app/hhh/buildAgent-8.0.3/work/hhh/${ops}/jacoco/jacoco-ut.exec
[20:05:14]15:35:14.613 INFO - No information about coverage per test.
[20:05:14]15:35:14.615 INFO - Sensor JaCoCoSensor done: 39199 ms
[20:05:15]15:35:15.444 INFO - Execute decorators...
We are successfully using jacoco for unit test coverage with SonarQube, using an Ant build. I can't tell from your snippets whether you are executing unit tests via Ant build, or if you are expecting SonarQube to execute them for you. We have Jenkins execute a build step that executes unit tests (and collects jacoco coverage data) separately and prior to the Jenkins step that executes SonarQube analysis.
That said, it looks like the major difference between what I see in your snippets and what we have in our build.xml is property name: we have sonar.core.codeCoveragePlugin, which is not what you are using.
<property name="sonar.dynamicAnalysis" value="reuseReports"/>
<property name="sonar.surefire.reportsPath" value="${test.log.dir}"/>
<property name="sonar.junit.reportsPath" value="${test.log.dir}"/>
<property name="sonar.sources" value="${src.dir}" />
<property name="sonar.tests" value="${test.src.dir}" />
<property name="sonar.binaries" value="${classes.dir}" />
<property name="sonar.core.codeCoveragePlugin" value="jacoco" />
<property name="sonar.jacoco.reportPath" value="${test.log.dir}/jacoco.exec"/>
Buried in our "test" target is this:
<jacoco:coverage enabled="${my.coverage.enabled}" destfile="${test.log.dir}/jacoco.exec">
<junit printsummary="true"
fork="yes"
...
</junit>
</jacoco:coverage>
</target>
Hope that helps.

XmlRpcException during TeamCity build agent registration

I have installed the TeamCity build agent on my machine a few different ways- using Java Web Start and the manual .zip distribution. Both result in viable installations, as I have once or twice been able to connect and register properly with the TeamCity server. However, upon restarting (<install_location>/bin/agent.sh stop...<install_location>/bin/agent.sh start) I get the following error in teamcity-agent.log (with extra debugging turned on in the log4j config file).
[2013-04-03 09:05:09,870] DEBUG - jetbrains.buildServer.XMLRPC - faultStringjava.lang.RuntimeException: org.jdom.input.JDOMParseException: Error on line 28: XML document structures must start and end within the same entity.faultCode0
[2013-04-03 09:05:09,878] DEBUG - buildServer.AGENT.registration - jetbrains.buildServer.xmlrpc.RemoteCallException: Call http://teamcityserver:8080/RPC2 buildServer.registerAgent3: org.apache.xmlrpc.XmlRpcException: java.lang.RuntimeException: org.jdom.input.JDOMParseException: Error on line 28: XML document structures must start and end within the same entity.
jetbrains.buildServer.xmlrpc.RemoteCallException: Call http://teamcityserver:8080/RPC2 buildServer.registerAgent3: org.apache.xmlrpc.XmlRpcException: java.lang.RuntimeException: org.jdom.input.JDOMParseException: Error on line 28: XML document structures must start and end within the same entity.
at jetbrains.buildServer.xmlrpc.AbstractXmlRpcTarget.call(AbstractXmlRpcTarget.java:94)
at jetbrains.buildServer.agent.impl.ServerXmlRpcProxy.registerAgent3(ServerXmlRpcProxy.java:62)
at jetbrains.buildServer.agent.impl.BuildAgentImpl.doRegisterOnBuildServer(BuildAgentImpl.java:776)
at jetbrains.buildServer.agent.impl.BuildAgentImpl.registerOnBuildServer(BuildAgentImpl.java:748)
at jetbrains.buildServer.agent.impl.ServerMonitor.run(ServerMonitor.java:71)
Caused by: org.apache.xmlrpc.XmlRpcException: java.lang.RuntimeException: org.jdom.input.JDOMParseException: Error on line 28: XML document structures must start and end within the same entity.
at org.apache.xmlrpc.XmlRpcClientResponseProcessor.decodeException(XmlRpcClientResponseProcessor.java:104)
at org.apache.xmlrpc.XmlRpcClientResponseProcessor.decodeResponse(XmlRpcClientResponseProcessor.java:71)
at org.apache.xmlrpc.XmlRpcClientWorker.execute(XmlRpcClientWorker.java:73)
at org.apache.xmlrpc.TCXmlRpcClient$1.execute(TCXmlRpcClient.java:89)
at org.apache.xmlrpc.XmlRpcClient.execute(XmlRpcClient.java:194)
at org.apache.xmlrpc.XmlRpcClient.execute(XmlRpcClient.java:185)
at org.apache.xmlrpc.XmlRpcClient.execute(XmlRpcClient.java:178)
at jetbrains.buildServer.xmlrpc.impl.CommonsXmlRpcTargetImpl$1.execute(CommonsXmlRpcTargetImpl.java:72)
at jetbrains.buildServer.xmlrpc.AbstractXmlRpcTarget.call(AbstractXmlRpcTarget.java:84)
... 4 more
[2013-04-03 09:05:09,878] WARN - buildServer.AGENT.registration - Call http://teamcityserver:8080/RPC2 buildServer.registerAgent3: org.apache.xmlrpc.XmlRpcException: java.lang.RuntimeException: org.jdom.input.JDOMParseException: Error on line 28: XML document structures must start and end within the same entity.
[2013-04-03 09:05:09,878] WARN - buildServer.AGENT.registration - Connection to TeamCity server is probably lost. Will be trying to restore it. Take a look at logs/teamcity-agent.log for details (unless you're using custom logging).
This is the xml in question according to the logs with extra xmlrpc debugging:
<?xml version="1.0"?><methodCall><methodName>buildServer.registerAgent3</methodName><params><param><value><![CDATA[<?xml version="1.0" encoding="UTF-8"?>
<agentDetails agentName="aaronhbox_0" agentPort="9090" authToken="" osName="Linux, version 3.5.0-17-generic">
<alternativeAddresses>
<address>10.2.1.232</address>
<address>192.168.225.1</address>
<address>192.168.80.1</address>
</alternativeAddresses>
<availableRunners>
<runner runType="Ant" />
<runner runType="Duplicator" />
<runner runType="gradle-runner" />
<runner runType="Inspection" />
<runner runType="Ipr" />
<runner runType="JPS" />
<runner runType="Maven2" />
<runner runType="rake-runner" />
<runner runType="simpleRunner" />
</availableRunners>
<availableVcs>
<vcs name="perforce" />
<vcs name="mercurial" />
<vcs name="jetbrains.git" />
<vcs name="svn" />
<vcs name="cvs" />
</availableVcs>
<buildParameters>
<param name="env.COLORTERM" value="gnome-terminal" />
<param name="env.COMP_WORDBREAKS"><![CDATA["'><;|]]></value></param></params></methodCall>
Only once have I been able to restart the agent and have it connect again properly. Generally, I can install it, have it run once, then restarting it gives this error. Any ideas?
It looks like the formatting of the COMP_WORDBREAKS environment variable was messing with the xml structure and not allowing the complete generation of the xml request message.
The COMP_WORDBREAKS value on my machine is "'><;|&(:.
Placing the following line in the buildAgent.properties file fixed this problem and allows the agent to properly register.
env.COMP_WORDBREAKS=
I don't see any side-effects yet of making this change; the agent now seems to behave properly.

Resources