I trying to connect remote jvm, used jvisualvm.
I started server with this parameters:
-Dcom.sunmanagement.jmxremote=true
-Dcom.sun.management.jmxremote.port=15001
-Dcom.sun.management.jmxremote.authenticate=false
-Dcom.sun.management.jmxremote.ssl=false
and i have this error:
Error: Exception thrown by the agent : java.lang.NullPointerException
when i removed this parameters:
-Dcom.sun.management.jmxremote.authenticate=false
-Dcom.sun.management.jmxremote.ssl=false
i have another error, like this:
Error: Password file not found: /var/lib/openshift/5406e3aa500446a793000178/
wildfly/usr/lib/jvm/jdk1.8.0_05/jre/lib/management/jmxremote.password
Question. How configure server for jmx remote connetion?
I used action hooks for init java parameters.
May be exists another tools for monitoring jvm?
My guess is that trying to use jmx remoting bind per default to 0.0.0.0 (aka all network interfaces). However, on Openshift you can only bind to $OPENSHIFT_INTERNAL_IP. The error seems cryptic, but that might be caused by https://bugs.openjdk.java.net/browse/JDK-8048050.
Related
Trying configure Prometheus JMX agent for Jmeter but faced following issue - when I start Jmeter outside of $JMETER_HOME/bin folder - it fails with an error:
java.lang.Throwable: Could not access null/lib
at org.apache.jmeter.NewDriver.<clinit>(NewDriver.java:105)
java.lang.Throwable: Could not access null/lib/ext
at org.apache.jmeter.NewDriver.<clinit>(NewDriver.java:105)
java.lang.Throwable: Could not access null/lib/junit
at org.apache.jmeter.NewDriver.<clinit>(NewDriver.java:105)
java.lang.ClassNotFoundException: org.apache.jmeter.JMeter
at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
at org.apache.jmeter.NewDriver.main(NewDriver.java:250)
JMeter home directory was detected as: null
Launch command:
java -Dcom.sun.management.jmxremote.port=12021 -Dcom.sun.management.jmxremote.rmi.port=12021 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -Dgroovy.use.classvalue=true -javaagent:/apps/injector/apache-jmeter/bin/jmx_prometheus_javaagent-0.13.0.jar=8778:/apps/injector/apache-jmeter/bin/prometheus_config.yaml -jar /apps/injector/apache-jmeter/bin/ApacheJMeter.jar -n -t /apps/injector/apache-jmeter/extras/Test.jmx
Same command works fine in case I run it from $JMETER_HOME/bin folder.
It's not seems to be a Jmeter issue itself, as I can run same command from any place, and it will not cause an error in case I remove -javaagent option.
Can somebody help me configure Prometheus JMX agent for properly work with Jmeter.
Add to java options of JMeter:
-Djmeter.home=$JMETER_HOME
As per your bugzilla ticket:
https://bz.apache.org/bugzilla/show_bug.cgi?id=64680
Credit to Felix S. member of JMeter team
I have a SpringBoot Application which internally communicate with the JMS and activeMQ. I have a .cmd file to start that application. I have added arguments to enable remote debugging, so I can debug the application in eclipse. The cmd file as below:
set JAVA_CP=./;./config;./lib/*
set JAVA_JMX=-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=10090 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false
set JAVA_CL=com.myapp.test.server.TestServer
set JAVA_OP=-Xmx280m -Xdebug -Xrunjdwp:server=y,transport=dt_socket,address=8090,suspend=n %JAVA_JMX%
"%JAVA_HOME%\bin\java" %JAVA_OP% -cp "%JAVA_CP%" %JAVA_CL%
Now when I start ActiveMQ and then my application with above .cmd file. I got following error:
18:27:53.234 [main] ERROR [o.a.coyote.http11.Http11NioProtocol] Failed to start end point associated with ProtocolHandler ["http-nio-8080"]
java.net.BindException: Address already in use: bind
If I remove the debugging arguments(-Xdebug -Xrunjdwp:server=y,transport=dt_socket,address=8090,suspend=n) from .cmd file, it works fine.
I search about this and found that it may possible that two instances are running, but I verified that also. Can you please help?
I followed this SO post:
What are Java command line options to set to allow JVM to be remotely debugged?
and was able to remotely debug my Java app that runs as a windows service through prunsrv / procrun.
When I run the service with option suspend=n, I am able to connect remote debugger through eclipse:
myservice.exe //US//myservice --JvmOptions "-agentlib:jdwp=transport=dt_socket,address=127.0.0.1:8111,server=y,suspend=n"
but when I give option suspend=y, I get the following error:
Commons Daemon procrun failed with exit value: 5 (Failed to start
service)
any idea why suspend=y is resulting in this error. (Unfortunately detailed logs for prunsrv are not generated)
I am running a java app as a service using procrun. The app is running fine when the JMX authentication is not enabled, but when I add an access and password files, restrict permissions on the password file and enable the JMX authentication, the app is not starting and giving 1074: The process terminated unexpectedly error.
Below is the script I am using to register the app as a service using the latest version of procrun.
cd E:\MyApp
MyApp.exe //IS//MyApp --Install=%cd%\MyApp.exe --Jvm="C:\Program Files\Java\jdk1.8.0_131\jre\bin\server\jvm.dll" --JvmMx=2048 --JvmMs=2048 --Startup=auto --StartMode jvm --StartClass com.MyApp --StartParams start --StartMethod start --StopMode jvm --StopClass com.MyApp --StopParams stop --StopMethod stop --Classpath=%cd%\MyApp.jar --LibraryPath=%cd%\bin --JvmOptions="-Duser.dir=%cd%" ++JvmOptions=-XX:+RelaxAccessControlCheck ++JvmOptions=-Dcom.sun.management.jmxremote ++JvmOptions=-Dcom.sun.management.jmxremote.port=1099 ++JvmOptions=-Dcom.sun.management.jmxremote.ssl=false ++JvmOptions=-Dcom.sun.management.jmxremote.authenticate=true ++JvmOptions=-Dcom.sun.management.jmxremote.access.file=E:\MyApp\Conf\jmxremote.access ++JvmOptions=-Dcom.sun.management.jmxremote.password.file=E:\MyApp\Conf\jmxremote.password --JvmOptions=-XX:+UseConcMarkSweepGC --JvmOptions=-XX:CMSInitiatingOccupancyFraction=40 ++JvmOptions=-Dorg.xml.sax.parser="com.sun.org.apache.xerces.internal.parsers.SAXParser" ++JvmOptions=-Djavax.xml.parsers.DocumentBuilderFactory="com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl" ++JvmOptions=-Djavax.xml.parsers.SAXParserFactory="com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl" --LogPath=E:\Logs --LogLevel=DEBUG --StdOutput=auto --StdError=auto --StartPath=%cd% --StopPath=%cd% --DisplayName=MyApp
Any clues on what could be wrong?
I think there is a problem with your password file. At first just use a simple jmx configuration like mine. Here is my simple JMX configuration for startup:
-Dcom.sun.management.jmxremote
-Dcom.sun.management.jmxremote.port=11099
-Dcom.sun.management.jmxremote.ssl=false
-Dcom.sun.management.jmxremote.authenticate=false
-Dcom.sun.management.jmxremote.local.only=false
-Djava.rmi.server.hostname=localhost
-Dcom.sun.management.jmxremote.rmi.port=11098
I started the command "heroku ps:forward 9090 --app [app-name]". I added a "Remote" debug configuration in IntelliJ, and set host to "localhost" and port to "9090". I start the debugger, and after a while I get this message:
"Error running '[configuration name]': Unable to open debugger port (localhost:9090): java.io.IOException "handshake failed - connection prematurely closed".
I checked with netstat that port 9090 is actually listening for a connection.
So it turns out that in order to enable debugging with heroku, you need a "Procfile". It is possible to run an instance without this file, but then the default parameters are used (and that's obviously what we were doing).
After adding this "Procfile", debugging finally works:
web: java -Dserver.port=$PORT $JAVA_OPTS -agentlib:jdwp=transport=dt_socket,server=y,address=9090,suspend=n -jar target/<.jar file>