File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Spring and the fly likes mbean exporting with spring-jmx using annotations Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "mbean exporting with spring-jmx using annotations" Watch "mbean exporting with spring-jmx using annotations" New topic
Author

mbean exporting with spring-jmx using annotations

Ankit Chandrawat
Ranch Hand

Joined: Jan 03, 2008
Posts: 87
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

Joined: Jun 16, 2007
Posts: 686

Please post ChatSessionBO class/interface.


===Vyas Sanzgiri===
My Blog
Ankit Chandrawat
Ranch Hand

Joined: Jan 03, 2008
Posts: 87
Here is the ChatSessionBO.java

Ankit Chandrawat
Ranch Hand

Joined: Jan 03, 2008
Posts: 87
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.
 
 
subject: mbean exporting with spring-jmx using annotations