0

I've looked at SonarQube for quite a while and is now in a position where I would need it where I currently work. To begin with though, I try to install it locally and have it analyze one of our projects before committing it to a server environment. But installing SonarQube has proven to be more troublesome than first assumed.

I went to the SonarQube website to check out the documentation on how to set it up. My current setup is:

  • Windows 7 64-Bit
  • JDK 7 Update 79
  • Microsoft SQL Server 2012

So I went into the SonarQube properties to start setting it up. I got the following settings:

  • sonar.jdbc.url=jdbc:sqlserver://obscured;databaseName=sonar;integratedSecurity=true
  • sonar.jdbc.maxActive=60
  • sonar.jdbc.maxIdle=5
  • sonar.jdbc.minIdle=2
  • sonar.jdbc.maxWait=5000
  • sonar.jdbc.minEvictableIdleTimeMillis=600000
  • sonar.jdbc.timeBetweenEvictionRunsMillis=30000
  • sonar.web.host=192.0.0.1
  • sonar.web.context=/sonar
  • sonar.web.port=9000

When I try to run StartSonar.bat (as Admin) it gives me this in the sonar.log file:

--> Wrapper Started as Console
Launching a JVM...
Wrapper (Version 3.2.3) http://wrapper.tanukisoftware.org
  Copyright 1999-2006 Tanuki Software, Inc.  All Rights Reserved.

2016.04.13 10:32:08 INFO  app[o.s.p.m.JavaProcessLauncher] Launch process[search]: C:\Program Files\Java\jre7\bin\java -Djava.awt.headless=true -Xmx1G -Xms256m -Xss256k -Djava.net.preferIPv4Stack=true # -XX:+UseParNewGC -XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction=75 # -XX:+UseCMSInitiatingOccupancyOnly -XX:+HeapDumpOnOutOfMemoryError -Djava.io.tmpdir=C:\Users\smf\Documents\sonarqube-5.3\temp -cp ./lib/common/*;./lib/search/* org.sonar.search.SearchServer C:\Users\smf\AppData\Local\Temp\sq-process4147018529192614354properties
Error: Could not find or load main class #
<-- Wrapper Stopped

I am not sure why it can't find the main class. I have not done anything to alter the file structure. It has simply been extracted in Documents as it's own folder (C:\Users\smf\Documents\sonarqube-5.3).

On a side-note, I have been unable to use the Windows Service option. I can install the service, but whenever I try and start it, I'm told that the service launched but failed to start.

Simon Brandhof
  • 5,137
  • 1
  • 21
  • 28
OmniOwl
  • 5,477
  • 17
  • 67
  • 116

1 Answers1

1

It's all about the #:

Could not find or load main class #

That's because there is a # that doesn't belong there when the Java process is being launched:

-Xms256m -Xss256k -Djava.net.preferIPv4Stack=true # -XX:+UseParNewGC

And my bet is that this # comes from the following in your sonar.properties file:

sonar.search.javaOpts=-Xmx1G -Xms256m -Xss256k -Djava.net.preferIPv4Stack=true \
#  -XX:+UseParNewGC -XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction=75 \
#  -XX:+UseCMSInitiatingOccupancyOnly -XX:+HeapDumpOnOutOfMemoryError

i.e. you would have only uncommented the first line, but the trailing \ at the end of that line means that the next lines are not treated as comment but are passed as JVM options, # included.

Two solutions:

  • remove the trailing \ on the first line
  • preferred solution: uncomment the two remaining lines
Nicolas B.
  • 7,245
  • 17
  • 29