0 Replies Latest reply on Sep 1, 2015 11:49 AM by Jonathan Macke

    Error when using transaction extension (org.jboss.arquillian.transaction.impl.lifecycle.TransactionProviderNotFoundException)

    Jonathan Macke Newbie

      Hi,

       

      I'm a newbie in Arquillian. I'm testing a simple JavaEE application (a REST service which calls an EJB/JPA business layer).

      I'm testing on JBoss AS and TomEE. I'm getting the same error on both app servers.

       

      org.jboss.arquillian.transaction.impl.lifecycle.TransactionProviderNotFoundException: Transaction provider for given test case has not been found.

          at org.jboss.arquillian.transaction.impl.lifecycle.TransactionHandler.getTransactionProvider(TransactionHandler.java:279)

          at org.jboss.arquillian.transaction.impl.lifecycle.TransactionHandler.endTransaction(TransactionHandler.java:120)

          at org.jboss.arquillian.transaction.impl.lifecycle.TransactionHandler.endTransactionAfterTest(TransactionHandler.java:102)

       

       

      My Maven profiles

       

      <profile>
                  <id>jboss-as-7.1</id>
      
                  <dependencies>
                      <dependency>
                          <groupId>org.jboss.as</groupId>
                          <artifactId>jboss-as-arquillian-container-managed</artifactId>
                          <version>7.1.1.Final</version>
                          <scope>test</scope>
                      </dependency>
      
                  </dependencies>
      
      
                  <build>
                      <plugins>
                          <plugin>
                              <groupId>org.apache.maven.plugins</groupId>
                              <artifactId>maven-surefire-plugin</artifactId>
                              <configuration>
                                  <systemPropertyVariables>
                                      <arquillian.launch>jbossas_managed</arquillian.launch>
                                  </systemPropertyVariables>
                              </configuration>
                          </plugin>
                      </plugins>
                  </build>
              </profile>
      
      
              <profile>
      
                  <id>tomee</id>
                  <activation>
                      <activeByDefault>true</activeByDefault>
                  </activation>
                  <dependencies>
                      <dependency>
                          <groupId>org.apache.openejb</groupId>
                          <artifactId>arquillian-tomee-embedded</artifactId>
                          <version>1.7.1</version>
                          <scope>test</scope>
                      </dependency>
                      <dependency>
                          <groupId>org.apache.openejb</groupId>
                          <artifactId>tomee-embedded</artifactId>
                          <version>1.7.1</version>
                          <scope>test</scope>
                      </dependency>
                      <!--Required for WebServices and RESTful WebServices -->
                      <dependency>
                          <groupId>org.apache.openejb</groupId>
                          <artifactId>tomee-webservices</artifactId>
                          <version>1.7.1</version>
                          <scope>test</scope>
                      </dependency>
                      <dependency>
                          <groupId>org.apache.openejb</groupId>
                          <artifactId>tomee-jaxrs</artifactId>
                          <version>1.7.1</version>
                          <scope>test</scope>
                      </dependency>
                  </dependencies>
      
              </profile>
      

       

       

      My Arquillian config

       

      <arquillian xmlns="http://jboss.org/schema/arquillian"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://jboss.org/schema/arquillian http://jboss.org/schema/arquillian/arquillian_1_0.xsd">
      
           <defaultProtocol type="Servlet 3.0"/>  
      
          <engine>
              <property name="deploymentExportPath">target/deployments</property>
          </engine>
      
          <container qualifier="jbossas_managed">
              <protocol type="Servlet 3.0" />
              
          </container>
      
      
          <container qualifier="tomee" default="true">
              <configuration>
                  <property name="httpPort">8089</property>
                  <property name="stopPort">-1</property>
              </configuration>
          </container>
      
      </arquillian>
      

       

       

      My test case. I'm using only the @Transactional annotation

      @RunWith(Arquillian.class)
      public class TestWithArquillian {
      
          @Deployment
          public static Archive<?> war() {
              return ShrinkWraps.war(new IncludeAllPaths());
          }
          
          @PersistenceContext(unitName = "core")
          private EntityManager em;
          
          @Test
          @Transactional(TransactionMode.ROLLBACK)
          public void testApi() throws Exception{
              
              createAccounts();
              
              URL obj = new URL("http://localhost:8089/model/rest-api/account/");
              HttpURLConnection con = (HttpURLConnection) obj.openConnection();
      
              int responseCode = con.getResponseCode();
              assertEquals(200, responseCode);
              
          }
          
          
          public void createAccounts(){
              
              List<String> accountIds = new ArrayList<String>(); 
              for (int i = 0; i < 10; i++) { 
                  Account acc = new Account();
                  em.persist(acc);
                  accountIds.add(String.valueOf(acc.getId()));
              }
          }
      

       

       

      Any hints about how to get a TransactionProvider ?

       

      Best regards,

       

      Jonathan