简体   繁体   English

在catalina.sh中设置jmx时,tomcat无法启动

[英]on setting jmx in catalina.sh, tomcat does not start

I am working on CentOS 6.3 64 bit machine. 我正在使用CentOS 6.3 64位计算机。 I have set the following in catalina.sh export CATALINA_OPTS="-Dcom.sun.management.jmxremote=true -Dcom.sun.management.jmxremote.port=7010 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false" 我已经在catalina.sh export CATALINA_OPTS =“-Dcom.sun.management.jmxremote = true -Dcom.sun.management.jmxremote.port = 7010 -Dcom.sun.management.jmxremote.ssl = false -Dcom中设置了以下内容。 sun.management.jmxremote.authenticate = false“

When I restart tomcat after this addition, tomcat does not start. 当我在添加之后重新启动tomcat时,tomcat无法启动。 I have disabled the firewall. 我已禁用防火墙。 Can anyone help me with this issue? 谁能帮我解决这个问题? Thanks 谢谢

The fact that you're not seeing any error message makes me think that the command line string being built to launch tomcat has some subtle error in it, causing the JVM to not launch at all, or abort because it's being given a bogus directive. 您没有看到任何错误消息的事实使我认为,为启动tomcat而构建的命令行字符串中存在一些细微的错误,导致JVM根本无法启动,或者因为被赋予了伪指令而中止。 Usually what I do in these cases is edit the launch script, find the spot where the full command string is executed and add an echo of the same string. 通常,在这些情况下,我要做的就是编辑启动脚本,找到执行完整命令字符串的位置,并添加相同字符串的回显 That way, when the script launches, I can see the exact command that is being issued and test executing myself without the script. 这样,当脚本启动时,我可以看到正在发出的确切命令,并测试自己是否在没有脚本的情况下执行。

I don't think you are facing a major issue here, but if you want to ditch the startup parameter driven JMX options, you can always add a quickie startup servlet to your admin WAR that creates and starts a JMXConnectorServer . 我认为您在这里没有遇到主要问题,但是如果您想放弃由启动参数驱动的JMX选项,则始终可以将快速启动小服务程序添加到创建和启动JMXConnectorServer的 admin WAR中。

Sounds like overkill, but it does give you a bit more flexibility in the configuration details of the listener. 听起来有些矫kill过正,但它确实为您提供了更多的侦听器配置灵活性。 For example, by default, the default command line options will result in a listener bound to the local address only, so incoming connections from remotes will fail. 例如,默认情况下,默认的命令行选项将导致侦听器仅绑定到本地地址,因此从远程计算机传入的连接将失败。 On the other hand, if you configure the connector server yourself in a servlet, you can direct the listener to bind to 0.0.0.0 . 另一方面,如果您自己在servlet中配置连接器服务器,则可以指示侦听器绑定到0.0.0.0

I have found the solution for this issue. 我已经找到解决此问题的方法。 Basically whenever i added CATALINA_OPTS, it could not find the hostname. 基本上,每当我添加CATALINA_OPTS时,都找不到主机名。 Hence i added the host name in /etc/init.d/hosts file: 因此,我在/etc/init.d/hosts文件中添加了主机名:
127.0.0.1 localhost your_hostname 127.0.0.1本地主机your_hostname
This resolved the issue. 这解决了问题。 I am ale to run jconsole as well as jvisualvm on this port now. 我现在可以在此端口上运行jconsolejvisualvm

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM