Error while trying to run sonar scanner

Hi. I started to use Sonarqube today and I’m trying to scan a java project using sonar-scanner.
I’ve already created the file sonar-scanner.properties in my project folder and my Sonarqube server is running.

When I used CMD to run the scanner, it showed me this error:

INFO: Scanner configuration file: C:\sonar-scanner-3.2.0.1227-windows\bin\..\con
f\sonar-scanner.properties
INFO: Project root configuration file: C:\b2b\hybris\bin\custom\b2bsappricing\so
nar-project.properties
INFO: SonarQube Scanner 3.2.0.1227
INFO: Java 1.8.0_121 Oracle Corporation (64-bit)
INFO: Windows 7 6.1 amd64
INFO: User cache: C:\Users\santl60\.sonar\cache
INFO: SonarQube server 6.7.4
INFO: Default locale: "pt_BR", source code encoding: "UTF-8"
INFO: Publish mode
INFO: Load global settings
INFO: Load global settings (done) | time=93ms
INFO: Server id: AWTNCr_uQVKYyDlHI7DE
INFO: User cache: C:\Users\santl60\.sonar\cache
INFO: Load plugins index
INFO: Load plugins index (done) | time=79ms
INFO: Process project properties
INFO: Load project repositories
INFO: Load project repositories (done) | time=12ms
INFO: Load quality profiles
INFO: Load quality profiles (done) | time=36ms
INFO: Load active rules
INFO: Load active rules (done) | time=580ms
INFO: Load metrics repository
INFO: Load metrics repository (done) | time=36ms
WARN: SCM provider autodetection failed. No SCM provider claims to support this
project. Please use sonar.scm.provider to define SCM of your project.
INFO: Project key: b2bsappricing
INFO: -------------  Scan b2bsappricing
INFO: Load server rules
INFO: Load server rules (done) | time=241ms
INFO: Base dir: C:\b2b\hybris\bin\custom\b2bsappricing
INFO: Working dir: C:\b2b\hybris\bin\custom\b2bsappricing\.scannerwork
INFO: Source paths: .
INFO: Source encoding: UTF-8, default locale: pt_BR
INFO: Language is forced to java
INFO: Index files
WARN: File 'C:\b2b\hybris\bin\custom\b2bsappricing\.classpath' is ignored becaus
e it doesn't belong to the forced language 'java'
WARN: File 'C:\b2b\hybris\bin\custom\b2bsappricing\.springBeans' is ignored beca
use it doesn't belong to the forced language 'java'
WARN: File 'C:\b2b\hybris\bin\custom\b2bsappricing\build.xml' is ignored because
 it doesn't belong to the forced language 'java'
