How to Find Out What Version of JUnit Jenkins is Expecting - jenkins

I am trying to configure my Jenkins project to display the results of a JUnit XML report. However, the Jenkins project throws the below error when trying to display the JUnit XML during the build.
Recording test results
ERROR: Publisher hudson.tasks.junit.JUnitResultArchiver aborted due to exception
java.lang.NoClassDefFoundError: hudson/tasks/junit/JUnitParser$ParseResultCallable
at hudson.tasks.junit.JUnitParser.parseResult(JUnitParser.java:90)
at hudson.tasks.junit.JUnitResultArchiver.parse(JUnitResultArchiver.java:120)
at hudson.tasks.junit.JUnitResultArchiver.perform(JUnitResultArchiver.java:137)
at hudson.tasks.BuildStepCompatibilityLayer.perform(BuildStepCompatibilityLayer.java:74)
at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:770)
at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:734)
at hudson.model.Build$BuildExecution.post2(Build.java:183)
at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:683)
at hudson.model.Run.execute(Run.java:1765)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
at hudson.model.ResourceController.execute(ResourceController.java:89)
at hudson.model.Executor.run(Executor.java:240)
Finished: FAILURE
I have read that this error is possibly due to a mismatch between the JUnit version Jenkins is expecting and the version used by my project. How do I find out which version of JUnit Jenkins is expecting? Also, is there anything else that could cause the above error?

Error is thrown by JUnitResultArchiver. It is a dependency of Junit plugin. Go into the Jenkins and look for the version of JUnit Plugin.Then look at source code of that particular version on project's github: https://github.com/jenkinsci/junit-plugin
After doing that, you will have the exact version that it requires.
Another reason why you are seeing this error is that you have a different compile and runtime classpaths.

Related

generate ‘Allure Report’ for protractor using jenkins - error "‘Allure Report’ aborted due to exception: java.io.IOException:"

Unpacking https://repo.jenkins-ci.org/maven-repo1/io/qameta/allure/allure-commandline/2.13.0/allure-commandline-2.13.0.zip to C:\Users\user1G.jenkins\tools\ru.yandex.qatools.allure.jenkins.tools.AllureCommandlineInstallation\allure on Jenkins
ERROR: Step ‘Allure Report’ aborted due to exception:
java.io.IOException: Failed to rename C:\Users\user1G.jenkins\tools\ru.yandex.qatools.allure.jenkins.tools.AllureCommandlineInstallation\allure\allure-2.13.0 to C:\Users\user1G.jenkins\tools\ru.yandex.qatools.allure.jenkins.tools.AllureCommandlineInstallation\allure\allure-2.13.0.__rename
Have you tried this!
java.io.IOException may be its jdk related and Allure requires JDK version 8 or higher.
Do install jdk version and update JAVA_HOME system variable correctly. Try again !
If still not work put the json-lib jar in JAVA_HOME/lib. I got the jar from http://www.java2s.com/Code/Jar/j/Downloadjsonlib24jdk15jar.htm

SonarQube Scanner Error while running the sonar qube from Jenkins build pipeline

Part of the Jenkins build pipeline we were running the sonar qube code scan and was working fine, only few days ago it started throwing error as mentioned below
Sonar Qube version: 6.7.6 (build 38781)
Sonar Scanner version: sonar-scanner-3.3.0.1492-windows
(Env variable) SONAR_SCANNER : C:\sonar-scanner-3.3.0.1492-windows
00:44:26.810 ERROR: Error during SonarQube Scanner execution
00:44:26.810 ERROR: Unable to load component class org.sonar.scanner.bootstrap.ScannerPluginInstaller
00:44:26.810 ERROR: Caused by: Unable to load component class org.sonar.home.cache.FileCache
00:44:26.810 ERROR: Caused by: Unable to load component class org.sonar.scanner.bootstrap.GlobalConfiguration
00:44:26.810 ERROR: Caused by: Not authorized. Please check the properties sonar.login and sonar.password.
We cannot upgrade to newer version , I would like to understand what is causing the issue for Sonar to fail. Appreciate your responses.
From Admin page (Sonarqube) give access to use to run execute sonar analysis and then
generate login token from UI .
_ **use propertyb in sonar.properties file** _
sonar.login=token

Jenkins CI: 'NumberFormatException: empty String'

