I'm want to enable JMX on tomcat7-maven-plugin. How do I pass in CATALINA_OPTS to plugin configuration?
Asked
Active
Viewed 2,781 times
4
-
Where you able to get this working? I'm running into a similar issue where it appears the systemProperties are loaded but I cannot connect to the JMX process – amadib Mar 27 '14 at 18:21
-
1Added 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" – aug70co Mar 28 '14 at 19:24
-
You should make your comment an answer and accept it. – Stefan Aug 11 '15 at 07:45
3 Answers
0
Two possible solutions (not tested):
- add sys props in MAVEN_OPTS
- or try http://tomcat.apache.org/maven-plugin-2.2/tomcat6-maven-plugin/examples/add-system-properties.html which work for tomcat7 too.

Olivier Lamy
- 2,280
- 1
- 14
- 12
0
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"

aug70co
- 3,965
- 5
- 30
- 44
0
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.

Mugeesh Husain
- 394
- 4
- 13