WARN: File 'C:\b2b\hybris\bin\custom\b2bsappricing\buildcallbacks.xml' is ignore
d because it doesn't belong to the forced language 'java'
WARN: File 'C:\b2b\hybris\bin\custom\b2bsappricing\classes\b2bsappricing\Generat
edTypeInitializer.class' is ignored because it doesn't belong to the forced lang
uage 'java'
WARN: File 'C:\b2b\hybris\bin\custom\b2bsappricing\.project' is ignored because
it doesn't belong to the forced language 'java'
WARN: File 'C:\b2b\hybris\bin\custom\b2bsappricing\.pmd' is ignored because it d
oesn't belong to the forced language 'java'
WARN: File 'C:\b2b\hybris\bin\custom\b2bsappricing\classes\de\hybris\platform\sa
p\b2bsappricing\constants\B2bsappricingConstants.class' is ignored because it do
esn't belong to the forced language 'java'
WARN: File 'C:\b2b\hybris\bin\custom\b2bsappricing\classes\de\hybris\platform\sa
p\b2bsappricing\B2bsappricingStandalone.class' is ignored because it doesn't bel
ong to the forced language 'java'
WARN: File 'C:\b2b\hybris\bin\custom\b2bsappricing\classes\de\hybris\platform\sa
p\b2bsappricing\jalo\B2bsappricingTest.class' is ignored because it doesn't belo
ng to the forced language 'java'
WARN: File 'C:\b2b\hybris\bin\custom\b2bsappricing\classes\de\hybris\platform\sa
p\b2bsappricing\jalo\B2bsappricingManager.class' is ignored because it doesn't b
elong to the forced language 'java'
WARN: File 'C:\b2b\hybris\bin\custom\b2bsappricing\classes\de\hybris\platform\sa
p\b2bsappricing\constants\GeneratedB2bsappricingConstants.class' is ignored beca
use it doesn't belong to the forced language 'java'
WARN: File 'C:\b2b\hybris\bin\custom\b2bsappricing\classes\de\hybris\platform\sa
p\b2bsappricing\jalo\GeneratedB2bsappricingManager.class' is ignored because it
doesn't belong to the forced language 'java'
WARN: File 'C:\b2b\hybris\bin\custom\b2bsappricing\classes\de\hybris\platform\sa
p\b2bsappricing\services\impl\DefaultB2BSapPartnerService.class' is ignored beca
use it doesn't belong to the forced language 'java'
WARN: File 'C:\b2b\hybris\bin\custom\b2bsappricing\extensioninfo.xml' is ignored
 because it doesn't belong to the forced language 'java'
WARN: File 'C:\b2b\hybris\bin\custom\b2bsappricing\extensioninfo.xsd' is ignored
 because it doesn't belong to the forced language 'java'
