Tomcat 6,JMX和动态端口问题 [英] Tomcat 6, JMX and the dynamic port problem

查看:583
本文介绍了Tomcat 6,JMX和动态端口问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在阅读并尝试了很多之后,我不得不问是否有人能解决我的问题。



我正在尝试设置一些Tomcats(V6)在防火墙后面。这没什么大不了的 - 但是我想通过JMX监视它们。



我读了TC文档并遇到了 JMXRemoteLifecycleListener 。我的测试TC安装完全按照上面的链接进行设置。
因此,我没有从我们网络中的一个主机到另一个主机的连接。另外,每次启动TC时都会打开第三个随机端口。



在我的server.xml中,监听器被激活

 < Listener className =org.apache.catalina.mbeans.JmxRemoteLifecycleListener
rmiRegistryPortPlatform =8050rmiServerPortPlatform =8060/>

catalina.out表示一切正常。

  2011-06-14 16:46:48,819 [main] INFO org.apache.catalina.mbeans.JmxRemoteLifecycleListener- 
JMX Remote Listener已在端口上配置注册表8050和平台服务器端口8060上的服务器

端口是打开的,我可以连接到它们通过telnet从任何其他主机。我可以使用( service:jmx:rmi://< hostname>:8xxx / jndi / rmi://< hostname>:8xxxx / jmxrmi



Netstats输出如下:

  tcp6 0 0 ::: 8080 ::: * LISTEN 11291 / java 
tcp6 0 0 ::: 8050 ::: * LISTEN 11291 / java
tcp6 0 0 ::: 8060 ::: * LISTEN 11291 / java
tcp6 0 0 127.0.0.1:8005 ::: * LISTEN 11291 / java
tcp6 0 0 ::: 60901 ::: * LISTEN 11291 / java
tcp6 0 0 127.0 .0.1:8009 ::: * LISTEN 11291 / java

Tomcat甚至以所有足够的VM选项启动

  CATALINA_OPTS = -  Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.ssl = false 
-Dc om.sun.management.jmxremote.authenticate = TRUE
-Dcom.sun.management.jmxremote.password.file = $ CATALINA_HOME / conf / jmxremote.password
-Dcom.sun.management.jmxremote.access .file = $ CATALINA_HOME / conf / jmxremote.access

有没有人提示我为什么被卡住了这里?提前致谢!

解决方案

答案是放置 -Djava.rmi.server.hostname = xxx。 xxx.xxx.xxx 一般JMX选项。



自动设置主机名的示例:

  IP =`ifconfig eth0 | grep'inet'| grep -v'127.0.0.1'| cut -d:-f2 | awk'{print $ 1}'``; 

CATALINA_OPTS = - Dcom.sun.management.jmxremote
-Dcom.sun.management.jmxremote.ssl = false
-Dcom.sun.management.jmxremote.authenticate = TRUE
-Dcom.sun.management.jmxremote.password.file = $ CATALINA_HOME / conf / jmxremote.password
-Dcom.sun.management.jmxremote.access.file = $ CATALINA_HOME / conf / jmxremote。访问
-Djava.rmi.server.hostname = $ IP


after reading and trying a lot around, I have to ask if anyone has a solution for my problem.

I am trying to set up some Tomcats (V6) behind a firewall. This is no big deal - but I want to monitor them via JMX.

I read the TC docu and came across the JMXRemoteLifecycleListener. My test TC installation is set up exactly as stated in the above link. Thus I don't get a connection from one host in our network to another. Additionally a third, random port is open every time I start TC.

In my server.xml the listener is activated

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

catalina.out says that everything is okay.

2011-06-14 16:46:48,819 [main] INFO org.apache.catalina.mbeans.JmxRemoteLifecycleListener-
The JMX Remote Listener has configured the registry on port 8050 and the server on port 8060 for the Platform server

The ports are open, I can connect to them via telnet from any other host. I am able to connect to to the vm locally with (service:jmx:rmi://<hostname>:8xxx/jndi/rmi://<hostname>:8xxxx/jmxrmi)

Netstats output is as follows:

tcp6       0      0 :::8080                 :::*                    LISTEN      11291/java
tcp6       0      0 :::8050                 :::*                    LISTEN      11291/java
tcp6       0      0 :::8060                 :::*                    LISTEN      11291/java
tcp6       0      0 127.0.0.1:8005          :::*                    LISTEN      11291/java
tcp6       0      0 :::60901                :::*                    LISTEN      11291/java
tcp6       0      0 127.0.0.1:8009          :::*                    LISTEN      11291/java

Tomcat is even started with all sufficient VM options

CATALINA_OPTS="-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.ssl=false
-Dcom.sun.management.jmxremote.authenticate=TRUE 
-Dcom.sun.management.jmxremote.password.file=$CATALINA_HOME/conf/jmxremote.password
-Dcom.sun.management.jmxremote.access.file=$CATALINA_HOME/conf/jmxremote.access"

Does anyone has a hint why I am stuck here? Thanks in advance!

解决方案

The answer is putting -Djava.rmi.server.hostname=xxx.xxx.xxx.xxx to the general JMX options.

An example to automatically set the hostname:

IP=`ifconfig eth0  | grep 'inet '| grep -v '127.0.0.1' | cut -d: -f2 | awk '{ print $1}'``;

CATALINA_OPTS="-Dcom.sun.management.jmxremote
-Dcom.sun.management.jmxremote.ssl=false
-Dcom.sun.management.jmxremote.authenticate=TRUE
-Dcom.sun.management.jmxremote.password.file=$CATALINA_HOME/conf/jmxremote.password
-Dcom.sun.management.jmxremote.access.file=$CATALINA_HOME/conf/jmxremote.access
-Djava.rmi.server.hostname=$IP"

这篇关于Tomcat 6,JMX和动态端口问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