SonarQube is unable to analyze file : Java file - java

org.sonar.squidbridge.api.AnalysisException: SonarQube is unable to analyze file a Java file
I am using SonarQube version 5.6.1
These are my properties and I have using Java 8:
sonar.projectKey=Project1
sonar.projectName=ProProject
sonar.projectVersion=Layer1
sonar.verbose=true
sonar.sources=src
sonar.qualitygate=SonarQube way
sonar.libraries=lib
sonar.tests=Tests
sonar.issuesReport.html.enable=true
sonar.issuesReport.console.enable=true
sonar.analysis.mode=publish
sonar.issuesReport.console.enable=true
sonar.sourceEncoding=UTF-8
During my sonarQube Analysis I am getting a error like this in my java code.
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(AccessController.java:594)
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: org.sonar.squidbridge.api.AnalysisException: SonarQube is unable to analyze file : '/application/scanner/jenkins/workspace/Test/src/Cases/address/PerAddress.java'
at org.sonar.java.ast.JavaAstScanner.simpleScan(JavaAstScanner.java:93)
at org.sonar.java.ast.JavaAstScanner.scan(JavaAstScanner.java:67)
at org.sonar.java.JavaSquid.scanSources(JavaSquid.java:133)
at org.sonar.java.JavaSquid.scan(JavaSquid.java:126)
at org.sonar.plugins.java.JavaSquidSensor.execute(JavaSquidSensor.java:93)
at org.sonar.batch.sensor.SensorWrapper.analyse(SensorWrapper.java:57)
at org.sonar.batch.phases.SensorsExecutor.executeSensor(SensorsExecutor.java:58)
at org.sonar.batch.phases.SensorsExecutor.execute(SensorsExecutor.java:50)
at org.sonar.batch.phases.AbstractPhaseExecutor.execute(AbstractPhaseExecutor.java:83)
at org.sonar.batch.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:192)
at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:142)
at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:127)
at org.sonar.batch.scan.ProjectScanContainer.scan(ProjectScanContainer.java:241)
at org.sonar.batch.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:236)
at org.sonar.batch.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:234)
at org.sonar.batch.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:226)
at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:142)
at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:127)
at org.sonar.batch.task.ScanTask.execute(ScanTask.java:47)
at org.sonar.batch.task.TaskContainer.doAfterStart(TaskContainer.java:86)
at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:142)
at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:127)
at org.sonar.batch.bootstrap.GlobalContainer.executeTask(GlobalContainer.java:106)
at org.sonar.batch.bootstrapper.Batch.executeTask(Batch.java:119)
at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:79)
at org.sonar.runner.batch.IsolatedLauncher.execute(IsolatedLauncher.java:48)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:95)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:55)
at java.lang.reflect.Method.invoke(Method.java:508)
at org.sonar.runner.impl.BatchLauncher$1.delegateExecution(BatchLauncher.java:87)
... 9 more
Caused by: java.lang.NullPointerException
at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:212)
at org.sonar.java.se.ProgramState.decreaseReference(ProgramState.java:212)
at org.sonar.java.se.ProgramState.cleanupDeadSymbols(ProgramState.java:256)
at org.sonar.java.se.ExplodedGraphWalker.cleanUpProgramState(ExplodedGraphWalker.java:241)
at org.sonar.java.se.ExplodedGraphWalker.handleBlockExit(ExplodedGraphWalker.java:249)
at org.sonar.java.se.ExplodedGraphWalker.execute(ExplodedGraphWalker.java:199)
at org.sonar.java.se.ExplodedGraphWalker.visitMethod(ExplodedGraphWalker.java:152)
at org.sonar.java.model.declaration.MethodTreeImpl.accept(MethodTreeImpl.java:218)
at org.sonar.java.se.SymbolicExecutionVisitor.visitNode(SymbolicExecutionVisitor.java:49)
at org.sonar.java.ast.visitors.SubscriptionVisitor.visit(SubscriptionVisitor.java:95)
at org.sonar.java.ast.visitors.SubscriptionVisitor.visitChildren(SubscriptionVisitor.java:120)
at org.sonar.java.ast.visitors.SubscriptionVisitor.visit(SubscriptionVisitor.java:97)
at org.sonar.java.ast.visitors.SubscriptionVisitor.visitChildren(SubscriptionVisitor.java:120)
at org.sonar.java.ast.visitors.SubscriptionVisitor.visit(SubscriptionVisitor.java:97)
at org.sonar.java.ast.visitors.SubscriptionVisitor.scanTree(SubscriptionVisitor.java:78)
at org.sonar.java.ast.visitors.SubscriptionVisitor.scanFile(SubscriptionVisitor.java:64)
at org.sonar.java.model.VisitorsBridge.visitFile(VisitorsBridge.java:120)
at org.sonar.java.ast.JavaAstScanner.simpleScan(JavaAstScanner.java:84)
... 39 more
ERROR:
ERROR: Re-run SonarQube Runner using the -X switch to enable full debug logging.
Build step 'Execute SonarQube Scanner' marked build as failure
[BFA] Scanning build for known causes...
[BFA] No failure causes found
[BFA] Done. 0s
Notifying upstream projects of job completion
Finished: FAILURE
Is there anything I missed out

