在我的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