WARN: File 'C:\b2b\hybris\bin\custom\b2bsappricing\classes\de\hybris\platform\sa
p\b2bsappricing\services\impl\DefaultB2BSapPartnerServiceTest.class' is ignored
because it doesn't belong to the forced language 'java'
WARN: File 'C:\b2b\hybris\bin\custom\b2bsappricing\platformhome.properties' is i
gnored because it doesn't belong to the forced language 'java'
WARN: File 'C:\b2b\hybris\bin\custom\b2bsappricing\project.properties' is ignore
d because it doesn't belong to the forced language 'java'
WARN: File 'C:\b2b\hybris\bin\custom\b2bsappricing\resources\b2bsappricing\b2bsa
ppricing-testclasses.xml' is ignored because it doesn't belong to the forced lan
guage 'java'
WARN: File 'C:\b2b\hybris\bin\custom\b2bsappricing\resources\b2bsappricing\dummy
.txt' is ignored because it doesn't belong to the forced language 'java'
WARN: File 'C:\b2b\hybris\bin\custom\b2bsappricing\resources\b2bsappricing-items
.xml' is ignored because it doesn't belong to the forced language 'java'
WARN: File 'C:\b2b\hybris\bin\custom\b2bsappricing\resources\b2bsappricing-beans
.xml' is ignored because it doesn't belong to the forced language 'java'
WARN: File 'C:\b2b\hybris\bin\custom\b2bsappricing\resources\b2bsappricing-sprin
g.xml' is ignored because it doesn't belong to the forced language 'java'
WARN: File 'C:\b2b\hybris\bin\custom\b2bsappricing\resources\b2bsappricing.build
.number' is ignored because it doesn't belong to the forced language 'java'
WARN: File 'C:\b2b\hybris\bin\custom\b2bsappricing\resources\beans.xsd' is ignor
ed because it doesn't belong to the forced language 'java'
WARN: File 'C:\b2b\hybris\bin\custom\b2bsappricing\resources\items.xsd' is ignor
ed because it doesn't belong to the forced language 'java'
WARN: File 'C:\b2b\hybris\bin\custom\b2bsappricing\resources\localization\b2bsap
pricing-locales_de.properties' is ignored because it doesn't belong to the force
d language 'java'
WARN: File 'C:\b2b\hybris\bin\custom\b2bsappricing\resources\localization\b2bsap
pricing-locales_en.properties' is ignored because it doesn't belong to the force
d language 'java'
WARN: File 'C:\b2b\hybris\bin\custom\b2bsappricing\resources\localization\b2bsap
pricing-locales_es.properties' is ignored because it doesn't belong to the force
d language 'java'
WARN: File 'C:\b2b\hybris\bin\custom\b2bsappricing\resources\localization\b2bsap
pricing-locales_ja.properties' is ignored because it doesn't belong to the force
d language 'java'
WARN: File 'C:\b2b\hybris\bin\custom\b2bsappricing\resources\localization\b2bsap
pricing-locales_fr.properties' is ignored because it doesn't belong to the force
d language 'java'
WARN: File 'C:\b2b\hybris\bin\custom\b2bsappricing\resources\localization\b2bsap
pricing-locales_ko.properties' is ignored because it doesn't belong to the force
d language 'java'
WARN: File 'C:\b2b\hybris\bin\custom\b2bsappricing\resources\localization\b2bsap
pricing-locales_pt.properties' is ignored because it doesn't belong to the force
d language 'java'
WARN: File 'C:\b2b\hybris\bin\custom\b2bsappricing\resources\localization\b2bsap
pricing-locales_ru.properties' is ignored because it doesn't belong to the force
d language 'java'
WARN: File 'C:\b2b\hybris\bin\custom\b2bsappricing\resources\localization\b2bsap
pricing-locales_zh.properties' is ignored because it doesn't belong to the force
d language 'java'
WARN: File 'C:\b2b\hybris\bin\custom\b2bsappricing\ruleset.xml' is ignored becau
se it doesn't belong to the forced language 'java'
WARN: File 'C:\b2b\hybris\bin\custom\b2bsappricing\sonar-project.properties' is
ignored because it doesn't belong to the forced language 'java'
WARN: File 'C:\b2b\hybris\bin\custom\b2bsappricing\resources\localization\b2bsap
pricing-locales_it.properties' is ignored because it doesn't belong to the force
d language 'java'
INFO: 9 files indexed
INFO: Quality profile for java: EC-hybris-Java
INFO: Sensor JavaSquidSensor [java]
INFO: Configured Java source version (sonar.java.source): none
INFO: JavaClasspath initialization
INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
INFO: Total time: 9.018s
INFO: Final Memory: 15M/238M
INFO: ------------------------------------------------------------------------
ERROR: Error during SonarQube Scanner execution
ERROR: Please provide compiled classes of your project with sonar.java.binaries
property
ERROR:
ERROR: Re-run SonarQube Scanner using the -X switch to enable full debug logging

I’d like to understand how can I have this sonar.java.binaries and how to make scanner work? .

Hi,

What’s your build system? If you’re using Maven or Gradle, then you should use the relevant versions of SonarQube Scanner: SonarQube Scanner for Maven, or SonarQube Scanner for Gradle. Use either one and the path to your binaries will be configured automatically. Failing that, use the sonar.java.binaries property to point to the location of your .class files.

Ann

Whirlpool’s build system doesn’t use maven or gradle. Do you know could I do that without one of these build systems?

Lucas

Hi,

As I said before:

Ops sorry. I mesread that point.

Thanks

Good morning Ann.

I ran the scanner but it’s showing me this:

 08:43:33.870 INFO: 826/4869 files analyzed, current file: C:\b2b\hybris\bin\cust
