In JBoss/WildFly, when configuring a data source, there is a JTA option, which is disabled by default:
I've just experienced a problem related to this issue.
I was running a container managed transaction involving approximately 20,000 inserts into a MySQL database.
The transaction failed randomly, sometimes after around 3,500 inserts, other times after around 6,000 inserts, etc.
After investigation I found that the JTA option on the WildFly datasource definition was set to false.
Changing this setting to true fixed the problem, so I would agree with @user3472929 that JTA should be set to true in the datasource definition unless you have some specific reason not to.