Spring JMS with Websphere default messaging issue
I am facing the following issue while trying to create a Spring JMS application which uses Websphere 7.0 default messaging (EIS).
The exception I am getting at the startup of the application is :
[2/6/13 14:04:58:641 EST] 00000024 ContextLoader E org.springframework.web.context.ContextLoader initWebApplicationContext Context initialization failed org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'org.springframework.context.annotation.internalPe rsistenceAnnotationProcessor': Initialization of bean failed; **nested exception is java.lang.IllegalArgumentException: Method must not be null at** org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.doCreateBean(AbstractAu towireCapableBeanFactory.java:480) at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory$1.run(AbstractAutowireC apableBeanFactory.java:409)
Below are the pieces of my code and Spring configuration :
Spring config file :
Code:
<context:component-scan base-package="com.company.poc.asynch.logging" />
<context:annotation-config/>
<bean id="jndiTemplate" class="org.springframework.jndi.JndiTemplate">
<property name="environment">
<props>
<prop key="java.naming.factory.initial">
com.ibm.websphere.naming.WsnInitialContextFactory
</prop>
<prop key="java.naming.provider.url">
iiop://localhost:2810
<context:component-scan base-package="com.company.poc.asynch.logging" />
<context:annotation-config/>
<bean id="jndiTemplate" class="org.springframework.jndi.JndiTemplate">
<property name="environment">
<props>
<prop key="java.naming.factory.initial">
com.ibm.websphere.naming.WsnInitialContextFactory
</prop>
<prop key="java.naming.provider.url">
iiop://localhost:2810
</prop>
</props>
</property>
</bean>
<bean id="jmsQueueConnectionFactory"
class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiTemplate">
<ref bean="jndiTemplate"/>
</property>
<property name="jndiName">
<value>jms/ReDConnectionFactory</value>
</property>
</bean>
<bean id="destination"
class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiTemplate">
<ref bean="jndiTemplate"/>
</property>
<property name="jndiName">
<value>jms/ReDMessageProviderQueue</value>
</property>
</bean>
<bean id="jmsTemplate" class="org.springframework.jms.core.JmsTemplate">
<property name="connectionFactory" ref="jmsQueueConnectionFactory" />
<property name="defaultDestination" ref="destination" />
</bean>
<bean id="logListener" class="com.company.poc.asynch.logging.LogListener"/>
<jms:listener-container connection-factory="connectionFactory" container-type="default" acknowledge="auto">
<jms:listener destination="loggingQueue" ref="logListener" method="onMessage" />
</jms:listener-container>
Java Sender class :
Code:
@Service("logSender")
public class LogSender {
@Autowired
private JmsTemplate jmsTemplate;
public void sendLog(final String logText){
jmsTemplate.send(
new MessageCreator() {
public Message createMessage(Session session) throws JMSException {
TextMessage logMessage = session.createTextMessage();
logMessage.setText(logText);
return logMessage;
}
}
);
}
}
Java message listener :
Code:
@Component("logListener")
public class LogListener implements MessageListener {
//private static Logger regularLogger = Logger.getLogger("regularLogger");
public void onMessage(Message message) {
TextMessage msg = (TextMessage) message;
System.out.println("Log message recieved by the listener:" + msg);
}
}
The Configuration of the queue, connection factory and bus is setup correctly int eh websphere admin console, as I use the same configuration in my stand alone java application without any issue.
However, this Spring application fails to initialize and throws the above said exception at the startup. I have no clue what am I missing here, any help would be greately appreciated.
Thanks.