om\hybris\config\hybris\extensions\whrnetpaypaymentaddon\src\com\whirlpool\digit
alplatform\component\renderer\NetPayTagScriptComponentRenderer.java
08:43:33.943 DEBUG: .class not found for de.hybris.platform.addonsupport.rendere
r.impl.DefaultAddOnCMSComponentRenderer
08:43:34.385 DEBUG: .class not found for de
08:43:34.812 DEBUG: .class not found for de.hybris
08:43:35.273 DEBUG: .class not found for de.hybris.platform
08:43:35.695 DEBUG: .class not found for de.hybris.platform.cms2
08:43:36.127 DEBUG: .class not found for de.hybris.platform.cms2.servicelayer
08:43:36.598 DEBUG: .class not found for de.hybris.platform.cms2.servicelayer.se
rvices
08:43:37.056 DEBUG: .class not found for de.hybris.platform.cms2.servicelayer.se
rvices.CMSComponentService
08:43:37.463 DEBUG: .class not found for de
08:43:37.900 DEBUG: .class not found for de.hybris
08:43:38.303 DEBUG: .class not found for de.hybris.platform
08:43:38.707 DEBUG: .class not found for de.hybris.platform.servicelayer
08:43:39.133 DEBUG: .class not found for de.hybris.platform.servicelayer.excepti
ons
08:43:39.609 DEBUG: .class not found for de.hybris.platform.servicelayer.excepti
ons.AttributeNotSupportedException
08:43:40.006 DEBUG: .class not found for de
08:43:40.444 DEBUG: .class not found for de.hybris
08:43:40.862 DEBUG: .class not found for de.hybris.platform
08:43:41.272 DEBUG: .class not found for de.hybris.platform.servicelayer
08:43:41.664 DEBUG: .class not found for de.hybris.platform.servicelayer.model
08:43:42.079 DEBUG: .class not found for de.hybris.platform.servicelayer.model.M
odelService

But the project that I’m analyzing has the java classes. Maybe is any configuration on sonar-project.properties?

# must be unique in a given SonarQube instance
sonar.projectKey=project:testcustom

# this is the name displayed in the SonarQube UI
sonar.projectName=custom
sonar.projectVersion=1.0

sonar.sources=.
sonar.language=java

