Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

mbean exporting with spring-jmx using annotations

 
Ankit Chandrawat
Ranch Hand
Posts: 88
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am a newbie to spring JMX and quartz scheduling. So trying to explain in layman form. I have a class EmailAlertMessaginService.java. It has a method startService() that needs to run every 3 hours.




I did the entry for this class in a file applicationContext-jmx-export.xml as follows :



Now, as the method startService() needs to run every 3 hours so an entry for the bean emailAlertMessagingService is being made in a file applicationContext-jmx-quartz.xml as follows:



(Not mentioning the CronTriggerBean and MethodInvokingJobDetailFactoryBean here.)

When I start the server it throws an error :

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jmxExporter' defined in ServletContext resource [/WEB-INF/applicationContext-jmx-export.xml]: Cannot resolve reference to bean 'emailAlertMessagingService' while setting bean property 'beans' with key [TypedStringValue: value [ATG_Migration:name=EmailAlertMessagingService], target type [null]]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'emailAlertMessagingService' defined in ServletContext resource [/WEB-INF/applicationContext-jmx-quartz.xml]: Invocation of init method failed; nested exception is java.lang.NullPointerException

I suppose that this is because the chatSessionBO bean it is looking for in the startService is null. Please guide me how to go about this and is there anyway by which I can do the whole thing using annotations.

 
Vyas Sanzgiri
Ranch Hand
Posts: 686
Chrome Netbeans IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please post ChatSessionBO class/interface.
 
Ankit Chandrawat
Ranch Hand
Posts: 88
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here is the ChatSessionBO.java

 
Ankit Chandrawat
Ranch Hand
Posts: 88
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is the code that I am using to export the MBeans. We are using Spring 3 and jboss.



Here is my configuration in the mapping file



I am not getting any error message when I start the server, but neither do I get to see the MBeans exported in jmx-console.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic