I am trying to connect to a remote tomcat JMX instance using jConsole. But can't connect successfully. Any Idea?
我正在尝试使用jConsole连接到远程tomcat JMX实例。但是不能连接成功。任何想法?
I included the following option in remote tomcat catalina.sh
:
我在远程tomcat catalina.sh中包含了以下选项:
JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.jmxremote \
-Dcom.sun.management.jmxremote.port=9004 \
-Dcom.sun.management.jmxremote.ssl=false \
-Dcom.sun.management.jmxremote.authenticate=false"
12 个解决方案
#1
63
I had a similar, if not the same, problem. I could connect to the JMX server if I started jconsole locally on the machine.
我有一个类似的问题,如果不一样的话。如果我在机器上本地启动jconsole,我可以连接到JMX服务器。
It appears the RMI server was not listening on the correct ip. So, as was suggested in this related question, I added the following:
似乎RMI服务器没有监听正确的ip。因此,正如这个相关问题中所建议的,我补充了以下内容:
-Djava.rmi.server.hostname=<host ip>
to JAVA_OPTS
as well, and then it worked.
对于JAVA_OPTS也是这样,然后它就工作了。
#2
36
I've collected information spread over the net, found with hints from other members.
我收集了网上的信息,并从其他会员那里得到了一些提示。
Most pain caused by JMX is (imo) the fact that JMX opens a second dynamically allocated network port. A firewall (like iptables) will block this.
JMX所带来的最大痛苦是(在我看来)JMX打开了第二个动态分配的网络端口。防火墙(如iptables)将阻止这一点。
Solution for tomcat on linux :
linux上tomcat的解决方案:
use tomcat 6.0.24 or newer download catalina-jmx-remote.jar from apache tomcat extras (use browse on tomcat download page) copy it in the $CTALINA_HOME\lib
使用tomcat 6.0.24或更新的catalina-jmx-remote下载。来自apache tomcat附加组件的jar(使用tomcat下载页面上的浏览)可以在$CTALINA_HOME\lib中复制它
This allows you to set both ports used by JMX
这允许您设置JMX使用的两个端口
edit Server section in your server.xml
在服务器.xml中编辑服务器部分。
<Server port="8005" ..>
...
<Listener className="org.apache.catalina.mbeans.JmxRemoteLifecycleListener" rmiRegistryPortPlatform="9840" rmiServerPortPlatform="9841"/>
set some environment variables (e.g. in setenv.sh)
设置一些环境变量(例如在setenv.sh中)
CATALINA_OPTS="
-Djava.rmi.server.hostname=IP-TO-LISTEN
-Dcom.sun.management.jmxremote.password.file=$CATALINA_BASE/conf/jmxremote.password
-Dcom.sun.management.jmxremote.access.file=$CATALINA_BASE/conf/jmxremote.access
-Dcom.sun.management.jmxremote.ssl=false"
this activates access control for JMX
这将激活JMX的访问控制
jmxremote.access will look like
现在。访问的样子
monitorRole readonly
controlRole readwrite
end jmxremote.password will be
现在结束。密码将
monitorRole tomcat
controlRole tomcat
(just simple spaces)
(只是简单的空间)
restart tomcat.
重新启动tomcat。
Now configure firewall on the server (e.g. iptables)
现在在服务器上配置防火墙(例如iptables)
/etc/sysconfig/iptables
/etc/sysconfig/iptables
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 9840 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 9841 -j ACCEPT
and /etc/sysconfig/ip6tables
和/etc/sysconfig/ip6tables
-A RH-Firewall-1-INPUT -m tcp -p tcp --dport 9840 -j ACCEPT
-A RH-Firewall-1-INPUT -m tcp -p tcp --dport 9841 -j ACCEPT
restart iptables
重启iptables
Done!
完成了!
Now use VisualVM or JConsole on your workstation to establish a connection to rmiRegistryPortPlatform, 9840 in our sample.
现在,在您的工作站上使用VisualVM或JConsole来建立与rmiRegistryPortPlatform的连接,在我们的示例中为9840。
If there are no more firewalls between workstation and server it should work.
如果工作站和服务器之间没有防火墙,它应该工作。
#3
11
Tried with Java 8
1. Add this to your java tomcat startup script:
-Dcom.sun.management.jmxremote.port=1616
-Dcom.sun.management.jmxremote.rmi.port=1616
-Dcom.sun.management.jmxremote.ssl=false
-Dcom.sun.management.jmxremote.authenticate=false
-Dcom.sun.management.jmxremote.local.only=false
-Djava.rmi.server.hostname=localhost
for example add into bin/setenv.sh this:
例如添加到bin/setenv。承宪:
export CATALINA_OPTS="$CATALINA_OPTS \
-Dcom.sun.management.jmxremote.port=1616 \
-Dcom.sun.management.jmxremote.rmi.port=1616 \
-Dcom.sun.management.jmxremote.local.only=true \
-Dcom.sun.management.jmxremote.authenticate=false \
-Dcom.sun.management.jmxremote.ssl=false "
2. Execute this on your computer.
-
Windows users:
Windows用户:
putty.exe -ssh user@remote-host -L 1616:remote-host:1616
腻子。exe -ssh user@remote-host -L 1616:remote-host:1616
-
Linux and Mac Users:
Linux和Mac用户:
ssh user@remote-host -L 1616:remote-host:1616
ssh user@remote-host - l 1616:远程主机:1616
3. Start jconsole
on your computer
jconsole localhost:1616
4. Have fun!
- P.S.: during step 2, using
ssh
and-L
you specify that the port 1616 on the local (client) host is to be forwarded to the remote side. - 注::在步骤2中,使用ssh和-L,您指定本地(客户端)主机上的1616端口将被转发到远程端。
- P.S.2.: you can specify same port for JMX and RMI conversations
- P.S.2。:您可以为JMX和RMI会话指定相同的端口
#4
8
what string are you using as the JMX connection url. I don't mean to point out the obvious but JConsole has a terrible interface and to me requires an overly complex url before it will connect to a remote jmx app. Mine looks like this:
您使用什么字符串作为JMX连接url。我并不是指很明显,但是JConsole有一个糟糕的接口,我需要一个过于复杂的url才能连接到一个远程jmx应用程序。
service:jmx:rmi:///jndi/rmi://(hostname):(jmxport)/jmxrmi
#5
3
Enable JMX in Tomcat8, successfully tested in my POC
1/ Download the catalina-jmx-remote.jar
from apache website and place in $CATALINA_HOME/lib
.
1 /下载catalina-jmx-remote。jar从apache网站和$CATALINA_HOME/lib中放置。
2/ Take server.xml
/ setenv.sh
backup. Make the changes to server.xml
like below-
2 /服务器。xml / setenv。sh备份。对服务器进行更改。xml像下面,
<Listener className="org.apache.catalina.mbeans.JmxRemoteLifecycleListener" rmiRegistryPortPlatform="10001" rmiServerPortPlatform="10002" />
3/ Make the changes to $CATALINA_BASE/bin/setenv.sh
like -
3/修改为$CATALINA_BASE/bin/setenv。上海,
[...]
JVM_OPTS="[...]
-Dcom.sun.management.jmxremote
-Dcom.sun.management.jmxremote.authenticate=true
-Djava.rmi.server.hostname=<eth:0_IP>| <`hostname -i`>
-Dcom.sun.management.jmxremote.password.file=/apps/data/apache-tomcat-8_8080/conf/jmxremote.password
-Dcom.sun.management.jmxremote.access.file=/apps/data/apache-tomcat-8_8080/conf/jmxremote.access
-Dcom.sun.management.jmxremote.ssl=false
-Dcom.sun.management.jmxremote.local.only=false
-Dcom.sun.management.jmxremote=true "
4/ Create these two files as - $touch $CATALINA_BASE/conf/jmxremote.password
containing:
4/创建这两个文件- $touch $CATALINA_BASE/conf/jmxremote。密码包含:
admin letmein
管理letmein
$touch $CATALINA_BASE/conf/jmxremote.access
containing:
触摸CATALINA_BASE / conf /现在美元。访问包含:
admin readwrite
管理读写
$ chmod 600 jmxremote.password
5/ Restart tomcat and test on jconsole tool :)
5/重启tomcat,并在jconsole工具上进行测试:)
$echo|telnet 10.105.14.90 10001
#6
2
What exactly do you mean when you say "But can't connect successfully."? Is there an error message? Try turning on logging in jconsole and see if that helps debug it.
当你说“但是不能成功地连接”的时候,你到底是什么意思?有错误消息吗?尝试打开jconsole中的日志记录,看看这是否有助于调试它。
To turn on jconsole logging, edit a file named logging.properties in the directory you will be running jconsole in, add:
要打开jconsole日志记录,请编辑一个名为logging的文件。在您将要运行jconsole的目录中,添加:
handlers= java.util.logging.ConsoleHandler
.level=INFO
java.util.logging.FileHandler.pattern = %h/java%u.log
java.util.logging.FileHandler.limit = 50000
java.util.logging.FileHandler.count = 1
java.util.logging.FileHandler.formatter = java.util.logging.XMLFormatter
java.util.logging.ConsoleHandler.level = FINEST
java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter
javax.management.level=FINEST
javax.management.remote.level=FINEST
Then, start jconsole with:
然后,启动jconsole:
jconsole -J-Djava.util.logging.config.file=logging.properties
#7
2
if you are working on linux, modify the catalina.sh file adding:
如果您正在使用linux,请修改catalina。sh文件添加:
CATALINA_OPTS="-Dcom.sun.management.jmxremote -Djava.rmi.server.hostname=<HOST_IP> -Dcom.sun.management.jmxremote.port=<HOST_PORT> -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false"
export CATALINA_OPTS
or modify the /etc/profile file as root and rerun the file (source /etc/profile)
或者以root身份修改/etc/profile文件并重新运行该文件(源/etc/profile)
if you are working on windows and you are starting tomcat from the command line, use the environment variable CATALINA_OPTS
如果您正在操作windows,并且正在从命令行启动tomcat,那么请使用环境变量CATALINA_OPTS
if you are working on windows and you are starting tomcat as a service, you'll need to use the monitor service utility to configure the service initialization parameters (neither setenv.bat, catalina.bat or env-vars will work). for that you'll need the service name that appears listed in services.msc (for example jasperreportsTomcat). After, you'll need to open a console as administrator and execute (for example): tomcat6w.exe //MS//jasperreportsTomcat
如果您正在使用windows,并且正在将tomcat作为服务启动,那么您将需要使用monitor服务实用程序来配置服务初始化参数(两个都不是setenv)。蝙蝠,卡特琳娜。bat或env-vars可以工作)。为此,需要在服务中列出的服务名称。msc(例如jasperreportsTomcat)。之后,需要以管理员身份打开控制台并执行(例如):tomcat6w。exe / / / / jasperreportsTomcat女士
with this command will appear a tray icon where you can open a panel. In the "Java" tab now you can modify the jmx options. Be careful to not add trailing whitespaces and use the "[enter]" symbol to separate each option line by line.
使用此命令将显示一个托盘图标,您可以在其中打开面板。在“Java”选项卡中,现在可以修改jmx选项。注意不要添加拖尾白括号,并使用“[enter]”符号逐行分隔每个选项。
-Dcom.sun.management.jmxremote
-Djava.rmi.server.hostname=192.168.61.101
-Dcom.sun.management.jmxremote.port=9999
-Dcom.sun.management.jmxremote.ssl=false
-Dcom.sun.management.jmxremote.authenticate=false
Hope it helps
希望它能帮助
#8
1
Check if your server is behind the firewall. JMX is base on RMI, which open two port when it start. One is the register port, default is 1099, and can be specified by the com.sun.management.jmxremote.port option. The other is for data communication, and is random, which is what cause problem. A good news is that, from JDK6, this random port can be specified by the com.sun.management.jmxremote.rmi.port option.
检查服务器是否在防火墙之后。JMX的基础是RMI,它在启动时打开两个端口。一个是寄存器端口,默认是1099,可以由com.sun.management.jmxremote指定。端口选项。另一种是数据通信,是随机的,这是造成问题的原因。好消息是,这个随机端口可以由com.sun.management.jmxremote.rmi指定。端口选项。
add the line in you {tomcat_dir}/bin/setenv.sh:
在您{tomcat_dir}/bin/setenv.sh中添加一行:
export CATALINA_OPTS="-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=8991 -Dcom.sun.management.jmxremote.rmi.port=8991 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false"
#9
1
I got something for all of you, in order to complete the investigation of this whole thing. There is a trick, it happens that profiler tool connnects with the jvm using a port, but the jvm continues the conversation using another random port. If the jvm is running inside a remote machine (for example : a tomcat web-app server), and the remote machine has protection against outgoing and incoming connections, you must set the java system property com.sun.management.jmxremote.rmi.port
to the same value of the property named com.sun.management.jmxremote.port
我为你们所有人准备了一些东西,为了完成整个调查。有一个技巧,profiler工具使用端口与jvm连接,但是jvm使用另一个随机端口继续对话。如果jvm在远程机器中运行(例如:tomcat web应用程序服务器),并且远程机器具有对传出和传入连接的保护,则必须设置java system属性com.sun.management.jmxremote.rmi。端口到名为com.sun.management.jmxremote.port的属性的相同值
Source : https://serverfault.com/questions/308662/how-do-i-fix-a-failed-to-retrieve-rmiserver-stub-jmx-error And also check this out : http://blog.cantremember.com/debugging-with-jconsole-jmx-ssh-tunnels/
来源:https://serverfault.com/questions/308662/how-do-i-fix-a-failed to retrieve-rmiserver-stub-jmx-error,并检查这个:http://blog.cantmember.com/debugging-with -jconsole-jmx-ssh-tunnels/
Hope to contribute guys!
希望能贡献的人!
And good luck!
,祝你好运!
#10
0
Well, I had this problem in a Linux box (virtual machine) and I fixed it using -Djava.rmi.server.hostname property but there's a thing I can't understand. My machine has 5 tomcat servers, all of them has jmx enabled in consecutive ports (8008,8018,8028...) and only one of them had this issue connecting JMX. No firewall, no -Djava.rmi.server.hostname property in any tomcat....
我在Linux(虚拟机)中遇到了这个问题,我用-Djava.rmi.server修复了这个问题。hostname属性,但有一件事我不能理解。我的机器有5个tomcat服务器,它们都在连续的端口上启用了jmx(8008、8018,8028…),其中只有一个具有连接jmx的问题。没有防火墙,-Djava.rmi.server。主机名财产在任何tomcat ....
So the thing is that I understand the problem but I can't understand why 4 of my tomcats worked and 1 of them not.
问题是我理解这个问题但我不明白为什么我的4只猫会工作,1只不会。
P.D: My english is very poor, I know. My Apologies.
P。我知道我的英语很差。我的歉意。
#11
0
PROTIP: You need to fix (as in having a known number) the RMI Registry and JMX/RMI Server ports. You do this by putting jar-file in the lib-dir and configuring a special listener. (And ofcourse the usual flags for activating JMX
PROTIP:您需要修复RMI注册表和JMX/RMI服务器端口(如拥有已知的数字)。通过将jar文件放入lib-dir并配置一个特殊的侦听器,可以实现这一点。(当然还有激活JMX的常用标志
-Dcom.sun.management.jmxremote \
-Dcom.sun.management.jmxremote.port=8999 \
-Dcom.sun.management.jmxremote.ssl=false \
-Dcom.sun.management.jmxremote.authenticate=false \
-Djava.rmi.server.hostname=<HOSTNAME> \
See: JMX Remote Lifecycle Listener at http://tomcat.apache.org/tomcat-6.0-doc/config/listeners.html
参见:JMX远程生命周期监听器http://tomcat.apache.org/tomcat-6.0-doc/config/listeners.html
#12
0
Changing the /etc/hosts
on linux, where I replaced the localhost address associated to my account to the machine ip, solved this problem for me.
更改linux上的/etc/hosts(我将与帐户相关的本地主机地址替换为机器ip)为我解决了这个问题。
#1
63
I had a similar, if not the same, problem. I could connect to the JMX server if I started jconsole locally on the machine.
我有一个类似的问题,如果不一样的话。如果我在机器上本地启动jconsole,我可以连接到JMX服务器。
It appears the RMI server was not listening on the correct ip. So, as was suggested in this related question, I added the following:
似乎RMI服务器没有监听正确的ip。因此,正如这个相关问题中所建议的,我补充了以下内容:
-Djava.rmi.server.hostname=<host ip>
to JAVA_OPTS
as well, and then it worked.
对于JAVA_OPTS也是这样,然后它就工作了。
#2
36
I've collected information spread over the net, found with hints from other members.
我收集了网上的信息,并从其他会员那里得到了一些提示。
Most pain caused by JMX is (imo) the fact that JMX opens a second dynamically allocated network port. A firewall (like iptables) will block this.
JMX所带来的最大痛苦是(在我看来)JMX打开了第二个动态分配的网络端口。防火墙(如iptables)将阻止这一点。
Solution for tomcat on linux :
linux上tomcat的解决方案:
use tomcat 6.0.24 or newer download catalina-jmx-remote.jar from apache tomcat extras (use browse on tomcat download page) copy it in the $CTALINA_HOME\lib
使用tomcat 6.0.24或更新的catalina-jmx-remote下载。来自apache tomcat附加组件的jar(使用tomcat下载页面上的浏览)可以在$CTALINA_HOME\lib中复制它
This allows you to set both ports used by JMX
这允许您设置JMX使用的两个端口
edit Server section in your server.xml
在服务器.xml中编辑服务器部分。
<Server port="8005" ..>
...
<Listener className="org.apache.catalina.mbeans.JmxRemoteLifecycleListener" rmiRegistryPortPlatform="9840" rmiServerPortPlatform="9841"/>
set some environment variables (e.g. in setenv.sh)
设置一些环境变量(例如在setenv.sh中)
CATALINA_OPTS="
-Djava.rmi.server.hostname=IP-TO-LISTEN
-Dcom.sun.management.jmxremote.password.file=$CATALINA_BASE/conf/jmxremote.password
-Dcom.sun.management.jmxremote.access.file=$CATALINA_BASE/conf/jmxremote.access
-Dcom.sun.management.jmxremote.ssl=false"
this activates access control for JMX
这将激活JMX的访问控制
jmxremote.access will look like
现在。访问的样子
monitorRole readonly
controlRole readwrite
end jmxremote.password will be
现在结束。密码将
monitorRole tomcat
controlRole tomcat
(just simple spaces)
(只是简单的空间)
restart tomcat.
重新启动tomcat。
Now configure firewall on the server (e.g. iptables)
现在在服务器上配置防火墙(例如iptables)
/etc/sysconfig/iptables
/etc/sysconfig/iptables
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 9840 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 9841 -j ACCEPT
and /etc/sysconfig/ip6tables
和/etc/sysconfig/ip6tables
-A RH-Firewall-1-INPUT -m tcp -p tcp --dport 9840 -j ACCEPT
-A RH-Firewall-1-INPUT -m tcp -p tcp --dport 9841 -j ACCEPT
restart iptables
重启iptables
Done!
完成了!
Now use VisualVM or JConsole on your workstation to establish a connection to rmiRegistryPortPlatform, 9840 in our sample.
现在,在您的工作站上使用VisualVM或JConsole来建立与rmiRegistryPortPlatform的连接,在我们的示例中为9840。
If there are no more firewalls between workstation and server it should work.
如果工作站和服务器之间没有防火墙,它应该工作。
#3
11
Tried with Java 8
1. Add this to your java tomcat startup script:
-Dcom.sun.management.jmxremote.port=1616
-Dcom.sun.management.jmxremote.rmi.port=1616
-Dcom.sun.management.jmxremote.ssl=false
-Dcom.sun.management.jmxremote.authenticate=false
-Dcom.sun.management.jmxremote.local.only=false
-Djava.rmi.server.hostname=localhost
for example add into bin/setenv.sh this:
例如添加到bin/setenv。承宪:
export CATALINA_OPTS="$CATALINA_OPTS \
-Dcom.sun.management.jmxremote.port=1616 \
-Dcom.sun.management.jmxremote.rmi.port=1616 \
-Dcom.sun.management.jmxremote.local.only=true \
-Dcom.sun.management.jmxremote.authenticate=false \
-Dcom.sun.management.jmxremote.ssl=false "
2. Execute this on your computer.
-
Windows users:
Windows用户:
putty.exe -ssh user@remote-host -L 1616:remote-host:1616
腻子。exe -ssh user@remote-host -L 1616:remote-host:1616
-
Linux and Mac Users:
Linux和Mac用户:
ssh user@remote-host -L 1616:remote-host:1616
ssh user@remote-host - l 1616:远程主机:1616
3. Start jconsole
on your computer
jconsole localhost:1616
4. Have fun!
- P.S.: during step 2, using
ssh
and-L
you specify that the port 1616 on the local (client) host is to be forwarded to the remote side. - 注::在步骤2中,使用ssh和-L,您指定本地(客户端)主机上的1616端口将被转发到远程端。
- P.S.2.: you can specify same port for JMX and RMI conversations
- P.S.2。:您可以为JMX和RMI会话指定相同的端口
#4
8
what string are you using as the JMX connection url. I don't mean to point out the obvious but JConsole has a terrible interface and to me requires an overly complex url before it will connect to a remote jmx app. Mine looks like this:
您使用什么字符串作为JMX连接url。我并不是指很明显,但是JConsole有一个糟糕的接口,我需要一个过于复杂的url才能连接到一个远程jmx应用程序。
service:jmx:rmi:///jndi/rmi://(hostname):(jmxport)/jmxrmi
#5
3
Enable JMX in Tomcat8, successfully tested in my POC
1/ Download the catalina-jmx-remote.jar
from apache website and place in $CATALINA_HOME/lib
.
1 /下载catalina-jmx-remote。jar从apache网站和$CATALINA_HOME/lib中放置。
2/ Take server.xml
/ setenv.sh
backup. Make the changes to server.xml
like below-
2 /服务器。xml / setenv。sh备份。对服务器进行更改。xml像下面,
<Listener className="org.apache.catalina.mbeans.JmxRemoteLifecycleListener" rmiRegistryPortPlatform="10001" rmiServerPortPlatform="10002" />
3/ Make the changes to $CATALINA_BASE/bin/setenv.sh
like -
3/修改为$CATALINA_BASE/bin/setenv。上海,
[...]
JVM_OPTS="[...]
-Dcom.sun.management.jmxremote
-Dcom.sun.management.jmxremote.authenticate=true
-Djava.rmi.server.hostname=<eth:0_IP>| <`hostname -i`>
-Dcom.sun.management.jmxremote.password.file=/apps/data/apache-tomcat-8_8080/conf/jmxremote.password
-Dcom.sun.management.jmxremote.access.file=/apps/data/apache-tomcat-8_8080/conf/jmxremote.access
-Dcom.sun.management.jmxremote.ssl=false
-Dcom.sun.management.jmxremote.local.only=false
-Dcom.sun.management.jmxremote=true "
4/ Create these two files as - $touch $CATALINA_BASE/conf/jmxremote.password
containing:
4/创建这两个文件- $touch $CATALINA_BASE/conf/jmxremote。密码包含:
admin letmein
管理letmein
$touch $CATALINA_BASE/conf/jmxremote.access
containing:
触摸CATALINA_BASE / conf /现在美元。访问包含:
admin readwrite
管理读写
$ chmod 600 jmxremote.password
5/ Restart tomcat and test on jconsole tool :)
5/重启tomcat,并在jconsole工具上进行测试:)
$echo|telnet 10.105.14.90 10001
#6
2
What exactly do you mean when you say "But can't connect successfully."? Is there an error message? Try turning on logging in jconsole and see if that helps debug it.
当你说“但是不能成功地连接”的时候,你到底是什么意思?有错误消息吗?尝试打开jconsole中的日志记录,看看这是否有助于调试它。
To turn on jconsole logging, edit a file named logging.properties in the directory you will be running jconsole in, add:
要打开jconsole日志记录,请编辑一个名为logging的文件。在您将要运行jconsole的目录中,添加:
handlers= java.util.logging.ConsoleHandler
.level=INFO
java.util.logging.FileHandler.pattern = %h/java%u.log
java.util.logging.FileHandler.limit = 50000
java.util.logging.FileHandler.count = 1
java.util.logging.FileHandler.formatter = java.util.logging.XMLFormatter
java.util.logging.ConsoleHandler.level = FINEST
java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter
javax.management.level=FINEST
javax.management.remote.level=FINEST
Then, start jconsole with:
然后,启动jconsole:
jconsole -J-Djava.util.logging.config.file=logging.properties
#7
2
if you are working on linux, modify the catalina.sh file adding:
如果您正在使用linux,请修改catalina。sh文件添加:
CATALINA_OPTS="-Dcom.sun.management.jmxremote -Djava.rmi.server.hostname=<HOST_IP> -Dcom.sun.management.jmxremote.port=<HOST_PORT> -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false"
export CATALINA_OPTS
or modify the /etc/profile file as root and rerun the file (source /etc/profile)
或者以root身份修改/etc/profile文件并重新运行该文件(源/etc/profile)
if you are working on windows and you are starting tomcat from the command line, use the environment variable CATALINA_OPTS
如果您正在操作windows,并且正在从命令行启动tomcat,那么请使用环境变量CATALINA_OPTS
if you are working on windows and you are starting tomcat as a service, you'll need to use the monitor service utility to configure the service initialization parameters (neither setenv.bat, catalina.bat or env-vars will work). for that you'll need the service name that appears listed in services.msc (for example jasperreportsTomcat). After, you'll need to open a console as administrator and execute (for example): tomcat6w.exe //MS//jasperreportsTomcat
如果您正在使用windows,并且正在将tomcat作为服务启动,那么您将需要使用monitor服务实用程序来配置服务初始化参数(两个都不是setenv)。蝙蝠,卡特琳娜。bat或env-vars可以工作)。为此,需要在服务中列出的服务名称。msc(例如jasperreportsTomcat)。之后,需要以管理员身份打开控制台并执行(例如):tomcat6w。exe / / / / jasperreportsTomcat女士
with this command will appear a tray icon where you can open a panel. In the "Java" tab now you can modify the jmx options. Be careful to not add trailing whitespaces and use the "[enter]" symbol to separate each option line by line.
使用此命令将显示一个托盘图标,您可以在其中打开面板。在“Java”选项卡中,现在可以修改jmx选项。注意不要添加拖尾白括号,并使用“[enter]”符号逐行分隔每个选项。
-Dcom.sun.management.jmxremote
-Djava.rmi.server.hostname=192.168.61.101
-Dcom.sun.management.jmxremote.port=9999
-Dcom.sun.management.jmxremote.ssl=false
-Dcom.sun.management.jmxremote.authenticate=false
Hope it helps
希望它能帮助
#8
1
Check if your server is behind the firewall. JMX is base on RMI, which open two port when it start. One is the register port, default is 1099, and can be specified by the com.sun.management.jmxremote.port option. The other is for data communication, and is random, which is what cause problem. A good news is that, from JDK6, this random port can be specified by the com.sun.management.jmxremote.rmi.port option.
检查服务器是否在防火墙之后。JMX的基础是RMI,它在启动时打开两个端口。一个是寄存器端口,默认是1099,可以由com.sun.management.jmxremote指定。端口选项。另一种是数据通信,是随机的,这是造成问题的原因。好消息是,这个随机端口可以由com.sun.management.jmxremote.rmi指定。端口选项。
add the line in you {tomcat_dir}/bin/setenv.sh:
在您{tomcat_dir}/bin/setenv.sh中添加一行:
export CATALINA_OPTS="-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=8991 -Dcom.sun.management.jmxremote.rmi.port=8991 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false"
#9
1
I got something for all of you, in order to complete the investigation of this whole thing. There is a trick, it happens that profiler tool connnects with the jvm using a port, but the jvm continues the conversation using another random port. If the jvm is running inside a remote machine (for example : a tomcat web-app server), and the remote machine has protection against outgoing and incoming connections, you must set the java system property com.sun.management.jmxremote.rmi.port
to the same value of the property named com.sun.management.jmxremote.port
我为你们所有人准备了一些东西,为了完成整个调查。有一个技巧,profiler工具使用端口与jvm连接,但是jvm使用另一个随机端口继续对话。如果jvm在远程机器中运行(例如:tomcat web应用程序服务器),并且远程机器具有对传出和传入连接的保护,则必须设置java system属性com.sun.management.jmxremote.rmi。端口到名为com.sun.management.jmxremote.port的属性的相同值
Source : https://serverfault.com/questions/308662/how-do-i-fix-a-failed-to-retrieve-rmiserver-stub-jmx-error And also check this out : http://blog.cantremember.com/debugging-with-jconsole-jmx-ssh-tunnels/
来源:https://serverfault.com/questions/308662/how-do-i-fix-a-failed to retrieve-rmiserver-stub-jmx-error,并检查这个:http://blog.cantmember.com/debugging-with -jconsole-jmx-ssh-tunnels/
Hope to contribute guys!
希望能贡献的人!
And good luck!
,祝你好运!
#10
0
Well, I had this problem in a Linux box (virtual machine) and I fixed it using -Djava.rmi.server.hostname property but there's a thing I can't understand. My machine has 5 tomcat servers, all of them has jmx enabled in consecutive ports (8008,8018,8028...) and only one of them had this issue connecting JMX. No firewall, no -Djava.rmi.server.hostname property in any tomcat....
我在Linux(虚拟机)中遇到了这个问题,我用-Djava.rmi.server修复了这个问题。hostname属性,但有一件事我不能理解。我的机器有5个tomcat服务器,它们都在连续的端口上启用了jmx(8008、8018,8028…),其中只有一个具有连接jmx的问题。没有防火墙,-Djava.rmi.server。主机名财产在任何tomcat ....
So the thing is that I understand the problem but I can't understand why 4 of my tomcats worked and 1 of them not.
问题是我理解这个问题但我不明白为什么我的4只猫会工作,1只不会。
P.D: My english is very poor, I know. My Apologies.
P。我知道我的英语很差。我的歉意。
#11
0
PROTIP: You need to fix (as in having a known number) the RMI Registry and JMX/RMI Server ports. You do this by putting jar-file in the lib-dir and configuring a special listener. (And ofcourse the usual flags for activating JMX
PROTIP:您需要修复RMI注册表和JMX/RMI服务器端口(如拥有已知的数字)。通过将jar文件放入lib-dir并配置一个特殊的侦听器,可以实现这一点。(当然还有激活JMX的常用标志
-Dcom.sun.management.jmxremote \
-Dcom.sun.management.jmxremote.port=8999 \
-Dcom.sun.management.jmxremote.ssl=false \
-Dcom.sun.management.jmxremote.authenticate=false \
-Djava.rmi.server.hostname=<HOSTNAME> \
See: JMX Remote Lifecycle Listener at http://tomcat.apache.org/tomcat-6.0-doc/config/listeners.html
参见:JMX远程生命周期监听器http://tomcat.apache.org/tomcat-6.0-doc/config/listeners.html
#12
0
Changing the /etc/hosts
on linux, where I replaced the localhost address associated to my account to the machine ip, solved this problem for me.
更改linux上的/etc/hosts(我将与帐户相关的本地主机地址替换为机器ip)为我解决了这个问题。