Non-Serializable XAResource recovery warning


    Sometimes you may see the following:


    21:31:10,147 WARN  loggerI18N om.arjuna.ats.internal.jta.resources.arjunacore.norecoveryxa om.arjuna.ats.internal.jta.resources.arjunacore.norecoveryxa Could not find new XAResource to use for  recovering non-serializable XAResource < 131075, 28, 26, 1-7f000001:ba8a:469ed3e6:2097f000001:ba8a:469ed3e6:213


    Note, in more recent versions this message has been changed to 'Could not   findnewXAResource tousefor recovering non-serializableXAResource'. But the reason for the warning is the same.


    During the commit phase of the transaction, the coordinator must durably record as much information about each participant as possible to attempt recovery in the event of a failure (coordinator or participants). If XAResources are the participants then as mentioned in the JBossTS documentation we'll just save a serialized instance of the participant and assume that deserializing upon recovery will return an instance that can be used to drive recovery. However, if the XAResource is not serializable (as most are not) then additional information is required (JBossTS does not see the connections from which the original XAResource was returned, so it has no direct way of getting this information). It does this through XAResourceRecovery instances, which are explained in full in the JBossTS documentation, but to summarize: each datasource that returns an XAResource may potentially need an XAResourceRecovery instance.


    So when you see this message it means that you had a previous transaction failure involving a non-Serializable XAResource and JBossTS is attempting recovery. Because the resource wasn't Serializable, JBossTS does not have enough information at hand to recover the resource and needs help. You need to provide an instance of a XAResourceRecovery implementation and tie it into the recovery process in order for this to occur. What then happens is that JBossTS will ask your XAResourceRecovery instance for a new XAResource to use during recovery, essentially replacing the old (stale) instance with a new one. For more details, check out the documentation.


    Note that it is not mandatory for your XAResource to implement Serializable: it's just a lot easier if it does. However, if this is not the case then please consult the documentation on XAResourceRecovery or ensure that an already provided and applicable instance is configured in the JBossTS configuration file.