Find file History
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.

JAX-RS & Arjuna Software Transactional Memory

This example uses a JAX-RS resource and the Software Transactional Memory implementation of Narayana. This is a non-distributed transaction example.

Note, these are not Java EE compliant APIs and classes we're going to use. But that's the point!

If you want to see documentation on STM then check out the Narayana web site or

Project pom.xml

The project is a normal maven project with war packaging, not jar.


The project adds a <plugin> to configure wildfly-swarm-plugin to create the .war.


Additionally, the usual maven-war-plugin is provided.


Currently we have to add javax.transactions into the pom.xml for building due to

To define the needed parts of WildFly Swarm, a dependency is added



mvn package


mvn wildfly-swarm:run


First try ...


In the browser you should see something like ...

Object name: 0:ffffac1c8001:a3d6627:567f024a:b

Transaction value hello11

Transaction value hello12

Transaction value hello13

Transaction value hello14

Transaction value hello15

Transaction value hello16

Transaction value hello17

Transaction value hello18

Transaction value hello19

Transaction value hello20

Note that depending upon which version of Narayana STM you're using, you may see some warnings like the following in the console ...

2015-12-26 21:00:32,498 WARN com.arjuna.ats.arjuna ARJUNA012281: ShadowingStore::read_state() - no type name given for object state 0:ffffac1c8001:-62da914f:567effe8:b

You can safely ignore them as they're due to a known issue in some versions of Narayana ...