在我的Spring應用程序(這是部署在WebLogic服務器上),我有以下的Spring bean定義:自動註銷的MBean(被Spring註冊),當WebLogic應用被卸載
<context:mbean-server />
<bean id="mbeanExporter" class="org.springframework.jmx.export.MBeanExporter">
<property name="beans">
<map>
<entry key="SpringBeans:name=hibernateStatisticsMBean,subsystem=${subsystem}" value-ref="hibernateStatisticsMBean" />
</map>
</property>
</bean>
<bean name="hibernateStatisticsMBean" class="org.hibernate.jmx.StatisticsService">
<property name="sessionFactory" ref="sessionFactory" />
</bean>
它註冊新的MBean時應用被部署並完美運作。但是,當我取消部署應用程序並再次部署它時,它會抱怨MBean已經存在。
如何在應用程序取消部署期間自動取消註冊MBean?可以通過Spring來完成嗎?還是我需要爲此做一些WebLogic魔術?
Hows是創建的上下文 - 使用ContextLoaderListener?這可能是因爲上下文沒有關閉 - 這會導致其他問題。 – gkamal 2011-03-24 16:12:06