We have a Jenkins installation and some projects which are tested by NUnit. This works fine and it writes an NUnit results XML file.
Then we have a 'Publish NUnit test result report' post-build step. But since friday it produces this error:
Recording NUnit tests results
ERROR: Step ‘Publish NUnit test result report’ aborted due to exception:
java.io.IOException: remote file operation failed: C:\Jenkins\workspace\xxx at hudson.remoting.Channel#205d5d5c:CIAgent: java.io.IOException: Failed to read C:\Jenkins\workspace\xxx\temporary-junit-reports\TEST-xxx_Tests.TestsWithRealServers.TestWithTwoLocals_1_2.xml
at hudson.FilePath.act(FilePath.java:986)
at hudson.FilePath.act(FilePath.java:968)
at hudson.plugins.nunit.NUnitPublisher.getTestResult(NUnitPublisher.java:226)
[...]
Caused by: java.io.IOException: Failed to read C:\Jenkins\workspace\xxx\temporary-junit-reports\TEST-xxx_Tests.TestsWithRealServers.TestWithTwoLocals_1_2.xml
at hudson.tasks.junit.TestResult.parse(TestResult.java:306)
at hudson.tasks.junit.TestResult.parsePossiblyEmpty(TestResult.java:244)
at hudson.tasks.junit.TestResult.parse(TestResult.java:175)
[...]
... 13 more
Caused by: java.lang.NumberFormatException: empty String
at sun.misc.FloatingDecimal.readJavaFormatString(Unknown Source)
at sun.misc.FloatingDecimal.parseFloat(Unknown Source)
at java.lang.Float.parseFloat(Unknown Source)
[...]
Archiving artifacts
Finished: FAILURE
The XML file is present in the working directory. I mentioned that the first line of this file looks like this:
<?xml version="1.0" encoding="UTF-8"?><testsuite errors="0" failures="0" name="xxx_Tests.TestsWithRealServers.TestWithTwoLocals" skipped="6" tests="6" time="">
So I guess it fails because the time attribe is empty.
Does anyone how I can fix this or why this error occurs?
Thanks!
Did you recently upgrade the jenkins JUnit plugin to 1.12? There is a reported issue in this update. You might try downgrading back to 1.11.
By the way, Jenkins plugins does not support Nunit 3 XML format. I also had a similar problem on Jenkins. I used to convert Nunit 3 result format to Nunit 2 format.
"C:\NUnit 3.5.0\nunit3-console.exe" /result:\MyApplication.xml;format=nunit2 "D:\Jenkins\workspace\MyApplication.Tests.dll"

The rule 'OCLint:ivar assignment outside accessors or init' does not exist

I am trying to integrate SonarQube to generate report on my iOS project,
I am using Objective-C Sonar plugin
When i run ./run-sonar.sh
OCLint generates a compile_commands.json file in my root directory.
and after that getting following error
11:24:39.782 INFO - Processing OCLint report /Users/.......app/./sonar-reports/oclint.xml
11:24:39.899 ERROR - Reporting 1073 violations.
INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
Total time: 16.240s
Final Memory: 6M/86M
INFO: ------------------------------------------------------------------------
ERROR: Error during Sonar runner execution
org.sonar.runner.impl.RunnerException: Unable to execute Sonar
at org.sonar.runner.impl.BatchLauncher$1.delegateExecution(BatchLauncher.java:91)
at org.sonar.runner.impl.BatchLauncher$1.run(BatchLauncher.java:75)
at java.security.AccessController.doPrivileged(Native Method)
at org.sonar.runner.impl.BatchLauncher.doExecute(BatchLauncher.java:69)
at org.sonar.runner.impl.BatchLauncher.execute(BatchLauncher.java:50)
at org.sonar.runner.api.EmbeddedRunner.doExecute(EmbeddedRunner.java:102)
at org.sonar.runner.api.Runner.execute(Runner.java:100)
at org.sonar.runner.Main.executeTask(Main.java:70)
at org.sonar.runner.Main.execute(Main.java:59)
at org.sonar.runner.Main.main(Main.java:53)
Caused by: The rule 'OCLint:ivar assignment outside accessors or init' does not exist.
Can any one help me on this issue?
Thanks
AMR
Thnaks
I had a similar error. My sonar server had two objective-c code analyser plugin. The Sonar Plugin for Objective C (free) and SonarSource Objective-C plugin (commercial)
When I removed (uninstalled) one of the plugin from sonar server the error stopped to occur
I had a similar error too with the last version of this plugin which is a fork of the one you used.
I downgrade my OCLint version from 0.11 to 0.10.1 and everything work perfectly.
It seems that the OCLint rules defined in the plugin was different of the OCLint version installed on my server.
I am not sure what version of the objective-c-sonar plugin that you were using.
I solved similar issue before.
Goto ${SONAR_INSTALLATION_FOLDER}/extensions/plugins/, copy the sonar-objective-c-plugin-${version}.jar to somewhere else.
unzip the jar file, and edit below file
org/sonar/plugins/objectivec/profile-oclint.xml
Add the rule you are missing following the layout of the xml file,
may be look similar below
<rule>
<repositoryKey>OCLint</repositoryKey>
<key>ivar assignment outside accessors or init</key>
</rule>
And edit another file org/sonar/plugins/objectivec/rules-oclint.xml
<rule>
<key>ivar assignment outside accessors or init</key>
<name>ivar assignment outside accessors or init</name>
<priority>MAJOR</priority>
<description>ivar assignment outside accessors or init</description>
</rule>
And then using zip to package the files unpacked as the new jar file.
Override the original plugin jar file in ${SONAR_INSTALLATION_FOLDER}/extensions/plugins/, restart the sonar, issue could be gone.
Repeat the step for all similar issues you encountered.

