tomcat 不能开启JmxRemoteLifecycleListener

问答中心分类: JAVAtomcat 不能开启JmxRemoteLifecycleListener
匿名用户 asked 8 年 ago
前景:centos6.6使用oneinstack单独安装的tomcat,要使用zabbix监控这个tomcat。
问题发生在:
当我配置  vim server.xml
取消注释 
 <Listener className="org.apache.catalina.mbeans.JmxRemoteLifecycleListener" rmiRegistryPortPlatform="8081" rmiServerPortPlatform="8082" />
后,tomcat不能启动。
 

4 Answers
匿名用户 answered 8 年 ago
附上:
cat catalina.out
Nov 26, 2015 4:44:11 PM org.apache.catalina.startup.SetAllPropertiesRule begin
WARNING: [SetAllPropertiesRule]{Server/Service/Connector} Setting property 'debug' to '0' did not find a matching property.
Nov 26, 2015 4:44:11 PM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'debug' to '0' did not find a matching property.
Nov 26, 2015 4:44:12 PM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'debug' to '0' did not find a matching property.
Nov 26, 2015 4:44:12 PM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'debug' to '0' did not find a matching property.
Nov 26, 2015 4:44:12 PM org.apache.catalina.core.AprLifecycleListener lifecycleEvent
INFO: Loaded APR based Apache Tomcat Native library 1.1.33 using APR version 1.3.9.
Nov 26, 2015 4:44:12 PM org.apache.catalina.core.AprLifecycleListener lifecycleEvent
INFO: APR capabilities: IPv6 [true], sendfile [true], accept filters [false], random [true].
Nov 26, 2015 4:44:12 PM org.apache.catalina.core.AprLifecycleListener initializeSSL
INFO: OpenSSL successfully initialized (OpenSSL 1.0.1e 11 Feb 2013)
Nov 26, 2015 4:44:12 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-apr-8080"]
Nov 26, 2015 4:44:12 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 2073 ms
Nov 26, 2015 4:44:12 PM org.apache.catalina.startup.Catalina start
SEVERE: The required Server component failed to start so Tomcat is unable to start.
org.apache.catalina.LifecycleException: Failed to start component [StandardServer[8006]]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
at org.apache.catalina.startup.Catalina.start(Catalina.java:689)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:294)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:428)
Caused by: java.lang.IllegalArgumentException: jmxremote.access (No such file or directory)
at javax.management.remote.rmi.RMIConnectorServer.start(RMIConnectorServer.java:373)
at org.apache.catalina.mbeans.JmxRemoteLifecycleListener.createServer(JmxRemoteLifecycleListener.java:330)
at org.apache.catalina.mbeans.JmxRemoteLifecycleListener.lifecycleEvent(JmxRemoteLifecycleListener.java:284)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
at org.apache.catalina.util.LifecycleBase.setStateInternal(LifecycleBase.java:402)
at org.apache.catalina.util.LifecycleBase.setState(LifecycleBase.java:347)
at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:732)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
... 7 more
Caused by: java.io.FileNotFoundException: jmxremote.access (No such file or directory)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(FileInputStream.java:146)
at java.io.FileInputStream.<init>(FileInputStream.java:101)
at com.sun.jmx.remote.security.MBeanServerFileAccessController.propertiesFromFile(MBeanServerFileAccessController.java:294)
at com.sun.jmx.remote.security.MBeanServerFileAccessController.<init>(MBeanServerFileAccessController.java:133)
at javax.management.remote.rmi.RMIConnectorServer.start(RMIConnectorServer.java:371)
... 15 more
Nov 26, 2015 4:44:12 PM org.apache.catalina.util.LifecycleBase destroy
WARNING: Calling stop() on failed component [StandardServer[8006]] to trigger clean-up did not complete.
org.apache.catalina.LifecycleException: Failed to stop component [StandardServer[8006]]
at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:236)
at org.apache.catalina.util.LifecycleBase.destroy(LifecycleBase.java:272)
at org.apache.catalina.startup.Catalina.start(Catalina.java:693)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:294)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:428)
Caused by: org.apache.catalina.LifecycleException: An invalid Lifecycle transition was attempted ([before_stop]) for component [StandardService[Catalina]] in state [INITIALIZED]
at org.apache.catalina.util.LifecycleBase.invalidTransition(LifecycleBase.java:409)
at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:219)
at org.apache.catalina.core.StandardServer.stopInternal(StandardServer.java:760)
at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:232)
... 8 more
Nov 26, 2015 4:44:12 PM org.apache.coyote.AbstractProtocol destroy
INFO: Destroying ProtocolHandler ["http-apr-8080"]

oneinstack answered 8 年 ago
是否保留现场? 我可否登录进去看下?

匿名用户 answered 8 年 ago  • 
私人的
你好:
我是在阿里云里配置的,结果有问题(因为着急上线,所以重装了服务),然后在虚拟机里模拟,同样的问题。
你可以虚拟机模拟试一试。
感谢楼主!

匿名用户 answered 8 年 ago  • 
私人的
你好:
我是在阿里云里配置的,结果有问题(因为着急上线,所以重装了服务),然后在虚拟机里模拟,同样的问题。
你可以虚拟机模拟试一试。
感谢楼主!

匿名用户 answered 8 年 ago
你好:
我是在阿里云里配置的,结果有问题(因为着急上线,所以重装了服务),然后在虚拟机里模拟,同样的问题。
你可以虚拟机模拟试一试。
感谢楼主!

oneinstack answered 7 年 ago

非常抱歉,这个问题没注意到。
还需要设置/usr/local/tomcat/bin/setenv.sh

CATALINA_OPTS="-Djava.library.path=/usr/local/apr/lib
-Djava.rmi.server.hostname=你的IP
-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"

更多参考:https://blog.linuxeye.com/262.html