Finally I got my MDB & Spring to play together. However, I am getting a strange ClassCastException. This is the error:

Code:
<MessageDrivenBean threw an Exception in onMessage(). The exception was:
 java.lang.ClassCastException: sample.GreetingServiceImpl.
java.lang.ClassCastException: sample.GreetingServiceImpl
And the code I am using is:
Code:
BeanFactoryLocator bfl = SingletonBeanFactoryLocator.getInstance();
			 BeanFactoryReference bf = bfl.useBeanFactory("MyApp");
			GreetingServiceImpl b=(GreetingServiceImpl) bf.getFactory().getBean("GreetingServiceImpl");

Seems to me the class being returned and the class I am typecasting are one and the same (all these are in package "sample"). So why the CastException?

Any help appreciated.