Atomikos Forum |
|
Hi !
I've encountered a problem today running Atomikos and ActiveMQ. It seems that the message is null : 09-02-16 17:41:14,957 [main] Error delegating call to createTextMessage on JMS driver java.lang.NullPointerException at org.apache.activemq.command.ActiveMQTextMessage.toString(ActiveMQTextMessage.java:154) at java.lang.String.valueOf(String.java:2827) at java.lang.StringBuffer.append(StringBuffer.java:219) at com.atomikos.jms.AtomikosJmsXaSessionProxy.invoke(AtomikosJmsXaSessionProxy.java:153) at $Proxy59.createTextMessage(Unknown Source) at de.perrier.integration.utils.service.JmsAction$1.createMessage(JmsAction.java:43) at org.springframework.jms.core.JmsTemplate.doSend(JmsTemplate.java:570) at org.springframework.jms.core.JmsTemplate$3.doInJms(JmsTemplate.java:541) at org.springframework.jms.core.JmsTemplate.execute(JmsTemplate.java:471) at org.springframework.jms.core.JmsTemplate.send(JmsTemplate.java:539) Here is my JMS config : <!-- The underying JMS vendor's XA connection factory --> <bean id="xaFactory" class="org.apache.activemq.ActiveMQXAConnectionFactory"> <property name="brokerURL" value="tcp://s-v-activemq-integration:61616" /> </bean> <!-- Configure the JMS connector --> <bean id="atomikosConnectionFactory" class="com.atomikos.jms.AtomikosConnectionFactoryBean" init-method="init" destroy-method="close"> <property name="uniqueResourceName" value="TOPIC_BROKER" /> <property name="xaConnectionFactory" ref="xaFactory" /> </bean> <!-- JMS template for easy sending of timetable update messages with Spring --> <bean id="jmsTemplate" class="org.springframework.jms.core.JmsTemplate"> <property name="connectionFactory" ref="atomikosConnectionFactory" /> <property name="sessionTransacted" value="true" /> </bean> Everything's ok when I try with my config test using org.springframework.jms.connection.CachingConnectionFactory instead of AtomikosConnectionFactoryBean. Does somebody have an idea from where comes this exception ? I use an OracleXADatasource as well and I always have the Error in recovery message : 09-02-16 17:25:56,209 [main] Starting read of logfile D:\dev\project\perrier-batch\target\tmlog70.log 09-02-16 17:25:56,256 [main] Done read of logfile 09-02-16 17:41:13,597 [main] TOPIC_BROKER: refreshed XAResource 09-02-16 17:25:56,271 [main] java:/XA_Perrier_DS: refreshed XAResource 09-02-16 17:25:56,334 [main] Error in recovery I've got this one as well sometimes: 09-02-16 17:10:37,961 [main] Coordinator not recoverable: perrier-batch-tm0000100071 Could it be linked to the error above ? Thank you for your help :) Mickael
We found the issue!! To create the message to send with ActiveMQ we use the MessageCreator interface :
MessageCreator messageCreator = new MessageCreator() { public Message createMessage(Session session) throws JMSException { TextMessage textMessage = session.createTextMessage(); textMessage.setText(message); return textMessage; } }; Apparently the problem comes from session.createTextMessage() + textMessage.setText(message). The setter seems to be skipped. The solution is to call session.createTextMessage(message) instead. Not sure but I think this might be a bug from Atomikos... as it was working with other configurations. Cheers, Mickael PS: Any idea if the recovery errors are normal or not? |