Uploaded image for project: 'WildFly'
  1. WildFly
  2. WFLY-4384

ContextService (JSR236): transactional context always suspended

    XMLWordPrintable

Details

    • Bug
    • Resolution: Won't Do
    • Critical
    • None
    • 8.2.0.Final, 9.0.0.Alpha1
    • EE
    • None
    • Hide
      1. checkout maven project from GitHub: https://github.com/wrungel/bugs/tree/master/jsr236-test
      2. mvn install
      3. deploy EAR file to Wildfly server:
        cp jsr236-test-ear/target/jsr236-test-ear-1.0-SNAPSHOT/jsr236-test-ejb-1.0-SNAPSHOT.jar $JBOSS_HOME/srtandalone/deployments/
      4. start Wildfly Server using default standalone-full.xml
      5. call WebService http://localhost:8080/jsr236-test-ejb-1.0-SNAPSHOT/Jsr236WebService/Jsr236WebService
      6. check server.log for exception
      Show
      checkout maven project from GitHub: https://github.com/wrungel/bugs/tree/master/jsr236-test mvn install deploy EAR file to Wildfly server: cp jsr236-test-ear/target/jsr236-test-ear-1.0-SNAPSHOT/jsr236-test-ejb-1.0-SNAPSHOT.jar $JBOSS_HOME/srtandalone/deployments/ start Wildfly Server using default standalone-full.xml call WebService http://localhost:8080/jsr236-test-ejb-1.0-SNAPSHOT/Jsr236WebService/Jsr236WebService check server.log for exception

    Description

      According to ยง3.3.5 of JSR-236 specification:
      By using an execution property when creating the contextual proxy object, application components can choose to not suspend the transactional context on the thread ...

      Given the following EJB and Task:

      @WebService(serviceName = "Jsr236WebService")
      @Stateless
      public class Jsr236WebService {
          @Inject Jsr236ManagedTask jsr236ManagedTask;
          @Resource ManagedExecutorService executor;
          @Resource ContextService contextService;
       
          @WebMethod(operationName = "hello")
          public String hello(@WebParam(name = "name") String txt) {
              Map<String, String> execProps = new HashMap<>();
              execProps.put(ManagedTask.TRANSACTION, ManagedTask.USE_TRANSACTION_OF_EXECUTION_THREAD);
              Future<String> future = executor.submit(
                      contextService.createContextualProxy(jsr236ManagedTask, execProps, Callable.class));
      
              try {
                  return future.get();
              } catch (InterruptedException | ExecutionException e) {
                  throw new RuntimeException(e);
              }
          }
      }
      
      @Dependent
      @Transactional(Transactional.TxType.MANDATORY)
      public class Jsr236ManagedTask implements Callable<String>, ManagedTask {
          @Override
          public String call() {
              return "called";
          }
      
          @Override
          public Map<String, String> getExecutionProperties() {
             Map<String, String> execProps = new HashMap<>();
              execProps.put(ManagedTask.TRANSACTION, ManagedTask.USE_TRANSACTION_OF_EXECUTION_THREAD);
              return execProps;
          }
      }
      

      When the call() Method of the task is called the following exception occurs:

      javax.transaction.TransactionalException: ARJUNA016110: Transaction is required for invocation
      

      See maven test project https://github.com/wrungel/bugs/tree/master/jsr236-test on GitHub.

      Attachments

        Activity

          People

            emartins@redhat.com Eduardo Martins
            frolovmx_jira Maxim Frolov (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: