sonar-runner.bat JAVA_HOME doesn't point to a valid Java home - sonarqube

I would like to analyse a simple java project for testing sonarQube installation.
However when i run sonar-runner. bat i have this error.

It seems that your Java installation is not correct. You should test the value of JAVA_HOME variable by executing Get-Item Env:JAVA_HOME in PowerShell and verify that it points to a valid Java installation.
Alternatively, you can download sonar-scanner for Windows which already includes Java runtime.

Related

SonarQube startup Error: log4j2 could not find a logging implementation. Please add log4j2 to the filepath

I resolved this issue, I did it by following the instructions found here:
Elasticsearch installation : Error missing 'server' JVM at ...jvm.dll
I was using SonarQube fine the day before, but today when I tried to start the program I'm getting a error.
I have not changed anything on SonarQube as far as I know, I did made a successful connection with SonarQube to Jenkins. But if I remember correctly, I didn't had to install/change files for SonarQube for this(I just made a project, and generated a user login token for Jenkins). Also, I'm sure I'm using the "vanilla" version of SonarQube.
Download and install Java
Go to
c:/program files/java/jre/bin
and create a folder called "server"
Now go into the
c:/program files/java/jre/bin/client
and copy all data of this folder to
c:/program files/java/jre/bin/Server
updating/reinstalling the target jre (jre-8u181-windows-x64 for sonarqube 6.7.x) resolved this for me
I copied these jar in this route and it worked:
path: sonarqube-6.7/lib
log4j-api
log4j-core
This is a side effect; your have a JRE in your Windows PATH.
You need a JDK in your %PATH% // see previous error log
jvm 1 | Error: missing `server' JVM at `C:\Program Files (x86)\Java\jre1.8.0_191\bin\server\jvm.dll'.
jvm 1 | Please install or use the JRE or JDK that contains these missing components.
Used JDK 15, had same issue
Installed OpenJDK 11 instead (https://jdk.java.net/java-se-ri/11)
opened "[path to sonarqube folder]\conf\wrapper.conf"
replaced "wrapper.java.command=java"
with "wrapper.java.command=C:\Program Files\Java\jdk-11\bin\java.exe"
worked for me.

Jenkins ERROR: Failed to parse POMs java.io.IOException: Cannot run program error=2, No such file or directory

In jenkins I am forcing the execution to happen in one of the slaves.
in jenkins configuration I have updated the JAVA_HOME and MAVEN location to the location where its installed in the slave. When I start the build in jenkins I receive the following error
ERROR: Failed to parse POMs
java.io.IOException: Cannot run program "/home/jmeter/jdk1.8.0_112/bin/java" (in directory "/home/jmeter/apache-jmeter-2.13/bin/workspace/MyProject"): error=2, No such file or directory
PS : /home/jmeter/apache-jmeter-2.13/bin/workspace/MyProject - This directory got created and does exist in the slave machine
Can someone please share their expertise in resolving it ?
I needed to add Tool location of JDK8 for machine i run test on.
looks like there is a problem in the MVN installation. PLS make sure in the global config that you have the required mvn installation.
jenkins-->manage-->configure look for Maven installations and use automatic installation for the required version
make sure you have the JDK installation in the same config file
After wasting one day trying with different things going through different suggestions I got nothing. But, it was actually very simple. Please add the JDK path as bellow to your JDK Path in Jenkins-
/Library/Java/JavaVirtualMachines/jdk1.8.0_171.jdk/Contents/Home
You should assign the JDK in the Meta Data,The JAVA_HOME of system is not work for build.
Check your Maven version selected into the Manage Jenkins->Global Configurations->Maven->Maven Installations->Install from Apache->Version is same as installed on the server and your maven project.
You might have left out a few dependencies resulting in this issue.
Go back and download java and set the path as before:
To download, use
$yum -y install java-1.8*
Set the path to
JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.242.b08-0.amzn2.0.1.x86_64
Note: Get your path using command
find /usr/lib/jvm/java-1.8* | head -n 3
This got resolved after adding maven_home and providing the path in the global properties.
Go to: Jenkins ⟶ Manage Jenkins ⟶ Global Properties ⟶ MAVEN_HOME [C:\Program Files\Apache\apache-maven-3.6.3-bin\apache-maven-3.6.3]
Just in case someone else runs into this. I was getting this error because someone setup the JDK in Global Tool Configuration to download a windows version of the JDK, but my instance of jenkins is running on linux. Once I made the change to use a linux version of the JDK my issue was resolved.

Apache Maven is not configured properly into System vairable

I have latest version of Apache Maven 3.3.9 residing in my drive downloaded from here. I need it for configuring Appium tool to perform automated testing of Android applications. I have Maven plugin already configured with my Eclipse IDE. I went through few articles and got to know that I have to configure Maven into system variables as well. I set system variables, path for it as below.
M2HOME = C:\Program Files (x86)\Apache\apache-maven-3.3.9
M2 = %M2HOME%\bin
path = C:\Program Files\Java\jdk1.8.0_31\bin;%M2%
I tried running mvn , mvn -version from cmd prompt to check successful configuration of Maven but it gave me nothing. I tried navigating to the bin folder and re run the command but still the result is same. I even changed my path variable to have absolute path of Apache Maven i.e path = C:\Program Files (x86)\Apache\apache-maven-3.3.9\bin
To be further sure I copied the Apache Maven to a different folder just because it had spaces in between Program Files and Program Files (x86) but still the command prompt is as below:
I had followed above steps referring various articles in google. I'm not getting if I have committed any unseen mistake.
P.S: I have even tried above commands with cmd running as an administrator
Try mvn --version (with two dashes). mvn -v should also work. If Maven is not being executed at all, I suggest you try mvn.bat.
Some Command Prompt configurations will refuse to run .bat-files without the extension unless you explicitly tell them to.
It's probably a good idea to run where mvn in your Command Prompt as well. You should get this:
<YOUR_MAVEN_HOME>\bin\mvn
<YOUR_MAVEN_HOME>\bin\mvn.bat
<YOUR_MAVEN_HOME>\bin\mvn.cmd
if everything it set up correctly.
You should define M2_HOME variable. (Not M2HOME). Make sure it looks like this:
You said that you copied your maven to the location without spaces. That's a good idea. But it looks like your Path system variable points to the old location of maven. Make sure to change it. (What is the current location of maven?)
BTW mvn -version works as well as mvn --version

Maven unable to find Java installation

Im trying to run a maven project on a Ubuntu machine, but its unable to find Java
Compilation failure
Unable to locate the Javac Compiler in:
/usr/lib/jvm/java-6-openjdk/jre/../lib/tools.jar
Please ensure you are using JDK 1.4 or above and
not a JRE (the com.sun.tools.javac.Main class is required).
In most cases you can change the location of your Java
installation by setting the JAVA_HOME environment variable.
this is my etc/environment file
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:u$
JAVA_HOME=”/usr/lib/jvm/java-6-openjdk/jre”
M2_HOME=”/usr/local/apache-maven/apache-maven-3.1.0″
MAVEN_HOME=”/usr/local/apache-maven/apache-maven-3.1.0″
M2=”/usr/local/apache-maven/apache-maven-3.1.0/bin”
What additional information could i provide in order to make my question more clear?
I suppose that JAVA_HOME="/usr/lib/jvm/java-6-openjdk/jre" is the problem. Maven log clearly says that your path should point to JDK not just JRE. So try
export JAVA_HOME=/usr/lib/jvm/java-6-openjdk

"PWC6345: There is an error in invoking javac." error when using Jetty WTP plugin to deploy a JSP page on Jetty

I'm trying to deploy a JSP-page on Jetty, using the Jetty WTP plugin for Eclipse. But I get the error below. It looks like Jetty can't find javac. Is there any settings I have to do for the Jetty WTP plugin in Eclipse or how do I fix this?
The JSP page works fine if I export my project as a .war-file to jetty\webapps and then start Jetty manually using java -jar start.jar. But it doesn't work if I deploy using the Jetty WTP plugin for Eclipse as described.
I have my JAVA_HOME set to C:\Program Files (x86)\Java\jdk1.7.0_01 and I use Jetty 8.0.4 on Windows 7.
Servlets is working fine with the current setup. Any suggestions on how to solve this for JSP pages?
HTTP ERROR 500
Problem accessing /MyJavaWeb/formProcess. Reason:
PWC6345: There is an error in invoking javac. A full JDK (not just JRE) is required
Caused by:
org.apache.jasper.JasperException: PWC6345: There is an error in invoking javac. A full JDK (not just JRE) is required
at org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:92)
at org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:378)
at org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:119)
at org.apache.jasper.compiler.Jsr199JavaCompiler.compile(Jsr199JavaCompiler.java:208)
at org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:384)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:453)
at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:625)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:492)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:378)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:848)
at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:558)
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:488)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:119)
at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:520)
at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:233)
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:973)
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:417)
at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:192)
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:907)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:117)
at org.eclipse.jetty.server.Dispatcher.forward(Dispatcher.java:271)
at org.eclipse.jetty.server.Dispatcher.forward(Dispatcher.java:98)
at com.example.FormProcessServlet.doPost(FormProcessServlet.java:39)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:755)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:848)
at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:558)
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:488)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:119)
at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:483)
at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:233)
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:973)
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:417)
at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:192)
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:907)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:117)
at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:250)
at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:149)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:110)
at org.eclipse.jetty.server.Server.handle(Server.java:346)
at org.eclipse.jetty.server.HttpConnection.handleRequest(HttpConnection.java:442)
at org.eclipse.jetty.server.HttpConnection$RequestHandler.content(HttpConnection.java:941)
at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:801)
at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:224)
at org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:51)
at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:586)
at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:44)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:598)
at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:533)
at java.lang.Thread.run(Unknown Source)
As Jan Bartel suggested, from Jetty: How to configure JSP:
by adding the line below in the start.ini-file in Eclipse, it works fine.
-Dorg.apache.jasper.compiler.disablejsr199=true
I too happened to suddenly get the org.apache.jasper.JasperException: PWC6345 with my Eclipse installation and the Jetty Maven Plugin (which I use to start up Jetty from within Eclipse).
The reason was that I updated my JDK installation shortly before. Inside Eclipse, this caused to change the "Installed JRE" to point to a plain JRE installation instead of a full-fledged JDK installation. A JDK installation is needed for Jasper, as Jasper needs javac (which is not provided by JRE).
In my case, the solution was to provide Eclipse with the JDK installation. To do so, select Window -> Preferences -> Java -> Installed JREs. Here, click Add..., then point to your JDK installation (in my case, JRE home should point to C:\Program Files (x86)\Java\jdk1.7.0_17). Click Finish. Then back in the Installed JREs overview, remove the old JRE reference and select the newly added JDK installation.
I got the PWC6345 error when running a webapp with Run-Jetty-Run plugin.
The fix was to change the Execution environments settings in Preferences.
Since I'm using java 7 I needed to change the setting for JavaSE-1.7.
Probably other execution environments will behave similarly.
Window -> Preferences -> Java -> Installed JREs -> Execution environments
Select JavaSE-1.7 on the left -> pick the *jdk*1.7.x_xx on the right hand side
Ok, solved this after a lot of searching around.
Download any jdk and point JAVA_HOME to this jdk.
Inside this jdk folder you will find ./bin and ./jre/bin
Copy the javac from ./bin and paste it in ./jre/bin [remember copy not cut]
Now in eclipse, Run->External-Tools->External-Tools-Configurations, select the build.xml for of your project in the left pane and click on the JRE tab in the right pane.
Click on installed JREs and add the jdk in the previous step.
Once done, select this new JRE (jdk1.6.0_31) as the 'Separate JRE', click on apply at the bottom and run.
This assumes you are doing a jetty:run using ant on eclipse.
Strange because this thread suggests:
The solution was to install the package jdk7-openjdk.
Perhaps this should be added to the list of dependencies (or maybe for jetty, and not solr itself)?
But that doesn't help much on Windows, where the binary for openjdk7 aren't easily available.
(In "OpenJDK availability for Windows OS" comments, eckes mentions having found some openjdk binaries for Windows, as part of the Build b146. However, said releases aren't maintained any more)
The bug report filled by the OP Jonas is closed with a simple reference to the Eclipse wiki page "Jetty/Howto/Configure JSP".
You have planty solutions guys but I thought that it exist a solution better than fix the start.ini
I lived the same problem and then I realize that it may be because I did have a JDK7 for 64bit while I should have a JDK7 for 32.
So I fixed my problem by downloading and use the JDK7 for 32Bit.
Also, you would still need to
Use the JDK and not the JRE
Set your JAVA_HOME
I am running on Windows by the way ...
I have the same problem. When I run where java, the output is:
C:\Windows\System32\java.exe
D:\Program Files\Java\jdk1.7.0_25\bin\java.exe
Of course the first one is incorrect. So my problem lies in the PATH. I can rectify this by either removing the java.exe in the directory C:\Windows\System32\ because I'm sure it's useless, or putting the second entry in front of the first one.
So When encountering this problem, please check your PATH for the jdk. I hope that my problem and my solution is helpful in some way.
I got the PWC6345 error when running jetty-runner 9.2.1 standalone from Windows 7 cmd (or batch file) with Oracle JDK 1.7.0_60, and none of the other suggestions in this or other forums worked. I'll leave my workaround here, in case it helps someone...
After installing the JDK, running 'where java' showed two different java.exe paths, the first being in the Windows system folder, and the second in the JDK folder (which is the one I added to the path manually). Both of these are actually installed by the same JDK installer. The java.exe in the system folder was taking precedence and causing the full JDK to go undetected.
Placing the JDK bin folder (e.g. "C:\Program Files\java\jdk1.7.0_60\bin") on the path before the other system paths fixed the issue.
In addition to updating the JAVA_HOME (see above)...
If you're encountering this error from command line (e.g. starting Jetty server from dos window), check where windows is finding the java.exe:
where java
If windows comes back with a path showing to your jre, then check your PATH. Chances are the %PATH% contains a path pointing to the jre instead of jdk.
if you set environment variable JRE_HOME , please unset or delete it
and start server again .
In liferay 7 : I got this error fixed by changing the runtime environment of the server from jre to jre with jdk
I got this error when deploy war package to our server.
My deploy command is (applied web container you may find):
java -jar jetty-runner.jar --port 8020 xx.war
I write this answer because it confused me almost one day. I tried some methods above but failed.
Finally I found there is only jre on my servers but not full jdk.
$ls /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.131-2.b11.el7_3.x86_64
jre
I fix it with searching available jdk and install one.
$yum search java | grep 'java-'
$sudo yum install java-1.8.0-openjdk-devel.x86_64
(Notice the -devel)
I added this line to 'eclipse.ini' file which is present inside eclipse folder.
-vm
C:\Program Files\Java\jdk1.8.0_131\bin\javaw.exe
and I also change the JRE path in eclipse
windows -> preferences -> java -> Installed JREs
and provided path upto jdk
C:\Program Files\Java\jdk1.8.0_131
I spent good amount of time on this issue, but it turned out to be very simple. All you have to do is:
choose the JDK instead of JRE while configuring the server runtime!
It worked like a champ, I had this issue with glassFish 4.0

Resources