Domanda

I'm want to enable JMX on tomcat7-maven-plugin. How do I pass in CATALINA_OPTS to plugin configuration?

È stato utile?

Soluzione 2

Added below line to my .profile

   export MAVEN_OPTS="-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=9000 -Xmx1024m -XX:MaxPermSize=256m -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=1099 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false"

Altri suggerimenti

Two possible solutions (not tested):

if you want to enabled jmxremote.authenticate then use this.

in setenv.sh

 -Dcom.sun.management.jmxremote.port=7091 \
 -Dcom.sun.management.jmxremote.ssl=false \
 -Dcom.sun.management.jmxremote.authenticate=true \
 -Djava.rmi.server.hostname=127.0.0.1 \
 -Dcom.sun.management.jmxremote.password.file=/usr/tomcat/conf/jmxremote.password \
 -Dcom.sun.management.jmxremote.access.file=/usr/tomcat/conf/jmxremote.access"

vi jmxremote.access file

monitor   readonly
admin     readwrite \
              create javax.management.monitor.*,javax.management.timer.* \
              unregister

vi jmxremote.password file

monitor pass1
admin pass2

change permission

sudo chown tomcat7:tomcat7 /usr/tomcat/conf/jmxremote.*
sudo chmod 0600 /usr/tomcat/conf/jmxremote.*

Controlling the Ports we need to add jmx listener
/usr/tomcat/conf/server.xml file like this:

<Listener className="org.apache.catalina.mbeans.JmxRemoteLifecycleListener"
  rmiRegistryPortPlatform="7091" rmiServerPortPlatform="7091" />

add jmx jar file inside tomcat lib:/usr/tomcat/lib/.

The jar we are looking for is called catalina-jmx-remote.jar.

Restart tomcat then try to connect using jconsole or jvisualvm

reference :
1. https://blog.markshead.com/1129/connecting-visual-vm-to-tomcat-7/
2.https://geekflare.com/enable-jmx-tomcat-to-monitor-administer/#:~:text=JMX%20(Java%20Management%20Extension)%20is,Classes%2C%20and%20configure%20various%20MBeans.
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top