May have been answered in SonarQube is unable to analyze file (NullPointerException), depending on the version of sonar-java plugin you are using.

Related

Sonar Scanner null pointer error while run sonar-scanner.bat file

I am getting null pointer exception after executing sonar-scanner.bat file in windows terminal for java mutliple application. I added path in sonar-scanner
INFO: EXECUTION FAILURE INFO:
------------------------------------------------------------------------ INFO: Total time: 25.283s INFO: Final Memory: 15M/57M INFO:
------------------------------------------------------------------------ ERROR: Error during SonarScanner execution
java.lang.NullPointerException
at org.sonarsource.scm.git.GitScmProviderBefore77.revisionId(GitScmProviderBefore77.java:173)
at org.sonar.scanner.scm.ScmRevisionImpl.get(ScmRevisionImpl.java:62)
at org.sonar.scanner.report.MetadataPublisher.addScmInformation(MetadataPublisher.java:153)
at org.sonar.scanner.report.MetadataPublisher.publish(MetadataPublisher.java:105)
at org.sonar.scanner.report.ReportPublisher.generateReportFile(ReportPublisher.java:152)
at org.sonar.scanner.report.ReportPublisher.execute(ReportPublisher.java:138)
at org.sonar.scanner.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:366)
at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:136)
at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:122)
at org.sonar.scanner.bootstrap.GlobalContainer.doAfterStart(GlobalContainer.java:141)
at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:136)
at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:122)
at org.sonar.batch.bootstrapper.Batch.doExecute(Batch.java:73)
at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:67)
at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:46)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native
Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown
Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown
Source)
at java.base/java.lang.reflect.Method.invoke(Unknown Source)
at org.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:60)
at com.sun.proxy.$Proxy0.execute(Unknown Source)
at org.sonarsource.scanner.api.EmbeddedScanner.doExecute(EmbeddedScanner.java:189)
at org.sonarsource.scanner.api.EmbeddedScanner.execute(EmbeddedScanner.java:138)
at org.sonarsource.scanner.cli.Main.execute(Main.java:126)
at org.sonarsource.scanner.cli.Main.execute(Main.java:81)
at org.sonarsource.scanner.cli.Main.main(Main.java:62) ERROR: ERROR: Re-run SonarScanner using the -X switch to enable full debug
logging.
I am using below given version of sonarqube and sonarscanner.
sonarqube-7.8
sonar-scanner-cli-4.8.0.2856-windows
I am trying to get the testing report for my application in SonarQube(localhost :9000).
Any help is appreciated, and if there is more information needed I will provide it.
Thanks.
The scanner fails if it can’t find a HEAD reference when running a scan with git. Can you try commit something and try this again? Alternatively, if there is no HEAD, just specify -Dsonar.scm.disabled=true.
Source: https://community.sonarsource.com/t/nullpointerexception-when-running-scan/15598/4

java.lang.NoSuchMethodError: org.sonar.api.resources.Project.getConfiguration()Lorg/apache/commons/configuration/Configuration

