Tomcat has an extra-jar "catalina-jmx-remote.jar" which permits to use two fixed ports (instead of dynamic ports) for JMX. I am using the following patches currently: --- /var/repositories/gentoo-x86/www-servers/tomcat/tomcat-6.0.37.ebuild 2013-10-15 23:17:42.000000000 +0200 +++ /var/repositories/mine/www-servers/tomcat/tomcat-6.0.37.ebuild 2013-10-16 15:23:52.000000000 +0200 @@ -17,7 +17,7 @@ LICENSE="Apache-2.0" SLOT="6" KEYWORDS="amd64 ppc ppc64 x86 ~x86-fbsd" -IUSE="extra-webapps" +IUSE="extra-jmx-remote extra-webapps" RESTRICT="test" @@ -69,6 +69,11 @@ src_compile() { EANT_GENTOO_CLASSPATH_EXTRA+=":$(java-pkg_getjar --build-only ant-core ant.jar)" java-pkg-2_src_compile + if use extra-jmx-remote ; then + EANT_BUILD_TARGET="jmx-remote" + EANT_BUILD_XML="extras.xml" + java-pkg-2_src_compile + fi } EANT_TEST_GENTOO_CLASSPATH="${EANT_GENTOO_CLASSPATH},junit-4" @@ -87,6 +92,7 @@ java-pkg_jarinto "${dest}"/lib java-pkg_dojar output/build/lib/*.jar + use extra-jmx-remote && java-pkg_dojar output/extras/catalina-jmx-remote.jar # so we don't have to call java-config with --with-dependencies, which might # bring in more jars then actually desired. --- /var/repositories/gentoo-x86/www-servers/tomcat/tomcat-7.0.42.ebuild 2013-10-15 23:17:42.000000000 +0200 +++ /var/repositories/mine/www-servers/tomcat/tomcat-7.0.42.ebuild 2013-10-16 16:06:17.000000000 +0200 @@ -17,7 +17,7 @@ LICENSE="Apache-2.0" SLOT="7" KEYWORDS="amd64 ppc ppc64 x86 ~x86-fbsd ~x86-freebsd ~amd64-linux ~x86-linux ~x86-solaris" -IUSE="extra-webapps" +IUSE="extra-jmx-remote extra-webapps" RESTRICT="test" # can we run them on a production system? @@ -67,6 +67,7 @@ src_compile() { EANT_GENTOO_CLASSPATH_EXTRA+=":$(java-pkg_getjar --build-only ant-core ant.jar)" + use extra-jmx-remote && EANT_BUILD_TARGET+=" extras-jmx-remote" java-pkg-2_src_compile } @@ -86,6 +87,7 @@ java-pkg_jarinto "${dest}"/lib java-pkg_dojar output/build/lib/*.jar + use extra-jmx-remote && java-pkg_dojar output/extras/catalina-jmx-remote.jar # so we don't have to call java-config with --with-dependencies, which might # bring in more jars then actually desired. /www-servers/tomcat/metadata.xml --- /var/repositories/gentoo-x86/www-servers/tomcat/metadata.xml 2012-07-24 07:25:16.000000000 +0200 +++ /var/repositories/mine/www-servers/tomcat/metadata.xml 2013-10-16 15:32:16.000000000 +0200 @@ -9,6 +9,7 @@ Sun under the Java Community Process. </longdescription> <use> + <flag name='extra-jmx-remote'>Build and install the optional jmx-remote jar</flag> <flag name='extra-webapps'>Build also the docs and examples webapp</flag> </use> </pkgmetadata>