I'm trying to run the JMeter test using the TFS build definition. I've created the required task to run the JMeter test (command-line task), but I'm getting the following error:
Not able to find Java executable or version. Please check your Java installation.
errorlevel=2
Press any key to continue . . .
I've checked the java version on the agent:
I've mentioned the following system variables:
JMETER_HOME as C:\Performance Tests\apache-jmeter-3.2
JRE_HOME as "C:\Program Files\Java\jre1.8.0_231"
to the Path variable was added C:\Performance Tests\apache-jmeter-3.2\bin;C:\Program Files\Java\jre1.8.0_231\bin
When I try to run the JMeter on the agents I don't get any error:
Windows Server 2012 R2 64 bit is installed on the agent.
On another agent (which is the same and has similar configs) the test is running with no issues.
Could someone tell me what is the reason for the issue? Thank you in advance 😊
Looking into jmeter.bat source:
for /f "tokens=3" %%g in ('java -version 2^>^&1 ^| findstr /i "version"') do (
rem #echo Debug Output: %%g
set JAVAVER=%%g
)
if not defined JAVAVER (
#echo Not able to find Java executable or version. Please check your Java installation.
set ERRORLEVEL=2
goto pause
)
it appears that the JMeter startup script is not capable of parsing the output of java -version command in order to determine Java runtime version
So make sure to have "bin" folder of your JRE or JDK installation added to your operating system PATH environment variable
In order to have 100% confidence that it will work add this line to the beginning of your jmeter.bat script:
set PATH="C:\Program Files\Java\jre1.8.0_231\bin";%PATH%
also be aware that according to 9 Easy Solutions for a JMeter Load Test “Out of Memory” Failure article you should always be using the latest version of JMeter so consider upgrading to JMeter 5.2.1 (or whatever is the latest stable version available at JMeter Downloads page) on next available opportunity
Related
I am trying to install the gem rjb and I have come across this error
extconf.rb:53:in <main>': JAVA_HOME is not set. (RuntimeError).
The following is the entire error log.
$sudo gem install rjb -v '1.4.9' --source 'https://rubygems.org/'
[sudo] password for santoshpavan:
Building native extensions. This could take a while...
ERROR: Error installing rjb:
ERROR: Failed to build gem native extension.
current directory: /var/lib/gems/2.5.0/gems/rjb-1.4.9/ext
/usr/bin/ruby2.5 -r ./siteconf20200411-19244-10jhs3k.rb extconf.rb
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log file for more details. You may
need configuration options.
Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/usr/bin/$(RUBY_BASE_NAME)2.5
extconf.rb:53:in `<main>': JAVA_HOME is not set. (RuntimeError)
extconf failed, exit code 1
Gem files will remain installed in /var/lib/gems/2.5.0/gems/rjb-1.4.9 for inspection.
Results logged to /var/lib/gems/2.5.0/extensions/x86_64-linux/2.5.0/rjb-1.4.9/gem_make.out
I tried the answer that is mentioned here.
When I printed the env I can see the JAVA_HOME path mentioned, as below.
santoshpavan#DESKTOP-ISVIQCL:/mnt/c/code/expertiza$ env
LS_COLORS=rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=00:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.zst=01;31:*.tzst=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.wim=01;31:*.swm=01;31:*.dwm=01;31:*.esd=01;31:*.jpg=01;35:*.jpeg=01;35:*.mjpg=01;35:*.mjpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.m4a=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.oga=00;36:*.opus=00;36:*.spx=00;36:*.xspf=00;36:
HOSTTYPE=x86_64
LESSCLOSE=/usr/bin/lesspipe %s %s
LANG=C.UTF-8
OLDPWD=/mnt/c
WSL_DISTRO_NAME=Ubuntu-18.04
JAVA_HOME=/mnt/c/Program Files/Java/jdk-10.0.2
S_COLORS=auto
USER=santoshpavan
RBENV_SHELL=bash
PWD=/mnt/c/code/expertiza
HOME=/home/santoshpavan
NAME=DESKTOP-ISVIQCL
XDG_DATA_DIRS=/usr/local/share:/usr/share:/var/lib/snapd/desktop
SHELL=/bin/bash
TERM=xterm-256color
SHLVL=1
LOGNAME=santoshpavan
PATH=/home/santoshpavan/.yarn/bin:/home/santoshpavan/.config/yarn/global/node_modules/.bin:/home/santoshpavan/.rbenv/plugins/ruby-build/bin:/home/santoshpavan/.rbenv/shims:/home/santoshpavan/.rbenv/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/mnt/c/Program Files/WindowsApps/CanonicalGroupLimited.Ubuntu18.04onWindows_2020.1804.7.0_x64__79rhkp1fndgsc:/mnt/c/Python37/Scripts/:/mnt/c/Python37/:/mnt/c/Python27/:/mnt/c/Python27/Scripts:/mnt/c/Users/santo/AppData/Local/Programs/Python/Python37-32/Scripts/:/mnt/c/Users/santo/AppData/Local/Programs/Python/Python37-32/:/mnt/c/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v10.1/bin:/mnt/c/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v10.1/libnvvp:/mnt/c/app/santo/product/12.1.0/dbhome_1/bin:/mnt/c/Program Files/Java/jdk-10.0.2/bin:/mnt/c/Windows/system32:/mnt/c/Windows:/mnt/c/Windows/System32/Wbem:/mnt/c/Windows/System32/WindowsPowerShell/v1.0/:/mnt/c/Program Files (x86)/NVIDIA Corporation/PhysX/Common:/mnt/c/WINDOWS/system32:/mnt/c/WINDOWS:/mnt/c/WINDOWS/System32/Wbem:/mnt/c/WINDOWS/System32/WindowsPowerShell/v1.0/:/mnt/c/WINDOWS/System32/OpenSSH/:/mnt/c/Program Files/NVIDIA Corporation/NVIDIA NvDLISR:/mnt/c/WINDOWS/system32:/mnt/c/WINDOWS:/mnt/c/WINDOWS/System32/Wbem:/mnt/c/WINDOWS/System32/WindowsPowerShell/v1.0/:/mnt/c/WINDOWS/System32/OpenSSH/:/mnt/c/ProgramData/chocolatey/bin:/mnt/c/Program Files/Git/cmd:/mnt/c/Program Files/nodejs/:/mnt/c/Program Files/NVIDIA Corporation/Nsight Compute 2019.4.0/:/mnt/c/Apache/apache-zookeeper-3.5.6-bin/bin:/mnt/c/Program Files/Java/jdk-10.0.2/bin:/mnt/c/Spark/spark-3.0.0-preview2-bin-hadoop2.7:/mnt/c/Program Files (x86)/Intel/Intel(R) Management Engine Components/DAL:/mnt/c/Program Files/Intel/Intel(R) Management Engine Components/DAL:/mnt/c/Program Files/PostgreSQL/12/bin:/mnt/c/Program Files/PostgreSQL/12/lib:/mnt/c/Program Files/Intel/WiFi/bin/:/mnt/c/Program Files/Common Files/Intel/WirelessCommon/:/mnt/c/Users/santo/.cargo/bin:/mnt/c/Ruby27-x64/bin:/mnt/c/Program Files/Git/usr/local/bin:/mnt/c/Program Files/Git/bin:/mnt/c/Program Files (x86)/Intel/Intel(R) Management Engine Components/iCLS/:/mnt/c/Program Files/Intel/Intel(R) Management Engine Components/iCLS/:/mnt/c/Program Files (x86)/Intel/Intel(R) Management Engine Components/IPT:/mnt/c/Program Files/Intel/Intel(R) Management Engine Components/IPT:/mnt/c/WINDOWS/System3:/mnt/c/Program Files/JetBrains/PyCharm Community Edition 2019.3.4/bin:/snap/bin
WSLENV=JAVA_HOME/p
LESSOPEN=| /usr/bin/lesspipe %s
_=/usr/bin/env
I do no understand the issue here as JAVA_HOME is present in the environment variables with the WSLENV.
Note:
Earlier, when I had the same error, following this helped. But the javac was still was not being detected. So, I installed java in wsl using $ sudo apt install default-jdk. And, after that this issue has happened.
TL;DR: In WSL, you must use javac.exe since it is a Windows binary. Simply typing javac will not work, even if the path is set up correctly. If that doesn't work, try adding ../bin to the end of your JAVA_HOME variable.
Using Windows Binaries & Environment Variables in WSL
If you have JavaSDK installed on Windows, you do not need to install Linux binaries. Simply ensure that they are properly linked so WSL knows where to find the SDK.
Also, when calling a Windows binary from WSL, you cannot type javac, you must type javac.exe so WSL knows we're looking in the Windows file system.
Ensure Java for Windows works
Open PowerShell or cmd.exe from any directory and type java --version
You should get a list of JRK info:
openjdk 11.0.4 2019-07-16 LTS
OpenJDK Runtime Environment Corretto-11.0.4.11.1 (build 11.0.4+11-LTS)
OpenJDK 64-Bit Server VM Corretto-11.0.4.11.1 (build 11.0.4+11-LTS, mixed mode)
Your version might be different, the important part is that the system knows where to find Java. If you get an error, ensure your Windows Environment variables are set correctly:
JAVA_HOME as an Environment Variable, and
JAVA_HOME/bin as a Path variable.
Setting Variable in WSL
The best place to put the next lines of code are in your .bashrc file (I have mine right before sourcing my aliases & functions), but if you are running multiple users or simply prefer ./bash_profile or /etc/profile put it there.
# Shared environment variables
export JAVA_HOME=/mnt/d/Java/jdk11.0.4_10
While we're at it, add any other Environment Variables you will need in your development setup.
I have my WSL, Java, and all my other dev tools set up on my second HDD which is not a system drive, ensure that your location matches your JAVA_HOME path in Windows.
If JavaSDK is located at: C:\Java\jdk8.0
The corresponding WSL mount point is: /mnt/c/Java/jdk8.0
Executing
Important: Use java.exe <args> in WSL instead of java <args>
Say you just wrote CompareTwoStrings.class and want to compile and run it using the Windows binaries. You can do it from a Windows shell or WSL.
From Windows Shell:
javac GetStringLength.java
java GetStringLength
From WSL:
javac.exe GetStringLength.java
java.exe GetStringLength
Using java <args> in WSL will result in a Command 'java' not found error. That is because running windows binaries from within WSL requires that the .exe extension is used in the command.
Simplicity
We don't want to install a second copy of Java specific to WSL and waste that precious disk space, so we're going to call the Windows binary from the WSL shell. This is a great benefit of WSL (WSL1 in particular) in that it can interact (almost) flawlessly with the Windows File System.
NOTE: In order to run a program, it must either be a Path variable, or be run from within it's containing folder.
Hopefully that works as easily for you as it did for me. Just remember to use the correct command depending on what OS binary you're running. This took me about 10 minutes to get set up, and has been a lifesaver for cross-compiling and general ease-of-use.
I am trying to install JNetPcap and followed the instructions given at here. At step 12, I am unable to run the ant command and i see the error
Error: JAVA_HOME is not defined correctly.
We cannot execute /usr/lib/jvm/java-6-sun/bin/java
As I am able to run Java classes from eclipse or from command line I don't think if it's a problem with JAVA_HOME.
echo $PATH shows
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/lib/jvm/java-6-sun/bin
Kindly let me know if am missing something here.
thanks in advance
Neither running java from the command line or running eclipse will require JAVA_HOME to be set. However, the build procedure you are trying to use ant, and ant often does require JAVA_HOME to be set appropriately. (It actually depends on the version of ant that you are using. The use of JAVA_HOME is typically in the wrapper script for ant.)
Just set it.
JAVA_HOME should probably be set to /usr/lib/jvm/java-6-sun ... based on what you gave said PATH to.
However, it is also possible that the problem is that your PATH is incorrect. Or that you have (somehow) managed to get the owner/group/permissions on your Java install incorrect, such that the java command isn't executable.
Check that running java -version displays the installed Java version.
Repeat with /usr/lib/jvm/java-6-sun/bin/java -version.
I have downloaded Neo4J enterprise from the Neo site and have untar'd it under /opt
I have successfully downloaded and installed the Java 7 Server edition from the Oracle web site. Note after indicating I want a server JRE, Oracle downloads this : jdk1.7.0_51
I have untar'd both under /opt giving me /opt/neo4j-2.0.0 and /opt/jdk1.7.0_51
I have successfully installed Neo4J 2.O on AWS with Centos Linux, such that it should run as a Service under a service account. To do this I used the Neo install command. The command ran successfully
I can successfully start Neo4J as myself. After editing my ~/.bash_profile to define JAVA_HOME and exporting.
export JAVA_HOME="/opt/jdk1.7.0_51/"
export NEO4J_HOME="/opt/neo4j-2.0.0"
export PATH=$JAVA_HOME/bin:$NEO4J_HOME:$PATH
Apply
source ~/.bash_profile
cd /$NEO$J_HOME
bin/neo4j start
Works just fine.
However, we are not able to successfully get Neo to start as a service
sudo service neo4j-service start
which: no java in (/sbin:/usr/sbin:/bin:/usr/bin)
ERROR: Unable to find java. (Cannot execute )
* Please use Oracle(R) Java(TM) 7 to run Neo4j Server. Download "Java Platform (JDK) 7" from:
http://www.oracle.com/technetwork/java/javase/downloads/index.html
* Please see http://docs.neo4j.org/ for Neo4j Server installation instructions.
If I echo $JAVA_HOME it returns as expected
If I echo $PATH it returns as expected
by as expected we can see java on the path.
If I simply type java -version before I run sudo service neo4j-service start
the response shows the java version.
A bit of background: the Linux service command is not available unless I first run a special script per our normal it policies. However, the script clobbers the exports that I would otherwise use.
Accordingly the command
service neo4j-service start
returns
-bash: neo4j-service: command not found
indicating that the 'service' command cannot be found
So sudo is required in our environment to execute the service command
We have tried simply placing jdk1.7.0_51 under /sbin/jdk1.7.0_51 that does not work. We have also tried extracting the jre folder from jdk1.7.0_51 and placing it under /sbin/jre
Also tried creating a java.sh file under /etc/profile.d/
Still no success.
So the simple question....
Where is Neo4J 2.0.0 looking for Java when running as a service? Is it using the environment variable JAVA_HOME, or is it looking in one of the following locations as the Neo4J server error message would seem to indicate? "no java in (/sbin:/usr/sbin:/bin:/usr/bin)"
Under my installation configuration the neo4j service is intended to run under the account neo4jservice. Is this as simple as making sure JAVA_HOME is available to the neo4jservice accound? Why the error message "no java in (/sbin:/usr/sbin:/bin:/usr/bin)"?
Thanks in advance
I ran a test on my solaris and Linux Mint install and this seems to work for me
Perhaps it's not elegant, but it will get you going. Just drop the sudo part for your startup script.
sudo NEO4J_HOME="/opt/neo4j" JAVA_HOME="/usr/java" /opt/neo4j/bin/neo4j start
Obviously, modify the environment variables to your situation:
JAVA_HOME="/opt/jdk1.7.0_51/" NEO4J_HOME="/opt/neo4j-2.0.0" service neo4j-service start
Not quite the answer I was hoping for... as the answer seems to disregard this part of the original POST: "So sudo is required in our environment to execute the service command"
What does seem to work is modifying the neo4j-service script to include the exports.
neo4j-service is found at /etc/init.d
I have the following questions on WAS 8.5 installation:
Can Java 7 be installed outside {or}c:\IBM\Websphere\Appserver
Can the Java 7 name be other than Java1.7_64?
Also how to get the info. using any bat/sh file from IBM
Thanks in advance
No to both: there is no way to change the Java install directory.
To determine the configured JDK, source setupCmdLine and use the JAVA_HOME variable. For example, on UNIX:
. /path/to/profile/setupCmdLine.sh
echo $JAVA_HOME
...and on Windows:
C:\path\to\profile\bin\setupCmdLine.bat
echo %JAVA_HOME%
If you need to automate discovery, you might write a temporary batch file with the following contents, execute it (e.g., using ProcessBuilder), and then parse the resulting output:
#echo off
call "C:\path\to\profile\bin\setupCmdLine.bat"
echo JAVA_HOME=%JAVA_HOME%
I need to get a stack trace for a JVM process running on a client machine that uses windows.
The client has the JRE installed but not the JDK.
I want to use JStack but it is not installed and we can't install a JDK on the client's machine. I also tried using AdaptJ stack trace product from a Java Webstart Session but that didn't work because we remote in and get an error about not being the session that started the application at a specified PID.
Essentially I want a way to install JStack without installing the JDK.
You probably want to use SendSignal, which was designed for exactly this purpose.
The JDK and associated tools work fine whether "installed" or not, if you just zip up and extract it to a temporary directory, you should be able to run jstack. (No PATH or JAVA_HOME modifications necessary). Just make sure you use the same version that corresponds to the JRE your client has the application running with. At least in the case of JConsole, it seems to fuss if the versions are different. I'm not sure if jstack behaves the same way.
I'm not saying this is the ideal solution, just that it would work. I think jdigital and Eddie's suggestions are better first bets, and even though this shouldn't interfere with an existing java installation the same way running the installer would, the customer may disagree regardless.
jstack and jps are part of tools.jar of the JDK.
Also attach.dll is required to attach jstack to a process.
Ofcourse the tools.jar and attach.dll are not part of JRE.
To make jstack work on a systems which has no JDK (mostly Windows), I usually do the following.
Copy tools.jar and attach.dll from JDK and put in to some location
on the target system. Example: to c:\temp\jstack
Write a bat script to manually invoke it using JRE.
For example, create a bat file jstack.bat:
set JRE=c:\jrefolder
"%JRE%\bin\java" -classpath "c:\temp\jstack\tools.jar" -Djava.library.path="c:\temp\jstack" sun.tools.jstack.JStack %*
Similarly for jps, create a jps.bat with following content.
set JRE=c:\jrefolder
"%JRE%\bin\java" -classpath "c:\temp\jstack\tools.jar" -Djava.library.path="c:\temp\jstack" sun.tools.jps.Jps %*
Usage:
jstack.bat -l <pid>
Hope this helps.
Would you be able to use JConsole via remote access?
To get a thread dump with only a JRE you need tools.jar and attach.dll from the JDK of the same Java version. Install this somewhere and copy these into the jre. Must be identical version!
If you need a dump of a process running under the system account you can use the Windows sysinternals psexec.exe to gain access to the process. Copy this into the JRE bin or somewhere in the path.
This batch file writes the stack dump to a file with a datetime filename so multiple traces can be taken and compared easily.
Threads.bat
:: Creates a thread dump for the tomcat6.exe process
:: saved in a timestamped filename and views it!
:: Jim Birch 20111128 rev 2015-10-12
::Required the following files to be placed in the jre/bin folder:
:: attach.dll - From the Java JDK (must be the same version)
:: tools.jar - ditto
:: psexec.exe - from Windows sysinternals
::cd to jre/bin
d:
cd \application\jre\bin
::build datetime filename
rem datetime from wmi.exe
for /f "tokens=2 delims==" %%I in ('wmic os get localdatetime /format:list') do set dt0=%%I
rem datetime string as YYYY-MM-DD-hhmmss
set dt=%dt0:~0,4%-%dt0:~4,2%-%dt0:~6,2%-%dt0:~8,6%
set ff=td-%dt%.txt
echo filename: %ff%
::PID of the process by named exe, eg, tomcat6
for /F "tokens=2" %%I in ('TASKLIST /NH /FI "IMAGENAME eq tomcat6.exe"' ) DO SET PID=%%I
echo pid: %PID%
::combine above with jstack command
psexec -s jstack.exe -l %PID% >> %ff%
:: view result
start %ff%
::insert pause to debug or timer to review script operation
::ping localhost -n 20 >nul
::pause
If you want to use the on-board tools of the JDK and also want to both have a minimal (i.e., not including copying the whole JDK) and convenient (i.e. not invoking with a custom .bat) solution, this works for me (tried on Java 1.8):
Create an empty folder ($DEST below) and copy the following files (from the JDK $JDK_HOME) into bin and lib folders as follows:
Source -> Destination
$JDK_HOME/bin/jps.exe -> $DEST/bin/jps.exe
$JDK_HOME/bin/jstack.exe -> $DEST/bin/jstack.exe
$JDK_HOME/bin/jli.dll -> $DEST/bin/jli.dll
$JDK_HOME/jre/bin/attach.dll -> $DEST/bin/attach.dll
$JDK_HOME/lib/tools.jar -> $DEST/lib/tools.jar
Then ZIP and copy this over to the destination machine running a compatible JRE.
You should be able to run jps and jstack from the bin folder now as you would run them from the original JDK.