1 Reply Latest reply on Jan 22, 2015 9:48 AM by dermoritz

    How to get transactions in Arquillian test - got "javax.persistence.TransactionRequiredException"


      I make my first steps with Arquillian. I bootstra pped a JavaEE App with "wildfly-javaee7-webapp-ear-archetype". This includes an entity and an Arquillian test that runs on a @Stateless bean. I added some other entities and want to test them directly - without a bean. I just copied and modified the test's @Deployment (changed the added classes) and tried to just persist one object. But running this tests thows:


      "javax.persistence.TransactionRequiredException: JBAS011469: Transaction is required to perform this operation (either use a transaction or extended persistence context)"


      I first tried to just begin a transaction but then i get:


      "java.lang.IllegalStateException: A JTA EntityManager cannot use getTransaction()"


      Then i googled and found Arquillians "transaction-extension" and i added



      I annotated my class with @Transactional but this didn't helped (TransactionRequiredException) then i additionally added @Transactional(@Transactional(TransactionMode.COMMIT)) at the test method but this didn't helped neither.

      So how to get transations working with Arquillian.


      Thanks in advance