Hi I am getting the below error when running sonarqube analysis on the java project and trying to get the PDF report of it. The sonarqube analysis is run though Jenkins Job and the analysis runs fine but below error is displaying during PDF report generation of the analysis. Can anyone please help on this?
Using: sonarqube5.6, java8, jenkins 2.46, sonar-pdfreport-plugin-1.4
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: java.lang.NoSuchMethodError: org.sonar.api.resources.Project.getConfiguration()Lorg/apache/commons/configuration/Configuration;
at org.sonar.report.pdf.batch.PDFPostJob.shouldExecuteOnProject(PDFPostJob.java:57)
at org.sonar.batch.bootstrap.BatchExtensionDictionnary.shouldKeep(BatchExtensionDictionnary.java:260)
at org.sonar.batch.bootstrap.BatchExtensionDictionnary.getFilteredExtensions(BatchExtensionDictionnary.java:101)
at org.sonar.batch.bootstrap.BatchExtensionDictionnary.select(BatchExtensionDictionnary.java:74)
at org.sonar.batch.phases.PostJobsExecutor.execute(PostJobsExecutor.java:52)
Thanks.
Any
The Sonar pdfreport plugin page states, that pdfreport 1.4 is compatible with SonarQube versions 4.5.1-4.5.7.

JavaFX Graphics Device initialization failed for : es2, sw

