If I used java -jar /absolute/path/to/ApacheJMeter.jar -t test.jmx, it just start the GUI without the test.jmx
If I used java -jar ./ApacheJMeter.jar -t test.jmx, it will show the GUI with test.jmx opened.
Thanks
If you use the absolute path to the -jar option you'll most likely need to include the absolute path to the test.jmx -t option. E.x. -t /absolute/path/to/test.jmx, unless test.jmx happens to be in the current directory.
you should generally use:
jmeter.sh for unix, linux, macosx
jmeter.bat for windows
Related
I have a working command using a windows machine like this:
jmeter -g /Users/magnus/Desktop/apache-jmeter-5.1/bin/report_QA/sfm_qa_Oppdater.csv -o /Users/magnus/Desktop/apache-jmeter-5.1/bin/result_QA_oppdate
given I am standing in the directory where JMeter is installed.
However if I run the same command on my Mac I get: jmeter not found
How do I run the same command on a mac using "terminal"
?
If you call jmeter then MacOS is trying to find this binary or script under system PATH, if it is not there - you will get not found error.
So either you need to put "bin" folder of your JMeter installation under your system PATH like:
PATH=/Users/magnus/Desktop/apache-jmeter-5.1/bin:$PATH && export PATH
then you will be able to run it as jmeter
Or change your command to explicitly invoke the jmeter.sh startup script like:
./jmeter -g /Users/magnus/Desktop/apache-jmeter-5.1/bin/report_QA/sfm_qa_Oppdater.csv -o /Users/magnus/Desktop/apache-jmeter-5.1/bin/result_QA_oppdate
this ./ bit is uber important
More information: How to Get Started With JMeter: Installation & Test Plans
And last but not the least, you can install JMeter via Homebrew, the formulae will download the latest JMeter version and put it into your PATH
To run the script in non-GUI mode, you have to just add sh before the same windows non-GUI command.
Go to your bin directory and run like:
sh jmeter -n -t Test.jmx -l Test1.jtl -g test.csv
I have the following Dockerfile in a simple Spring Boot app:
FROM maven:3.6-jdk-8-alpine as build
WORKDIR /app
COPY ./pom.xml ./pom.xml
RUN mvn dependency:go-offline -B
# copy your other files
COPY ./src ./src
# build for release
RUN mvn package -DskipTests
FROM openjdk:8-jre-alpine
ARG artifactid
ARG version
ENV artifact ${artifactid}-${version}.jar
WORKDIR /app
COPY --from=build /app/target/${artifact} /app
EXPOSE 8080
ENTRYPOINT ["sh", "-c"]
CMD ["java","-jar ${artifact}"]
When I build it with the required arguments:
docker build --build-arg artifactid=spring-demo --build-arg version=0.0.1 -t spring-demo .
it builds with no errors.
When I try to run the image with:
docker container run -it spring-demo
it fails with the following error:
Usage: java [-options] class [args...]
(to execute a class)
or java [-options] -jar jarfile [args...]
(to execute a jar file)
where options include:
-d32 use a 32-bit data model if available
-d64 use a 64-bit data model if available
-server to select the "server" VM
The default VM is server,
because you are running on a server-class machine.
-cp <class search path of directories and zip/jar files>
-classpath <class search path of directories and zip/jar files>
A : separated list of directories, JAR archives,
and ZIP archives to search for class files.
-D<name>=<value>
set a system property
-verbose:[class|gc|jni]
enable verbose output
-version print product version and exit
-version:<value>
Warning: this feature is deprecated and will be removed
in a future release.
require the specified version to run
-showversion print product version and continue
-jre-restrict-search | -no-jre-restrict-search
Warning: this feature is deprecated and will be removed
in a future release.
include/exclude user private JREs in the version search
-? -help print this help message
-X print help on non-standard options
-ea[:<packagename>...|:<classname>]
-enableassertions[:<packagename>...|:<classname>]
enable assertions with specified granularity
-da[:<packagename>...|:<classname>]
-disableassertions[:<packagename>...|:<classname>]
disable assertions with specified granularity
-esa | -enablesystemassertions
enable system assertions
-dsa | -disablesystemassertions
disable system assertions
-agentlib:<libname>[=<options>]
load native agent library <libname>, e.g. -agentlib:hprof
see also, -agentlib:jdwp=help and -agentlib:hprof=help
-agentpath:<pathname>[=<options>]
load native agent library by full pathname
-javaagent:<jarpath>[=<options>]
load Java programming language agent, see java.lang.instrument
-splash:<imagepath>
show splash screen with specified image
See http://www.oracle.com/technetwork/java/javase/documentation/index.html for more details.
What's wrong with the above settings, please?
The app example code can be found here.
You should delete that ENTRYPOINT line and use the shell form of CMD.
# No ENTRYPOINT
CMD java -jar ${artifact}
The Dockerfile ENTRYPOINT and CMD lines get combined into a single command line. In your Dockerfile, that gets interpreted as
sh -c java '-jar ${artifact}'
But the sh -c option only actually takes the next single word and interprets it as the command to run; so that really gets processed as
sh -c 'java' # '-jar ${artifact}'
ignoring the -jar option.
There are two ways to "spell" CMD (and ENTRYPOINT and RUN). As you've done it with JSON arrays, you specify exactly the "words" that go into the command line, so for example, -jar ${artifact} would be passed as a single argument including the embedded space. If you just pass a command line, Docker will insert a sh -c wrapper for you, and the shell will handle word parsing and variable interpolation. You shouldn't ever need to manually include sh -c in a Dockerfile.
It looks to me that you have an error with the sh -c. The arguments are not read correctly. You could check that if you do a docker inspect on the exited container. In the output search for the "CMD".
ENTRYPOINT ["sh", "-c"]
CMD ["java","-jar ${artifact}"]
If you would like to run it with sh -c, you have to quote the arguments as one like:
CMD ["java -jar ${artifact}"]
Can you give it a try?
ENV variables are only available during the build. To get env variables into the container at runtime, you have to use --env or -e or --env-file. It is best to use --env-file.
See this for same problem answered already: How do I pass environment variables to Docker containers?
Also look at this: Use environment variables in CMD
Here is one possible solution:
Keep your CMD instruction as this:
CMD ["java","-jar ${artifact}"]
Use this docker run command:
docker container run -it -e artifact=spring-demo-0.0.1.jar spring-demo
I'm trying to get My jmeter test plan to execute in Jenkins. Both jmeter and Jenkins are installed on my local windows machine. I've set up some properties in Jmeter and verified that I can run them from the cmd line successfully with this command: C:\Users\MikeL\Documents\apache-jmeter\bin>jmeter -n -t testApp.jmx -l log.jtl -Jenv=dev -JloopCount=2 Now in Jenkins I've created a new project, create two new parameters and entered the following in "execute shell" based off of exapmples I was able to find on the web.I haven't configured anything else in Jenkins. sh jmeter.sh -n -p user.properties -t C:/Users/MikeL/Documents/apache-jmeter/bin/testApp.jmx -l log.jtl -Jenv=dev -JloopCount=1 suffice to say this script won't build my jmeter test. I recieve this error: Cannot run program "sh" (in directory "C:\Program Files (x86)\Jenkins\workspace\LOS API Regression Tests"): CreateProcess error=2, The system cannot find the file specified
If anybody has any clues I'd be very grateful!
Add this path C:\Users\MikeL\Documents\apache-jmeter\bin to your Environment Variables PATH.
Then Jenkins Build step should be Windows Batch Command
Then the command should be jmeter -n -t testApp.jmx -l log.jtl -Jenv=dev -JloopCount=1
Update:
If you do not want to set the path, just directly give below command as Windows Batch Command.
C:\Users\MikeL\Documents\apache-jmeter\bin\jmeter.bat -n -t C:\Users\MikeL\Documents\apache-jmeter\bin\testApp.jmx -l log.jtl -Jenv=dev -JloopCount=1
Use either Ant/Maven/Gradle to run jmeter tests in the non-gui mode. They can also be integrated with Jenkins
JMeter-Ant
JMeter-Maven
The problem here is cross environment. you need to be running this with windows batch command instead of execute shell. windows wont recognize sh as executable.
C:\Users\MikeL\Documents\apache-jmeter\bin>jmeter -n -t testApp.jmx -l log.jtl -Jenv=dev -JloopCount=2
Run the above in execute windows batch mode
I have built a hadoop cluster which 1 master-slave node and the other is slave. And now, I wanna build a flume to get all log of the cluster on master machine. However, when I try to install flume from tarball and I always get:
Error: Could not find or load main class org.apache.flume.node.Application
So, please help me to find the answer, or the best way to install flume on my cluster.
many thanks!
It is basically because of FLUME_HOME..
Try this command
$ unset FLUME_HOME
I know its been almost a year for this question, but I saw it!
When you set your agnet using sudo bin/flume-ng.... make sure to specify the file where the agent configuration is.
--conf-file flume_Agent.conf -> -f conf/flume_Agent.conf
This did the trick!
look like you run flume-ng in /bin folder
flume after build in
/flume-ng-dist/target/apache-flume-1.5.0.1-bin/apache-flume-1.5.0.1-bin
run flume-ng in this
I suppose you are trying to run flume from cygwin on windows? If that is the case, I had a similar issue. The problem might be with the flume-ng script.
Find the following line in bin/flume-ng:
$EXEC java $JAVA_OPTS $FLUME_JAVA_OPTS "${arr_java_props[#]}" -cp "$FLUME_CLASSPATH" \
-Djava.library.path=$FLUME_JAVA_LIBRARY_PATH "$FLUME_APPLICATION_CLASS" $*
and replace it with this
$EXEC java $JAVA_OPTS $FLUME_JAVA_OPTS "${arr_java_props[#]}" -cp `cygpath -wp "$FLUME_CLASSPATH"` \
-Djava.library.path=`cygpath -wp $FLUME_JAVA_LIBRARY_PATH` "$FLUME_APPLICATION_CLASS" $*
Notice that the paths have been replaced with the windows directories. Java would not be able to find the library paths from the cygdrive paths and we would have to convert it to the correct windows paths wherever applicable
Maybe you are using the source files, you first should compile the source code and generate the binary code, then inside the binary files directory, you can execute: bin/flume-ng agent --conf ./conf/ -f conf/flume.conf -Dflume.root.logger=DEBUG,console -n agent1. All these information you can follow: https://cwiki.apache.org/confluence/display/FLUME/Getting+Started
I got same issue before, it's simply due to FLUME_CLASSPATH not set
the best way to debug is see the java command being fired and make sure that flume lib is included in the CLASSPATH (-cp),
As in following command its looking for /lib/*, thats where the flume-ng-*.jar are, but its incorrect because there's nothing in /lib, in this line -cp '/staging001/Flume/server/conf://lib/*:/lib/*'. It has to be ${FLUME_HOME}/lib.
usr/lib/jvm/java-1.8.0-ibm-1.8.0.3.20-1jpp.1.el7_2.x86_64/jre/bin/java -Xms100m -Xmx500m $'-Dcom.sun.management.jmxremote\r' \
-Dflume.monitoring.type=http \
-Dflume.monitoring.port=34545 \
-cp '/staging001/Flume/server/conf://lib/*:/lib/*' \
-Djava.library.path= org.apache.flume.node.Application \
-f /staging001/Flume/server/conf/flume.conf -n client
So, if you look at the flume-ng script,
There's FLUME_CLASSPATH setup, which if absent it is setup based on FLUME_HOME.
# prepend $FLUME_HOME/lib jars to the specified classpath (if any)
if [ -n "${FLUME_CLASSPATH}" ] ; then
FLUME_CLASSPATH="${FLUME_HOME}/lib/*:$FLUME_CLASSPATH"
else
FLUME_CLASSPATH="${FLUME_HOME}/lib/*"
fi
So make sure either of those environments is set. With FLUME_HOME set, (I'm using systemd)
Environment=FLUME_HOME=/staging001/Flume/server/
Here's the working java exec.
/usr/lib/jvm/java-1.8.0-ibm-1.8.0.3.20-1jpp.1.el7_2.x86_64/jre/bin/java -Xms100m -Xmx500m \
$'-Dcom.sun.management.jmxremote\r' \
-Dflume.monitoring.type=http \
-Dflume.monitoring.port=34545 \
-cp '/staging001/Flume/server/conf:/staging001/Flume/server/lib/*:/lib/*' \
-Djava.library.path= org.apache.flume.node.Application \
-f /staging001/Flume/server/conf/flume.conf -n client
Have a strange problem with jython script execution in WAS70 (solaris):
wsadmin.sh in interactive mode versus with -f option.
AdminConfig.show('') works in the interactive mode of the wsadmin.sh
but it doesn't show any output when run with wsadmin.sh -lang jython -f ./
I suspect something is not loaded when used with wsadmin.sh -f
what is the difference running wsadmin.sh in interactive mode like
/bin/wsadmin.sh -lang jython
versus
/bin/wsadmin.sh -lang jython -f ./
How do I determine what is being loaded(like property files) in both mode?
Thx
Ronin
I have an idea...
Make sure you use "-lang jython" when you call wsadmin
Do you just use "AdminConfig.show('')" in the script?
If you do, I think you need "print AdminConfig.show('')" else the string the command returns goes nowhere.