2013-01-18 2 views
0

내 구성 XML을 수신하지 및 수신기 ... class NotificationListenerImpl스프링 프레임 워크 3.0 JMX 통지는

public class NotificationListenerImpl implements NotificationListener{ 

    public void handleNotification(Notification notification, Object handback) { 

     // TODO Auto-generated method stub 
     System.out.println("Notification received"); 
    } 

} 

알림을 보내고 있지만 수신하지 못했습니다. 어떤 포인터?

답변

1

이 문제가 아직 해결되었는지는 확실하지 않지만 도움이 될지 알 수 있습니다. 나는 최근에 봄/JMX를 가지고 놀았지만 여전히 새롭지 만 잘하면 몇 가지 통찰력을 공유 할 수 있습니다.

리스너를 내보낼 MBean으로 선언 할 필요가 없으며 알림을 게시 할 빈 만 선언 할 필요가 있다고 생각합니다. 둘째, notificationListenerMappings의 키는 리스너의 빈에 대한 참조가 아닌 MBean의 ObjectName으로 간주됩니다. 다른 말로 ..

<bean id="exporter" class="org.springframework.jmx.export.MBeanExporter" lazy-init="false"> 
    <property name="beans"> 
     <map> 
      <entry key="bean:name=notificationSender" value-ref="notificationSenderImpl"></entry> 
     </map> 
    </property> 
    <property name="notificationListenerMappings"> 
     <map> 
      <entry key="bean:name=notificationSender" value-ref="notificationListenerImpl"></entry> 
     </map>    
    </property> 
    <property name="server" ref="mbeanServer"/>  
</bean> 

리스너 매핑 키로 와일드 카드를 사용할 수도 있습니다.

<bean id="exporter" class="org.springframework.jmx.export.MBeanExporter"> 
    . 
    . 
    . 
    <property name="notificationListenerMappings"> 
     <map> 
      <entry key="*"> 
       <bean class="com.poc.jmx.domain.NotificationBroadcastListener" /> 
      </entry> 
     </map> 
    </property> 
</bean> 

희망하는 데 도움이 : 여기 내 주석 선언의 MBean의 모든 알림을 집어 들고 내 자신의 MBeanExporter에의 예입니다.