So I made small JavaFX project that runs fine in IDE. But when exported in runnable jar in does not run on double click.
In terminal I get following error. I am running Ubuntu 15.04 on 64bit system.
I already did a lot of google search and installed both GTK3 and GTK2 libraries.
I am aware that this is copy of this question but I think it is outdated and non of the methods there have helped me.
I tried adding external jars to my project as gtk.jar, swt.jar, swt-gtk-java3.8.jar and installed every possible library like libswt-gtk-3-java, libgtk2.0, libgtk2.0-dev, libswt-gtk-java-2, libgtk-3-dev, libgtk-3 and libswt-gtk-4-java.
Bellow is detailed error message in terminal using flag -Dprism.verbose=true.
Prism pipeline init order: es2 sw
Using java-based Pisces rasterizer
Using dirty region optimizations
Not using texture mask for primitives
Not forcing power of 2 sizes for textures
Using hardware CLAMP_TO_ZERO mode
Opting in for HiDPI pixel scaling
Prism pipeline name = com.sun.prism.es2.ES2Pipeline
Loading ES2 native library ... prism_es2
GraphicsPipeline.createPipeline failed for com.sun.prism.es2.ES2Pipeline
java.lang.UnsatisfiedLinkError: Can't load library: /home/nemanja/amd64/libprism_es2.so
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1827)
at java.lang.Runtime.load0(Runtime.java:809)
at java.lang.System.load(System.java:1086)
at com.sun.glass.utils.NativeLibLoader.loadLibraryFullPath(NativeLibLoader.java:201)
at com.sun.glass.utils.NativeLibLoader.loadLibraryInternal(NativeLibLoader.java:94)
at com.sun.glass.utils.NativeLibLoader.loadLibrary(NativeLibLoader.java:39)
at com.sun.prism.es2.ES2Pipeline.lambda$static$464(ES2Pipeline.java:68)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.prism.es2.ES2Pipeline.<clinit>(ES2Pipeline.java:50)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:264)
at com.sun.prism.GraphicsPipeline.createPipeline(GraphicsPipeline.java:187)
at com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.init(QuantumRenderer.java:91)
at com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.run(QuantumRenderer.java:124)
at java.lang.Thread.run(Thread.java:745)
*** Fallback to Prism SW pipeline
Prism pipeline name = com.sun.prism.sw.SWPipeline
GraphicsPipeline.createPipeline failed for com.sun.prism.sw.SWPipeline
java.lang.UnsatisfiedLinkError: Can't load library: /home/nemanja/amd64/libprism_sw.so
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1827)
at java.lang.Runtime.load0(Runtime.java:809)
at java.lang.System.load(System.java:1086)
at com.sun.glass.utils.NativeLibLoader.loadLibraryFullPath(NativeLibLoader.java:201)
at com.sun.glass.utils.NativeLibLoader.loadLibraryInternal(NativeLibLoader.java:94)
at com.sun.glass.utils.NativeLibLoader.loadLibrary(NativeLibLoader.java:39)
at com.sun.prism.sw.SWPipeline.lambda$static$472(SWPipeline.java:42)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.prism.sw.SWPipeline.<clinit>(SWPipeline.java:41)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:264)
at com.sun.prism.GraphicsPipeline.createPipeline(GraphicsPipeline.java:187)
at com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.init(QuantumRenderer.java:91)
at com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.run(QuantumRenderer.java:124)
at java.lang.Thread.run(Thread.java:745)
Graphics Device initialization failed for : es2, sw
Error initializing QuantumRenderer: no suitable pipeline found
java.lang.RuntimeException: java.lang.RuntimeException: Error initializing QuantumRenderer: no suitable pipeline found
at com.sun.javafx.tk.quantum.QuantumRenderer.getInstance(QuantumRenderer.java:280)
at com.sun.javafx.tk.quantum.QuantumToolkit.init(QuantumToolkit.java:221)
at com.sun.javafx.tk.Toolkit.getToolkit(Toolkit.java:205)
at com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:209)
at com.sun.javafx.application.LauncherImpl.startToolkit(LauncherImpl.java:675)
at com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(LauncherImpl.java:337)
at com.sun.javafx.application.LauncherImpl.launchApplication(LauncherImpl.java:328)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at sun.launcher.LauncherHelper$FXHelper.main(LauncherHelper.java:767)
Caused by: java.lang.RuntimeException: Error initializing QuantumRenderer: no suitable pipeline found
at com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.init(QuantumRenderer.java:94)
at com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.run(QuantumRenderer.java:124)
at java.lang.Thread.run(Thread.java:745)
Exception in thread "main" java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at sun.launcher.LauncherHelper$FXHelper.main(LauncherHelper.java:767)
Caused by: java.lang.RuntimeException: No toolkit found
at com.sun.javafx.tk.Toolkit.getToolkit(Toolkit.java:217)
at com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:209)
at com.sun.javafx.application.LauncherImpl.startToolkit(LauncherImpl.java:675)
at com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(LauncherImpl.java:337)
at com.sun.javafx.application.LauncherImpl.launchApplication(LauncherImpl.java:328)
... 5 more
Short version
Graphics Device initialization failed for : es2, sw
Error initializing QuantumRenderer: no suitable pipeline found
java.lang.RuntimeException: java.lang.RuntimeException: Error initializing QuantumRenderer: no suitable pipeline found
at com.sun.javafx.tk.quantum.QuantumRenderer.getInstance(QuantumRenderer.java:280)
at com.sun.javafx.tk.quantum.QuantumToolkit.init(QuantumToolkit.java:221)
at com.sun.javafx.tk.Toolkit.getToolkit(Toolkit.java:205)
at com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:209)
at com.sun.javafx.application.LauncherImpl.startToolkit(LauncherImpl.java:675)
at com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(LauncherImpl.java:337)
at com.sun.javafx.application.LauncherImpl.launchApplication(LauncherImpl.java:328)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at sun.launcher.LauncherHelper$FXHelper.main(LauncherHelper.java:767)
Caused by: java.lang.RuntimeException: Error initializing QuantumRenderer: no suitable pipeline found
at com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.init(QuantumRenderer.java:94)
at com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.run(QuantumRenderer.java:124)
at java.lang.Thread.run(Thread.java:745)
Exception in thread "main" java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at sun.launcher.LauncherHelper$FXHelper.main(LauncherHelper.java:767)
Caused by: java.lang.RuntimeException: No toolkit found
at com.sun.javafx.tk.Toolkit.getToolkit(Toolkit.java:217)
at com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:209)
at com.sun.javafx.application.LauncherImpl.startToolkit(LauncherImpl.java:675)
at com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(LauncherImpl.java:337)
at com.sun.javafx.application.LauncherImpl.launchApplication(LauncherImpl.java:328)
... 5 more
What's (probably) going wrong
To build executable jar,i use Eclipse export project,runnable jar,package required libraries into jar
Don't use the "package required libraries into jar" to package JavaFX applications. I am not an Eclipse user, but that sounded like a weird option (standard Java packaging does not include library jar files inside your application jar files). So I googled what that option is and came up with this:
Difference between extracting and packaging libraries into a jar file
It seems that the option actually does place libraries inside your application jar and creates some kind of custom class loading system in order to use them.
My guess is that you might have added the jfxrt.jar file as a library file in Eclipse and then it is exported and added to your application jar file by the "package required libraries into jar" option. However jfxrt.jar is not a stand-alone thing, it is not designed to be used outside the directory of the java runtime installation. jfxrt.jar requires binary files (e.g. .so files on unix or .dll files on windows) that interface to the graphics system of the OS in order for JavaFX to function correctly. So you really should not be trying to extract it and use it outside of a JRE installation or a self-contained application.
Solution
What you should do instead is to package your application using any of:
e(fx)clipse packaging.
javafx maven packaging.
javafx ant packaging or the javapackager tool.

SONARCLIPS 3.5.0 Invalid value of sonar.libraries IllegalStateException: No files nor directories matching Eclipse Mars