sonar.inclusions=**/*.java
sonar.exclusions=**/*Test*.java,**/jalo/**,**/gensrc/**
sonar.java.binaries=**/classes/**

Hi,

Are those classes provided by your project or by a library?

Ann

SAP Commerce Cloud uses ant as a build system. It has its own file structure and dependency resolution mechanism. There is no official standalone scanner at this moment. I don’t know which version of the platform you are using, but newer versions provide ant targets:

  • sonar - scan all extensions
  • sonarsingle - scan single extension

I’ve never used them, but I’ll give you some hints. First open shell and go into hybris/bin/platform. Next execute ant sonarsingle with parameters:

 -Dsonar.host.url=<your-server>
 -Dsonar.login=<authentication-token or username>
 -Dsonar.password=<password> (only if you don't use the authentication token)
 -Dextensions=b2bsappricing
 -Dsonar.projectKey=project:testcustom (by default "b2bsappricingkey")
 -Dsonar.projetName=custom (by default "b2bsappricing EC-Module")
 -Dsonar.projectVersion=1.0 (be default "1.0")

Platform knows its own file structure, so it generates correct values of sonar.java.libraries, sonar.java.binaries etc.

1 Like

Hi Aga. Thank you for your help. I could successfuly scan my project (it took us 2 days scanning one singular project)
Do you know how to export the report as pdf or something like that?

5 posts were split to a new topic: Export PDF report for developers

A post was split to a new topic: Fail to download plugin [ruby]

A post was split to a new topic: Post-processing failed. Exit code: 1

onar@ubuntu:~/sonar-python/python-checks$ sonar-scanner
INFO: Scanner configuration file: /opt/sonar-scanner-4.2.0.1873-linux/conf/sonar-scanner.properties
INFO: Project root configuration file: /home/sonar/sonar-python/python-checks/sonar-project.properties
INFO: SonarQube Scanner 4.2.0.1873
INFO: Java 11.0.3 AdoptOpenJDK (64-bit)
INFO: Linux 4.15.0-70-generic amd64
INFO: User cache: /home/sonar/.sonar/cache
INFO: SonarQube server 7.7.0
INFO: Default locale: “en_US”, source code encoding: “UTF-8”
INFO: Load global settings
INFO: Load global settings (done) | time=93ms
INFO: Server id: A7EE8CF2-AW674VrKbg2BEesk0meF
INFO: User cache: /home/sonar/.sonar/cache
INFO: Load/download plugins
INFO: Load plugins index
INFO: Load plugins index (done) | time=75ms
INFO: Load/download plugins (done) | time=175ms
INFO: Process project properties
INFO: Execute project builders
INFO: Execute project builders (done) | time=11ms
INFO: Project key: 459e1b828544ceaef86dc97166f35ae9c49f1d19
INFO: Base dir: /home/sonar/sonar-python/python-checks
INFO: Working dir: /home/sonar/sonar-python/python-checks/.scannerwork
INFO: Load project settings for component key: ‘459e1b828544ceaef86dc97166f35ae9c49f1d19’
INFO: Load project repositories
INFO: Load project repositories (done) | time=9ms
INFO: Load quality profiles
INFO: Load quality profiles (done) | time=33ms
INFO: Load active rules
INFO: Load active rules (done) | time=984ms
INFO: Indexing files…
INFO: Project configuration:
INFO: 479 files indexed
INFO: 0 files ignored because of scm ignore settings
INFO: Quality profile for java: Sonar way
INFO: Quality profile for py: Sonar way
INFO: Quality profile for web: Sonar way
INFO: ------------- Run sensors on module python-checks
INFO: Load metrics repository
INFO: Load metrics repository (done) | time=62ms
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by net.sf.cglib.core.ReflectUtils$1 (file:/home/sonar/.sonar/cache/556c6247bee4506df29d82eccc325307/sonar-javascript-plugin.jar) to method java.lang.ClassLoader.defineClass(java.lang.String,byte,int,int,java.security.ProtectionDomain)
WARNING: Please consider reporting this to the maintainers of net.sf.cglib.core.ReflectUtils$1
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
INFO: Sensor JavaSquidSensor [java]
INFO: Configured Java source version (sonar.java.source): none
INFO: JavaClasspath initialization
INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
INFO: Total time: 7.115s
INFO: Final Memory: 12M/47M
INFO: ------------------------------------------------------------------------
ERROR: Error during SonarQube Scanner execution
org.sonar.java.AnalysisException: Please provide compiled classes of your project with sonar.java.binaries property
at org.sonar.java.JavaClasspath.init(JavaClasspath.java:66)
at org.sonar.java.AbstractJavaClasspath.getElements(AbstractJavaClasspath.java:280)
at org.sonar.java.SonarComponents.getJavaClasspath(SonarComponents.java:175)
at org.sonar.java.JavaSquid.(JavaSquid.java:82)
at org.sonar.plugins.java.JavaSquidSensor.execute(JavaSquidSensor.java:91)
at org.sonar.scanner.sensor.AbstractSensorWrapper.analyse(AbstractSensorWrapper.java:48)
at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:85)
at org.sonar.scanner.sensor.ModuleSensorsExecutor.lambda$execute$1(ModuleSensorsExecutor.java:59)
at org.sonar.scanner.sensor.ModuleSensorsExecutor.withModuleStrategy(ModuleSensorsExecutor.java:77)
at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:59)
at org.sonar.scanner.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:82)
at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:136)
at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:122)
at org.sonar.scanner.scan.ProjectScanContainer.scan(ProjectScanContainer.java:359)
at org.sonar.scanner.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:354)
at org.sonar.scanner.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:317)
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:128)
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:112) at org.sonarsource.scanner.cli.Main.execute(Main.java:75) at org.sonarsource.scanner.cli.Main.main(Main.java:61) ERROR: ERROR: Re-run SonarQube Scanner using the -X switch to enable full debug logging. sonar@ubuntu:~/sonar-python/python-checks

will you please guide how to resolve this

The log has the solution already.
You need to set the sonar.java.binaries property.
see https://docs.sonarqube.org/latest/analysis/languages/java/

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.