Announcement Announcement Module
No announcement yet.
Problem with Notification publishing using JMX Spring Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Problem with Notification publishing using JMX Spring

    Hello, I have a problem publishing Notification using JMX Spring, I tried to do it follow the example in the Spring reference document but it give me an java.lang.NullPointerException when I tried to publishing the notifications. I am working with spring-framework-3.0.5.RELEASE. This is my bean code, in which I put the notification publisher:

    public class GreetingService implements GreetingServiceMBean,NotificationPublisherAware{

    private String message;
    private NotificationPublisher publisher;
    private int notificationIndex = 0;

    public GreetingService(){


    public GreetingService(String message){
    this.message = message;

    public String sayGreeting(){
    return message;

    private Notification buildNotification(final String aoldValue, final String anewValue){
    final String notificationType = "helloword.jmx.spring.example";
    final String aMessage = "Converting" + aoldValue + "to" + anewValue;
    final Notification notification = new Notification(notificationType, this, notificationIndex++, System.currentTimeMillis(),aMessage);
    notification.setUserData("MyExample" + notificationIndex);

    return notification;

    public void setMessage(String aMessage){
    this.message = aMessage;
    this.publisher.sendNotification(buildNotification( this.message, aMessage));

    public String getMessage(){
    return this.message;

    public void setNotificationPublisher(NotificationPublisher notificationPublisher){
    this.publisher = notificationPublisher;

    Someone can help me please??, I have search for many hours but I don't found the solution, Do I have some mistakes on my code? I am new in Spring and I don't know what else to do.

    Thanks in advance!!!