Should a new "Invalid value of sonar.libraries / IllegalStateException: No files nor directories matching" defect be reported against the SONARCLIPS 3.5. Or should I try to get defect SONARCLIPS-430 already fixed in SonarQube Eclipse Plugin 3.5 re-opened?
In Eclipse Mars (4.5.0) when I try to use SonarQube Eclipse Plugin 3.5.0.20150804 to analyze a project, it fails with the error
Invalid value of sonar.libraries
and the caused by exception
IllegalStateException: No files nor directories matching [...]
According to SONARCLIPS-430, SonarQube Eclipse 3.5 fixed this issue. But I'm running 3.5 and still encountering the problem. I'm not using Groovy for this project and SONARCLIPS-430 resulted from the stackoverflow question about groovy and SonarQube Eclipse: Sonar Eclipse issue.
The sonar.libraries involved in this analysis is (copied from sonar-project2243985040659442672.properties):
sonar.libraries=C:\tool\Java\jdk1.8.0_51\jre\lib\resources.jar,C:\tool\Java\jdk1.8.0_51\jre\lib\rt.jar,C:\tool\Java\jdk1.8.0_51\jre\lib\jsse.jar,C:\tool\Java\jdk1.8.0_51\jre\lib\jce.jar,C:\tool\Java\jdk1.8.0_51\jre\lib\charsets.jar,C:\tool\Java\jdk1.8.0_51\jre\lib\jfr.jar,C:\tool\Java\jdk1.8.0_51\jre\lib\ext\access-bridge-64.jar,C:\tool\Java\jdk1.8.0_51\jre\lib\ext\cldrdata.jar,C:\tool\Java\jdk1.8.0_51\jre\lib\ext\dnsns.jar,C:\tool\Java\jdk1.8.0_51\jre\lib\ext\jaccess.jar,C:\tool\Java\jdk1.8.0_51\jre\lib\ext\jfxrt.jar,C:\tool\Java\jdk1.8.0_51\jre\lib\ext\localedata.jar,C:\tool\Java\jdk1.8.0_51\jre\lib\ext\nashorn.jar,C:\tool\Java\jdk1.8.0_51\jre\lib\ext\sunec.jar,C:\tool\Java\jdk1.8.0_51\jre\lib\ext\sunjce_provider.jar,C:\tool\Java\jdk1.8.0_51\jre\lib\ext\sunmscapi.jar,C:\tool\Java\jdk1.8.0_51\jre\lib\ext\sunpkcs11.jar,C:\tool\Java\jdk1.8.0_51\jre\lib\ext\zipfs.jar,C:/dev/prodtrunk/someProduct/PhysView/PhysViewApi/target/classes,C:/dev/prodtrunk/someProduct/Configuration/ConfigurationStructure/target/classes,C:/dev/prodtrunk/someProduct/Configuration/ConfigurationStructure/target/test-classes,C:\mvnrepo\junit\junit\4.12\junit-4.12.jar,C:\mvnrepo\org\hamcrest\hamcrest-core\1.3\hamcrest-core-1.3.jar,C:\mvnrepo\log4j\log4j\1.2.17\log4j-1.2.17.jar,C:\mvnrepo\org\osgi\org.osgi.compendium\5.0.0\org.osgi.compendium-5.0.0.jar,C:\mvnrepo\org\osgi\org.osgi.core\5.0.0\org.osgi.core-5.0.0.jar,C:/dev/prodtrunk/someProduct/DeviceStructure/target/classes,C:/dev/prodtrunk/someProduct/DeviceStructure/target/test-classes,C:\mvnrepo\org\slf4j\slf4j-api\1.6.6\slf4j-api-1.6.6.jar,C:/dev/prodtrunk/JavaCommon/target/classes,C:/dev/prodtrunk/JavaCommon/target/test-classes,C:\mvnrepo\jython\jython\2.1\jython-2.1.jar,C:\mvnrepo\commons-codec\commons-codec\1.7\commons-codec-1.7.jar,C:\mvnrepo\commons-logging\commons-logging\1.1.1\commons-logging-1.1.1.jar,C:\mvnrepo\commons-cli\commons-cli\1.0\commons-cli-1.0.jar,C:/dev/prodtrunk/someProduct/Logging/Logging/target/classes,C:\mvnrepo\commons-lang\commons-lang\2.5\commons-lang-2.5.jar,C:\mvnrepo\commons-collections\commons-collections\3.2.1\commons-collections-3.2.1.jar,C:\mvnrepo\org\easymock\easymock\3.3.1\easymock-3.3.1.jar,C:\mvnrepo\cglib\cglib\3.1\cglib-3.1.jar,C:\mvnrepo\org\ow2\asm\asm\5.0.3\asm-5.0.3.jar,C:\mvnrepo\org\objenesis\objenesis\2.1\objenesis-2.1.jar,C:/dev/prodtrunk/someProduct/someProductCommon/target/classes,C:\mvnrepo\org\knopflerfish\bundle\desktop\5.0.1\desktop-5.0.1.jar,C:\mvnrepo\com\somecompany\someproduct\ActionProcessing\7.0.0.0-SNAPSHOT\ActionProcessing-7.0.0.0-SNAPSHOT.jar,C:/dev/prodtrunk/someProduct/CircuitManagement/CircuitStructure/target/classes,C:/dev/prodtrunk/someProduct/CircuitManagement/CircuitStructure/target/test-classes,C:/dev/prodtrunk/someProduct/JavaCommon_Bundle/target/classes,C:\mvnrepo\org\hibernate\hibernate-envers\3.6.4.Final\hibernate-envers-3.6.4.Final.jar,C:\mvnrepo\org\hibernate\hibernate-core\3.6.4.Final\hibernate-core-3.6.4.Final.jar,C:\mvnrepo\antlr\antlr\2.7.6\antlr-2.7.6.jar,C:\mvnrepo\dom4j\dom4j\1.6.1\dom4j-1.6.1.jar,C:\mvnrepo\javax\transaction\jta\1.1\jta-1.1.jar,C:\mvnrepo\org\hibernate\hibernate-commons-annotations\3.2.0.Final\hibernate-commons-annotations-3.2.0.Final.jar,C:\mvnrepo\org\hibernate\hibernate-entitymanager\3.6.4.Final\hibernate-entitymanager-3.6.4.Final.jar,C:\mvnrepo\cglib\cglib\2.2\cglib-2.2.jar,C:\mvnrepo\asm\asm\3.1\asm-3.1.jar,C:\mvnrepo\javassist\javassist\3.12.0.GA\javassist-3.12.0.GA.jar,C:\mvnrepo\org\hibernate\hibernate-tools\3.2.0.ga\hibernate-tools-3.2.0.ga.jar,C:\mvnrepo\org\beanshell\bsh\2.0b4\bsh-2.0b4.jar,C:\mvnrepo\freemarker\freemarker\2.3.8\freemarker-2.3.8.jar,C:\mvnrepo\org\hibernate\jtidy\r8-20060801\jtidy-r8-20060801.jar,C:\mvnrepo\org\hibernate\javax\persistence\hibernate-jpa-2.0-api\1.0.0.Final\hibernate-jpa-2.0-api-1.0.0.Final.jar,C:/dev/prodtrunk/someProduct/DatabaseCommon/target/classes,C:/dev/prodtrunk/someProduct/LegacyCommunicationsApi/target/classes,C:/dev/prodtrunk/someProduct/Automation/automation-common/target/classes,C:/dev/prodtrunk/someProduct/DSLink_bundle/target/classes,C:\mvnrepo\org\iot-dsa\dslink\0.8.0\dslink-0.8.0.jar,C:\mvnrepo\org\iot-dsa\logging\0.8.0\logging-0.8.0.jar,C:\mvnrepo\org\iot-dsa\runtime_shared\0.8.0\runtime_shared-0.8.0.jar,C:\mvnrepo\io\vertx\vertx-core\2.1.5\vertx-core-2.1.5.jar,C:\mvnrepo\com\fasterxml\jackson\core\jackson-databind\2.2.2\jackson-databind-2.2.2.jar,C:\mvnrepo\com\fasterxml\jackson\core\jackson-annotations\2.2.2\jackson-annotations-2.2.2.jar,C:\mvnrepo\com\fasterxml\jackson\core\jackson-core\2.2.2\jackson-core-2.2.2.jar,C:\mvnrepo\io\netty\netty-all\4.0.21.Final\netty-all-4.0.21.Final.jar,C:\mvnrepo\com\beust\jcommander\1.48\jcommander-1.48.jar,C:\mvnrepo\org\bouncycastle\bcprov-jdk15on\1.51\bcprov-jdk15on-1.51.jar,C:/dev/prodtrunk/someProduct/someProductSystem/someProductSystemApi/target/classes,C:/dev/prodtrunk/PersistenceService/PersistenceService/target/classes,C:/dev/prodtrunk/PersistenceService/PersistenceService/target/test-classes,C:/dev/prodtrunk/ServiceManagement/ServiceManagement/target/classes,C:/dev/prodtrunk/SecretStuff/SecretStuff/target/classes,C:/dev/prodtrunk/SecretStuff/SecretStuff/target/test-classes,C:\mvnrepo\com\somecompany\someproduct\communication\Communication\7.0.0.0-SNAPSHOT\Communication-7.0.0.0-SNAPSHOT.jar,C:\mvnrepo\org\jacorb\jacorb\3.1\jacorb-3.1.jar,C:\mvnrepo\tanukisoft\wrapper\3.5.4\wrapper-3.5.4.jar,C:\mvnrepo\com\sun\xml\bind\jaxb-impl\2.1.5\jaxb-impl-2.1.5.jar,C:\mvnrepo\javax\xml\bind\jaxb-api\2.1\jaxb-api-2.1.jar,C:\mvnrepo\javax\activation\activation\1.1\activation-1.1.jar,C:\mvnrepo\javax\xml\stream\stax-api\1.0-2\stax-api-1.0-2.jar,C:\mvnrepo\org\slf4j\slf4j-log4j12\1.6.6\slf4j-log4j12-1.6.6.jar,C:/dev/prodtrunk/someProduct/Faults/FaultServiceApi/target/classes,C:/dev/prodtrunk/someProduct/Persistence/target/classes,C:\mvnrepo\org\knopflerfish\bundle\remoteserviceadmin-API\1.0.0\remoteserviceadmin-API-1.0.0.jar,C:\mvnrepo\javax\servlet\servlet-api\2.4\servlet-api-2.4.jar,C:/dev/prodtrunk/someProduct/Automation/automation-service/target/classes,C:/dev/prodtrunk/someProduct/Automation/automation-service/target/test-classes,C:/dev/prodtrunk/someProduct/Configuration/ConfigurationManagement/target/classes,C:\mvnrepo\org\hibernate\hibernate-c3p0\3.6.4.Final\hibernate-c3p0-3.6.4.Final.jar,C:\mvnrepo\c3p0\c3p0\0.9.1\c3p0-0.9.1.jar,C:/dev/prodtrunk/someProduct/Hibernate/target/classes,C:\mvnrepo\org\postgresql\postgresql\9.2-1003-jdbc4\postgresql-9.2-1003-jdbc4.jar,C:\mvnrepo\mysql\mysql-connector-java\5.1.12\mysql-connector-java-5.1.12.jar,C:\mvnrepo\org\codehaus\groovy\groovy-all\2.0.2\groovy-all-2.0.2.jar,C:/dev/prodtrunk/someProduct/LegacyCommunications/target/classes,C:/dev/prodtrunk/someProduct/LegacyCommunications/target/test-classes,C:/dev/prodtrunk/someProduct/PanelManager/target/classes,C:/dev/prodtrunk/someProduct/PanelManager/target/test-classes,C:\mvnrepo\org\knopflerfish\bundle\console\4.0.1\console-4.0.1.jar,C:\mvnrepo\org\knopflerfish\log-API\5.0.0\log-API-5.0.0.jar,C:/dev/prodtrunk/someProduct/Users/UserServiceApi/target/classes,C:/dev/prodtrunk/someProduct/TerminalArbitration/terminalarbitration-common/target/classes,C:/dev/prodtrunk/someProduct/SecretStuffService/target/classes,C:\mvnrepo\com\eclipsesource\jaxrs\publisher\5.0\publisher-5.0.jar,C:\mvnrepo\com\eclipsesource\jaxrs\jersey-all\2.18\jersey-all-2.18.jar
The full exception emitted is
08:57:06.276 ERROR - Invalid value of sonar.libraries for com.somecompany.someproduct.physview:PhysViewImpl
Exception in thread "main" 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.impl.BatchLauncherMain.execute(BatchLauncherMain.java:41)
at org.sonar.runner.impl.BatchLauncherMain.main(BatchLauncherMain.java:59)
Caused by: java.lang.IllegalStateException: No files nor directories matching 'C:/dev/prodtrunk/someProduct/Configuration/ConfigurationStructure/target/test-classes' in directory C:\dev\prodtrunk\someProduct\PhysView\PhysViewImpl
at org.sonar.batch.scan.ProjectReactorBuilder.validateDirectories(ProjectReactorBuilder.java:302)
at org.sonar.batch.scan.ProjectReactorBuilder.defineProject(ProjectReactorBuilder.java:131)
at org.sonar.batch.scan.ProjectReactorBuilder.execute(ProjectReactorBuilder.java:114)
at org.sonar.batch.scan.ProjectScanContainer.projectBootstrap(ProjectScanContainer.java:114)
at org.sonar.batch.scan.ProjectScanContainer.doBeforeStart(ProjectScanContainer.java:92)
at org.sonar.api.platform.ComponentContainer.startComponents(ComponentContainer.java:90)
at org.sonar.api.platform.ComponentContainer.execute(ComponentContainer.java:77)
at org.sonar.batch.scan.ScanTask.scan(ScanTask.java:64)
at org.sonar.batch.scan.ScanTask.execute(ScanTask.java:51)
at org.sonar.batch.bootstrap.TaskContainer.doAfterStart(TaskContainer.java:110)
at org.sonar.api.platform.ComponentContainer.startComponents(ComponentContainer.java:92)
at org.sonar.api.platform.ComponentContainer.execute(ComponentContainer.java:77)
at org.sonar.batch.bootstrap.BootstrapContainer.executeTask(BootstrapContainer.java:185)
at org.sonar.batch.bootstrapper.Batch.executeTask(Batch.java:95)
at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:67)
at org.sonar.runner.batch.IsolatedLauncher.execute(IsolatedLauncher.java:48)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.sonar.runner.impl.BatchLauncher$1.delegateExecution(BatchLauncher.java:87)
... 6 more
Julien's comment led to the answer. For some reason, we had a maven project with an empty src/test/java. Once, I deleted src/test and src/java, the error went away.

