问题描述
MBeanServerFactory.findMBeanServer(null);
到底在做什么?
返回所有已注册的MBeanServer的列表?在哪里注册?
我问是因为我有以下问题.
我有一个使用服务包装程序在Tomcat中部署的Java Web应用程序.
我的server.xml中有使用ManagedBeans(启用了弹簧)的自定义连接器实现.
如果我通过服务包装启动应用程序,一切正常.
如果我直接通过Tomcat启动Web应用程序,则部署似乎已中断.
我在日志中看到的只是连接器执行
What is the MBeanServerFactory.findMBeanServer(null);
exactly doing?
Returns a list of all registered MBeanServers? Registered where?
I am asking because I have the following problem.
I have a java web app deployed in Tomcat using a service wrapper.
I have custom connector implementations in my server.xml that use ManagedBeans (spring enabled).
If I start the app via the service wrapper all is ok.
If I start the web app through Tomcat directly it seems that the deployment breaks.
All I see in the logs is that the connector does a
MBeanServerFactory.findMBeanServer(null);
,然后尝试调用Bean beanServer.invoke(name, operationName, null, null);
结果是InstanceNotFoundException.
如果我不使用服务包装器,似乎没有加载托管bean?我的理解正确吗?关于如何调试此问题的任何输入是非常欢迎!
and then tries to invoke the bean beanServer.invoke(name, operationName, null, null);
The result is a InstanceNotFoundException.
It seems that the managed beans are not loaded in case I do not use a service wrapper? Is my understanding correct? Any input on how to debug this issue ishighly welcome!
推荐答案
javadoc 表示,当您传递null
时,它将返回在当前JVM中注册的服务器.如果使用的是JSW,则不能使用null
,因为JSW将VM作为单独的进程进行分叉.这就是为什么您看到InstanceNotFoundException
.
The javadoc says that when you pass null
, it returns the servers registered in the current JVM. If you are using JSW, then you cannot use null
as JSW forks the VM as a separate process. This is why you see the InstanceNotFoundException
.
这篇关于关于tomcat和jmx的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!