Injecting UserTransaction with @Resource into session scope bean causes replication failure

Solution Unverified - Updated

Environment

  • JBoss Enterprise Application Platform (EAP) 6

Issue

We see HTTP session replication errors from our application, which injects @UserTransction into a CDI Interceptor using @Resource

Caused by: org.infinispan.marshall.NotSerializableException: org.jboss.tm.usertx.client.ServerVMClientUserTransaction
Caused by: an exception which occurred:
	in field utx
	in field instance
	in field c
	in field dependentInstances
	in field creationalContext
	in object java.util.HashMap@d086bcfc
	in object org.jboss.as.clustering.SimpleMarshalledValue@d086bcfc
	in object org.infinispan.atomic.PutOperation@d086c83f
	in object java.util.LinkedList@b5a0badb
	in object org.infinispan.atomic.AtomicHashMapDelta@4d3b8933
	in object org.infinispan.commands.write.PutKeyValueCommand@8f440757
	in object org.infinispan.commands.tx.PrepareCommand@ea2d1967

Resolution

As a work-around use @Inject rather than @Resource.

Once a fix for https://bugzilla.redhat.com/show_bug.cgi?id=1235886 is released, upgrade to a version where it is resolved.

Root Cause

This content is not included.https://bugzilla.redhat.com/show_bug.cgi?id=1235886

The UserTransaction is not Serializable, and with @Resource a serializable proxy is not currently used as it is for @Inject injection

Category

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.