Issue with Jenkins Junit cases running with maven

from last few week, I am facing a strange issue regarding the junit test case in the jenkins, when I say strange the same workspace if I try to run from the command prompt working fine and execute the junit test case but when running with jenkin it is throwing error for junit as test case UNC paths are not supported. Defaulting to Windows directory. and lso class not found. and the error is:
[INFO] --- maven-surefire-plugin:2.7.2:test (default-test) # projectdemo ---
[INFO] Surefire report directory: MBP\workspace\target\surefire-reports
MBP\workspace'
CMD.EXE was started with the above path as the current directory.
UNC paths are not supported. Defaulting to Windows directory.
java.lang.reflect.UndeclaredThrowableException
at com.sun.proxy.$Proxy0.invoke(Unknown Source)
at org.apache.maven.surefire.booter.SurefireStarter.invokeProvider(SurefireStarter.java:150)
at org.apache.maven.surefire.booter.SurefireStarter.runSuitesInProcess(SurefireStarter.java:91)
at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:69)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.apache.maven.surefire.booter.ProviderFactory$ClassLoaderProxy.invoke(ProviderFactory.java:103)
... 4 more
Caused by: java.lang.RuntimeException: Unable to create test class 'com.db.proj.demo.services.integration.impl.test.TestImpl'
at org.apache.maven.surefire.util.DefaultDirectoryScanner.loadClass(DefaultDirectoryScanner.java:109)
at org.apache.maven.surefire.util.DefaultDirectoryScanner.locateTestClasses(DefaultDirectoryScanner.java:78)
at org.apache.maven.surefire.junit4.JUnit4Provider.scanClassPath(JUnit4Provider.java:164)
at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:86)
... 9 more
Caused by: java.lang.ClassNotFoundException: com.db.proj.demo.services.integration.impl.test.TestImpl
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
at org.apache.maven.surefire.util.DefaultDirectoryScanner.loadClass(DefaultDirectoryScanner.java:105)
... 12 more
[ERROR] There are test failures.
Please refer to MBP\workspace\target\surefire-reports for the individual test results.
It is working fine till few day backs, but I don't if anything else need to declared for junit to pass in jenkin.
Note: I have declared a maven project in jenkin with svn as source repository.
In my humble opinion, the error is clear: java.lang.ClassNotFoundException: com.db.proj.demo.services.integration.impl.test.TestImpl
You should revise that in your svn repository the TestImpl class changes has been committed. If the problem persists, try to configure your Jenkins project to an older version in which you are sure it used to compile fine. Step by step, you are likely to find out what problem has been introduced, but it is bound to be related to a non-commit class.

Categories

Resources