System information (Operating system, Java version, Database provider/version) Windows 10, Java 17, H2
What’s the issue you’re facing? Can´t use StartSonar.bat and run manually Sonarqube doesn´t upgrade from H2 database
Hi,
I am currently using 8.9.10 LTS with H2 database. All upgrades in the 8.x branch I have performed them copying the data folder into the new release I was upgrading to. It worked fine.
Now I am exploring the possibility of upgrading to 9.9 LTS. Being that said, I am wondering if it is option for me because I am scanning a Java 8 project.
Apart of that, I am facing several issues:
With the clean installation, I can´t run StartSonar.bat as a standalone. I can´t install any service on this machine (I am not admin). I have set JAVA_HOME, SONAR_JAVA_PATH pointing to my Java 17 bin folder but no luck. I have succesfully run it manually using:
I tried replacing the data folder with the one from 8.9.10 LTS but I got this:
WARNING: Please consider reporting this to the maintainers of org.sonar.process.PluginSecurityManager
WARNING: System::setSecurityManager will be removed in a future release
2023.05.31 15:24:08 INFO app[][o.s.a.SchedulerImpl] Process[Web Server] is stopped
2023.05.31 15:24:09 INFO app[][o.s.a.SchedulerImpl] Process[ElasticSearch] is stopped
2023.05.31 15:24:09 INFO app[][o.s.a.SchedulerImpl] SonarQube is stopped
So what are my options? I have to keep on using 8.9.10 for scanning my Java 8 project? Can I use any 9.x version?
There’s a lot here, and we try to keep it to one topic per thread. Otherwise, it can get messy, fast. I’m going to give you some answers, but reserve the right to ask you to create new threads if you have followups.
We’re very explicit that H2 is not for production use. Upgrades are not supported on H2. You should have migrated to a supported database long ago. You’ll need to start over, data-wise.
You need to talk to an admin on the box.
That’s a warning. You can ignore it.
You can still build with - or to - Java 8. You just need to run the analysis process with at least Java 11.
You should be able to start SonarQube without installing it as a service. It looks like the start command you’ve tried running manually is copied straight from the .bat file, so it’s difficult to know what’s going wrong. I would start by re-exploding the SonarQube distribution zip and getting a fresh copy of the script. If that doesn’t do it, I guess you’ll need to dig into Windows logging(?) to see what the error is.
If anyone is looking to run Sonarqube as standalone (not service), this is what I tweaked from the StartSonar.bat file:
set REALPATH=%CD%\
REM set JAVA_EXE=
REM call "%REALPATH%lib\find_java.bat" set_java_exe FAIL || goto:eof
REM call :check_if_sonar_is_running FAIL || goto:eof
set JAVA_EXE=C:\Java\jdk-17.0.7\bin\java.exe
echo Starting SonarQube...
%JAVA_EXE% -Xms8m -Xmx32m^
-Djava.awt.headless=true^
--add-exports=java.base/jdk.internal.ref=ALL-UNNAMED^
--add-opens=java.base/java.lang=ALL-UNNAMED^
--add-opens=java.base/java.nio=ALL-UNNAMED^
--add-opens=java.base/sun.nio.ch=ALL-UNNAMED^
--add-opens=java.management/sun.management=ALL-UNNAMED^
--add-opens=jdk.management/com.sun.management.internal=ALL-UNNAMED^
-cp "%REALPATH%..\..\lib\sonar-application-9.9.4.87374.jar" "org.sonar.application.App"
The variable ~dp0 didn´t work for me and I had to use %CD% which is the current directory. I had to add "" to the REALPATH variable, otherwise It won´t work.
Thanks for the feedback and I am glad you got it working. Your report is interesting as we haven’t seen too many users reporting similar issues with running the bat file on 9.9 LTS.
Do you by any chance use any special terminal or console to start the StartSonar.bat ? I am on Windows too and I couldn’t reproduce the issue you were having.