Details
-
Bug
-
Resolution: Won't Do
-
Critical
-
None
-
8.2.0.Final, 9.0.0.Alpha1
-
None
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.