Friday, October 2, 2015

ERROR java.io.InvalidClassException: org.apache.synapse.message.store.impl.jms.SynapseMessage; local class incompatible


Recently i was working with Message Store /Message Processor scenario in WSO2 ESB. In that i developed a CAR file with Dev Studio and used it with ESB 4.8.1.

Then i executed the scenario of sending some messages to Message Store while making the Backend unavailable which leaded to remain some messages in the queue.

Then , i used the same CAR file in ESB 4.8.0 and once i deploy the CAR file , i was getting following exception continuously.

ERROR - JmsConsumer [TestMessageStore-C-263] cannot receive message from store. Error:Failed to build body from bytes. Reason: java.io.InvalidClassException: org.apache.synapse.message.store.impl.jms.SynapseMessage; local class incompatible: stream classdesc serialVersionUID = -7391992645087640122, local class serialVersionUID = -8457646720705005296

Then i initially thought that this can be due to some incompatibility of Dev Studio version with ESB 4.8.1 and 4.8.0. But i was wrong.

Actual problem was my previous act before i shutdown ESB 4.8.1. Because the message processor could not process the messages previously due to the un availability of the back end, There were some messages remaining which i sent with ESB 4.8.1.

Then when i started 4.8.0 and deploy the CAR file, it tried to process those existing messages from the queue. Since those message were sent from different serialVersionUID of the same class org.apache.synapse.message.store.impl.jms.SynapseMessage  It is not possible to deserialise them with different serialVersionUID.

So , once i removed all the previous messages from the queue, it worked perfectly.