2014-02-10 21 views
2

我已經成功創建了MBean並進行了部署。我還可以看到我的Custom MBean部署在JConsole的MBeans部分中。如何將自定義MBean部署到Tomcat 7中?

如何將它部署到Tomcat 7?

我發現在線教程可能太舊了。到目前爲止,我還沒有找到任何有關Tomcat 7的教程。請幫助我找到適合Tomcat版本7的教程。

我使用了基於Tomcat 6的教程。但是我無法成功,因爲在Server.xml文件「ServerLifecycleListener」中使用的監聽器之一是在Tomcat 7中不再使用。

回答

0

您需要像下面那樣添加mbeans-descriptors.xml,並且需要將它放在與它描述的類文件相同的包中。

Adding MBean descriptions

<mbean   name="LDAPRealm" 
     className="org.apache.catalina.mbeans.ClassNameMBean" 
     description="Custom LDAPRealm" 
      domain="Catalina" 
      group="Realm" 
      type="com.myfirm.mypackage.LDAPRealm"> 
<attribute name="className" 
     description="Fully qualified class name of the managed object" 
      type="java.lang.String" 
     writeable="false"/> 
<attribute name="debug" 
     description="The debugging detail level for this component" 
      type="int"/> 
. 
. 

您可以參考這個問題,以及:

Container level Custom JXM MBean in Tomcat 7