SonerQube doesnt start - ubuntu-16.04

Sonarqube Startup script does not start ob ubuntu 16.04
Error log shows:
Encountered an error running main: java.lang.IllegalStateException: SonarQube requires Java 11+ to run
java.lang.IllegalStateException: SonarQube requires Java 11+ to run
at org.sonar.application.App.checkJavaVersion(App.java:93)
at org.sonar.application.App.start(App.java:56)
at org.sonar.application.App.main(App.java:98)
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 org.tanukisoftware.wrapper.WrapperSimpleApp.run(WrapperSimpleApp.java:240)
at java.lang.Thread.run(Thread.java:748)
<-- Wrapper Stopped
--> Wrapper Started as Console
Launching a JVM...
Startup failed: Timed out waiting for a signal from the JVM.
JVM did not exit on request, terminated
JVM Restarts disabled. Shutting down.
<-- Wrapper Stopped
If i run java -version:
java version "11.0.3" 2019-04-16 LTS
Java(TM) SE Runtime Environment 18.9 (build 11.0.3+12-LTS)
Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.3+12-LTS, mixed mode)

Open conf/wrapper.conf file
Change wrapper.java.command=java to path where your JavaDK is installed eg. wrapper.java.command=C:\Program Files\Java\jdk-11.0.4\bin\java

I had the same problem a few moments ago, my JAVA_HOME variable pointed to the correct version of my profile, but when I run java -version, it printed 1.8, so I run this command:
update-java-alternatives -l
This showed me all Java versions that were installed on my machine.
After that, I run this another command:
sudo update-java-alternatives -s java-11-oracle
This changed the Java version on my machine and it works just fine.

"Warning Support for Java 8 has been deprecated in SonarQube v7.8 and will be removed in SonarQube v7.9 LTS."
checkout you java -version, and the Supported Platforms requirements: https://docs.sonarqube.org/7.7/requirements/requirements/
Then go to the downloads and choose what is the best for you:
https://www.sonarqube.org/downloads/ (Show all versions)

Check for the JRE version, I have come across the issue where the Java SDK version and JRE -version was different. That may be the issue.

Most user would like to download JDK 11 here as mentioned in recent comments. That should works.
However, I would recommend to install latest version from following link (because you have just downloaded latest sonarqube) for better compatibility.
SDK download link: https://www.oracle.com/java/technologies/javase-downloads.html

FYI,
For mac user,
Install JVM on your machine (I installed it by Homebrew).
brew cask install java
and restarted the sonar by
./sonar.sh restart
it worked for me

Related

SBT fails with `String.class is broken`

sbt fails with a cryptic error on issuing any command (compile, assembly, clean or any other).
$ sbt --version
error: error while loading String, class file '/modules/java.base/java/lang/String.class' is broken
(class java.lang.NullPointerException/null)
I am on a machine running macOS, and sbt was installed via homebrew. I have tried upgrading to the latest versions of sbt (1.3.10), but the error still persists.
The issue is documented on the SBT Download page.
Homebrew maintainers have added a dependency to JDK 13 because they want to use more brew dependencies (brew#50649). This causes sbt to use JDK 13 even when java available on PATH is JDK 8 or 11. To prevent sbt from running on JDK 13, install jEnv or switch to using SDKMAN.
I was able to resolve the problem by using JDK 8 via jEnv.
Since sbt documents JDK 8 and 11 as compatible versions
We recommend AdoptOpenJDK JDK 8 or AdoptOpenJDK JDK 11
try controlling which JDK is used by sbt via -java-home setting which can be configured system-wide via sbtopts run configuration
/usr/local/etc/sbtopts
or per-project basis via
<project-root>/.sbtopts
For example, to configure JDK used by sbt in current project, try setting in .sbtopts
-java-home /Users/picard/.sdkman/candidates/java/current
This is what solved my problem on my Mac.
brew uninstall sbt
Install sdkman
curl -s "https://get.sdkman.io" | bash
source "$HOME/.sdkman/bin/sdkman-init.sh"
Install sbt via sdk
sdk install sbt
I had the same issue recently. What worked for me is to install SDKMAN(https://sdkman.io/)
$ curl -s "https://get.sdkman.io" | bash
...
$ source "$HOME/.sdkman/bin/sdkman-init.sh"
...
After installation, I wanted to see what versions of Java I can install. So I simply run this command to list all the available versions of Java
sdk list java
Choose the version you want to install (recommend installing either 8 or 11 as mentioned above) and simply run the command with the identifier that specifies your version from the list
sdk install java 11.0.3.hs-adpt
After installation, it set the Java 11 to default on my system. I then ran the sbt command again and it worked.
If you are using SDKMAN then in some cases certain versions of Java (i.e. JDK) from different vendor might help.
E.g. I was using Amazon Correto JDK8 (version 8.332.08.1-amzn) and it could not properly build my sbt project in IntellIJ IDEA, so I've switched to using Zulu's JDK8 (version 8.0.332-zulu) as default java version.
Hope this helps and good luck. :)

Scala sbt run - "Unsupported major.minor version 52.0"

Things run without any problem when I work on IntelliJ, but when I try to compile and run my Scala code in the command line (with sbt run) the following error message pops up.
[error] (run-main-0) java.lang.UnsupportedClassVersionError: akka/event/LogSource : Unsupported major.minor version 52.0
java.lang.UnsupportedClassVersionError: akka/event/LogSource : Unsupported major.minor version 52.0
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:803)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
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 java.lang.ClassLoader.loadClass(ClassLoader.java:358)
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2625)
at java.lang.Class.getMethod0(Class.java:2866)
at java.lang.Class.getMethod(Class.java:1676)
I'm using Ubuntu 14.04 LTS.
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 14.04.5 LTS
Release: 14.04
Codename: trusty
And my Scala version is 2.9.2.
$ scalac -version
Scala compiler version 2.9.2 -- Copyright 2002-2011, LAMP/EPFL
I barely started learning Scala a few weeks ago, so if anyone could provide some advice on what I should look into, it would be greatly appreciated.
It turned out that there was a mismatch in the JRE version. In the IntelliJ project settings the project SDK was set to be Java 1.8 (on my local machine), whereas JRE 1.7 was installed on the Ubuntu system (an EC2 instance).
In Ubuntu 14.04, the OpenJDK 1.8 is not available by default so the following repository must be added manually. Then the OpenJDK can be installed.
sudo add-apt-repository ppa:openjdk-r/ppa
sudo apt-get update
sudo apt-get install openjdk-8-jre
The default Java version in the system can be changed by running the following command.
sudo update-alternatives --config java
Once I installed openjdk-8-jre and adjusted the default Java version in the system, the sbt run command ran without any issue.
I am using a Mac and trying to learn Scala by following a simple Scala tutorial. I got this error when I am trying to run the app.
Reason:
My installed java version was 8. But on my Terminal the version I was using was 7.
Fix:
I updated the java version to the newest version and then it worked.
Update to correct java version and compile again. It should work fine
I encountered the same proble with CentOS-7.6, here is my solution:
run vim /etc/profile in command line, check your Environment variable to find the jdk version, change it to jdk-1.8. Save and quit safely.
example picture
run /usr/sbin/alternatives --config java, choose version-1.8.
run /usr/sbin/alternatives --config javac, also choose version-1.8.
run source /etc/profile to make the settings work.
By doing the four steps, I was able to run command sbt again without orror.sbt picture
I suddenly started getting this error on Windows 10. Turned out my path had somehow reverted to point to an old version of the java jdk. To be thorough, I first upgraded to the latest jdk (from here for Oracle), which for me was 8u152. I then corrected my path entry to
c:\Program Files\Java\jdk1.8.0_152\bin
(This would be a little different for the 32 bit version.) I then verified that javac -version indeed returned 1.8.0_152 (make sure to open a fresh terminal - an already open one will remember the old path).
And then sbt run worked. (Again remembering to do this from a fresh terminal so path is fresh.)

Android build Ubuntu 16.04.1 required BlockingQueue

I am trying to build the Android source Build: LMY48M (android-5.1.1_r14) on Ubuntu 16.04.1
Got the following error
out/target/common/obj/JAVA_LIBRARIES/android_stubs_current_intermediates/src/java/util/concurrent/ScheduledThreadPoolExecutor.java:9: warning: [unchecked] unchecked conversion
public ScheduledThreadPoolExecutor(int corePoolSize, java.util.concurrent.ThreadFactory threadFactory, java.util.concurrent.RejectedExecutionHandler handler) { super(0,0,0,(java.util.concurrent.TimeUnit)null,(java.util.concurrent.BlockingQueue)null,(java.util.concurrent.ThreadFactory)null,(java.util.concurrent.RejectedExecutionHandler)null); throw new RuntimeException("Stub!"); }
^
required: BlockingQueue<Runnable>
found: BlockingQueue
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
#### make failed to build some targets (01:15:26 (hh:mm:ss)) ####
I am using OpenJDK-7
P.S: I was intented to build on Ubuntu 14.04, however I am using a skylake processor that doesn't have support on Ubuntu 14.04.
However, I successfully build the same Android build on a virtual box running Ubuntu 14.04 on this same machine.
Any help is appreciated.
Update#2
By following #Nir Duan suggestion, I am using OracleJDK7. but as soon I run make -j32 I am getting this error,
You asked for an OpenJDK 7 build but your version is
java version "1.7.0_80" Java(TM) SE Runtime Environment (build 1.7.0_80-b15) Java HotSpot(TM) 64-Bit Server VM (build 24.80-b11, mixed mode).
************************************************************
build/core/main.mk:191: *** stop. Stop.
You're problem is because you need Oracle JDK7 and not OpenJDK-7 when building the source.
Use these commands:
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java7-installer
The result of $ java -version should be this:
java version "1.7.0_80"
Java(TM) SE Runtime Environment (build 1.7.0_80-b15)
Java HotSpot(TM) 64-Bit Server VM (build 24.80-b11, mixed mode)
(If not look here and change default java version)

Install New Software on Eclipse not working on Mac

I have downloaded eclipse classic x86_64 3.7 cocoa on my Mac Intel Core 2 Duo with snow leopard 10.6.8
I have extracted and copied the eclipse directory to Applications folder. When run,
I get following errors
System property http.nonProxyHosts has been set to local|*.local|169.254/16|*.169.254/16 by an external source. This value will be overwritten using the values from the preferences
Unexpected error loading extension: org.eclipse.equinox.p2.metadata.repository.simpleRepository
java.lang.NoClassDefFoundError: Could not initialize class org.apache.commons.httpclient.HttpClient at org.eclipse.ecf.provider.filetransfer.httpclient.HttpClientBrowseFileTransferFactory$1.sendBrowseRequest(HttpClientBrowseFileTransferFactory.java:53)
Error while reading from repository: http://download.eclipse.org/releases/indigo/site.xml.
I have following java version
java -version
java version "1.6.0_26"
Java(TM) SE Runtime Environment (build 1.6.0_26-b03-384-10M3425)
Java HotSpot(TM) 64-Bit Server VM (build 20.1-b02-384, mixed mode)
I have tried with eclipse classic 32 and 64 bit versions, with both i have the same problem .
I have also tried tweaking around priority of java version (32 or 64) under Java preferences.
Deleting /Library/Java/Extensions/log4j-1.2.15.jar resolved the issue.
Incase you are using ubuntu instead and had this problem, just go
cd /usr/java/packages/lib/ext/
sudo rm log4j-1.2.15.jar
sudo rm slf4j-*
I also had this problem and had nothing under /Library/Java/Extensions
You can notice that Eclipse reports: "The value will be overwritten using values from the preferences". So what you can do - visit Preferences > Network Connections and under 'Proxy Bypass' add Host: *
This has resolved the issue for me.
I set this to solve the problem:
http.sslVerify false in the egit config file.

Exception in thread "main" java.lang.UnsupportedClassVersionError: org/apache/axis2/transport/SimpleAxis2Server (Unsupported major.minor version 49.0

I'm having problem deploying Axis2 v1.5.3 on my 64 bit Solaris 9 OS, I wonder what should I do in order to successfully run this Axis2 instance with JDK 6 ?
In this OS there are multiple Java JDK version installed but I have already set the env. var to point to the 1.6 binary.
Suddenly I realize that I can always open up the setenv.sh file and then hard code it manually for safer option,
export AXIS2_HOME="/opt/local/sys/axis2-1.5.3"
export JAVA_HOME="/usr/java1.6/bin/java"
export AXIS2_CLASSPATH="$AXIS2_CLASSPATH"
Here's the history log:
npapsg# uname -a
SunOS npapsg.domain.com 5.9 Generic_117171-17 sun4u sparc SUNW,Sun-Fire-280R
npapsg# pwd
/opt/local/sys/axis2-1.5.3/bin
npapsg# ls
axis2.bat axis2server.sh setenv.sh
axis2.sh java2wsdl.bat wsdl2java.bat
axis2server.bat java2wsdl.sh wsdl2java.sh
npapsg# env
TERM=xterm
HOME=/
SHELL=/bin/zsh
USER=root
LOGNAME=root
PATH=/usr/bin:/usr/sbin:/opt/local/bin:/usr/local/bin:/opt/oracle/product/9.2.0/bin:/usr/ucb:/bin:/usr/bin:/etc:/usr/sbin:/usr/bin:/opt/SUNWspro-4.0.1/bin:/usr/ucb:/etc:/usr/ccs/bin:/opt/local/bin:/opt/local/etc:/opt/local/licenses:/usr/local/bin:/usr/local/etc::/usr/cssc/bin::/opt/gnu/bin:/usr/gnu/bin:::/opt/X11R5/bin:/usr/local/X11/R5/bin:/home/products/openwin-3.2/bin:/home/products/openwin-3.2/demo::/opt/SUNWmotif/bin:/opt/java/bin:::/opt/local/cap/bin:/home/products/ddts/sol2x_bin:::.:/usr/openwin/bin
PWD=/opt/local/sys/axis2-1.5.3/bin
SHLVL=1
ORACLE_HOME=/opt/oracle/product/9.2.0
HISTSIZE=1000
_=/usr/bin/env
npapsg# ./setenv.sh
Using AXIS2_HOME: /opt/local/sys/axis2-1.5.3
Using JAVA_HOME: /usr/java1.6/bin/java
npapsg# ./axis2server.sh
Using AXIS2_HOME: /opt/local/sys/axis2-1.5.3
Using JAVA_HOME: /usr/java1.6/bin/java
**Exception in thread "main" java.lang.UnsupportedClassVersionError: org/apache/axis2/transport/SimpleAxis2Server (Unsupported major.minor version 49.0)**
at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:539)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:251)
at java.net.URLClassLoader.access$100(URLClassLoader.java:55)
at java.net.URLClassLoader$1.run(URLClassLoader.java:194)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:187)
at java.lang.ClassLoader.loadClass(ClassLoader.java:289)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274)
at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)
npapsg# /usr/java1.6/bin/java -version
java version "1.6.0_06"
Java(TM) SE Runtime Environment (build 1.6.0_06-b02)
Java HotSpot(TM) Server VM (build 10.0-b22, mixed mode)
Try to add this bit inside ~/.profile and ~/.bashrc for the user that is going to run this.
export JAVA_HOME=/usr/java1.6
export PATH=$PATH:$JAVA_HOME/bin
Restart the console session and make sure you get java 6 version when you run java -showversion command