Adding Post-build Actions Sonar causes Jenkins build to fail

Using Jenkins ver. 1.494; Jenkins Sonar Plugin 2.0.1; Sonar server 3.4.1.
Maven job.
Adding Post-build Actions Sonar causes Jenkins build to fail (ERROR: Failed to parse POMs).
Deleting Sonar action then again makes it pass.
Sync complete, took 35 ms
Parsing POMs
[Atlas_Phevos] $ java -Xmx512m -XX:MaxPermSize=128m -cp /home/jenkins/jenkins-home/plugins/maven-plugin/WEB-INF/lib/maven3-agent-1.2.jar:/home/jenkins/jenkins-home/tools/Maven/Maven304/boot/plexus-classworlds-2.4.jar org.jvnet.hudson.maven3.agent.Maven3Main /home/jenkins/jenkins-home/tools/Maven/Maven304 /usr/local/tomcat-6.0.32/webapps/jenkins/WEB-INF/lib/remoting-2.19.jar /home/jenkins/jenkins-home/plugins/maven-plugin/WEB-INF/lib/maven3-interceptor-1.2.jar 60147
ERROR: Failed to parse POMs
java.io.IOException: Cannot run program "java" (in directory "/home/jenkins/jenkins-home/workspace/Atlas_Phevos"): java.io.IOException: error=2, No such file or directory
at java.lang.ProcessBuilder.start(ProcessBuilder.java:460)
at hudson.Proc$LocalProc.<init>(Proc.java:244)
at hudson.Proc$LocalProc.<init>(Proc.java:216)
at hudson.Launcher$LocalLauncher.launch(Launcher.java:763)
at hudson.Launcher$ProcStarter.start(Launcher.java:353)
at hudson.maven.AbstractMavenProcessFactory.newProcess(AbstractMavenProcessFactory.java:223)
at hudson.maven.ProcessCache.get(ProcessCache.java:231)
at hudson.maven.MavenModuleSetBuild$MavenModuleSetBuildExecution.doRun(MavenModuleSetBuild.java:670)
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:586)
at hudson.model.Run.execute(Run.java:1543)
at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:477)
at hudson.model.ResourceController.execute(ResourceController.java:88)
at hudson.model.Executor.run(Executor.java:236)
Caused by: java.io.IOException: java.io.IOException: error=2, No such file or directory
at java.lang.UNIXProcess.<init>(UNIXProcess.java:148)
at java.lang.ProcessImpl.start(ProcessImpl.java:65)
at java.lang.ProcessBuilder.start(ProcessBuilder.java:453)
... 12 more
Skipping sonar analysis due to bad build status FAILURE
Sending e-mails to: ____
Finished: FAILURE
I haven't put updated setting.xml on Jenkins server, I guess Jenkins should take its own configuration for Sonar (sever, JDBC connection etc.)
UPDATE: Problem still exists. I tried several jobs to start sonar analysis.
From your exception it looks like Jenkins cannot find your JDK. In your job configuration you can expand the Sonar properties. Make sure that a valid JDK from your Jenkins config is selected under the JDK option.
While you are looking at the properties make sure the pom file specified under Root POM is correct.
Try that...

Resources