0

I am trying to run 2 instance of tomcat on a single. I have updated server.xml for both the tomcat instance so that the http/https ports are different. Also I have updated CATALINA_OPTS in the setenv.sh so that remote jmx port is different.

CATALINA_OPTS for tomcat 1:

CATALINA_OPTS="-Dcom.sun.management.jmxremote \
    -Dcom.sun.management.jmxremote.port=7061 \
    -Dcom.sun.management.jmxremote.ssl=false \
    -Dcom.sun.management.jmxremote.authenticate=false \
    -javaagent:/mnt/production/tomcat/bin/remoteagent.jar"

CATALINA_OPTS for tomcat 2:

CATALINA_OPTS="-Dcom.sun.management.jmxremote \
    -Dcom.sun.management.jmxremote.port=7065 \
    -Dcom.sun.management.jmxremote.ssl=false \
    -Dcom.sun.management.jmxremote.authenticate=false \
    -javaagent:/mnt/production/tomcat/bin/remoteagent.jar \
    -Djava.security.auth.login.config=$CATALINA_HOME/conf/crowd.conf"

But when I try to start the second instance of tomcat I get a bind exception on port 3000. I greped the logs for 1st instance of tomcat and I see the following line in the catalina log file:

Created service URL service:jmx:rmi://localhost:3001/jndi/rmi://localhost:3000/jmxrmi

I greped the entire tomcat directory for 3000 but there isn't a config regarding port 3000. So I think this is some default config. Does someone know how to modify this config.

BMW
  • 42,880
  • 12
  • 99
  • 116
KunalC
  • 524
  • 1
  • 7
  • 20

2 Answers2

0

server.xml is used to set tomcat server ports,such as http, https, shutdown, AJP, etc. But not for jmx remote.

Seems you have a separate environment file setenv.sh (unix) or setenv.bat (windows) which set JMX connection URL

Attribute   Description               Example
url         Set JMX connection URL    service:jmx:rmi:///jndi/rmi://localhost:8050/jmxrmi

Please find it out in second instance and update to other port.

Here is the document for tomcat 6 regarding jmx remote setting. https://tomcat.apache.org/tomcat-6.0-doc/monitoring.html

If you still can't find the port in which file, please confirm the command you used to grep entire tomcat directory

cd $TOMCAT_HOME
find . -type f -exec grep -l 3000 {} \;
BMW
  • 42,880
  • 12
  • 99
  • 116
0

You can set -Dcom.sun.management.jmxremote.port=%my.jmx.port% in CATALINA_OPTS on order to change the JMX port.

rossa
  • 119
  • 5