Reputation: 33
I tried to use Spring JPA Repository in CDI transaction context but got "WFTXN0084: UserTransaction access is forbidden in the current context" error. The environment is JBoss EAD 8 / Spring 6.1 / Jakarta EE 10.
I have a JSF backing bean, and a service object (CDI managed bean) is injected into the backing bean
@Named("registrantDetail")
@ViewScoped
public class RegistrantPageBean {
@Inject
private RegistrantService registrantService;
The service object is annotated with @Transactional (jakarta.transaction.Transactional)
@Named("registrantService")
@ApplicationScoped
@Transactional
public class RegistrantServiceBean implements RegistrantService {
@Inject
@SpringBean
private RegistrantRepository registrantRepository;
The RegistrantServiceBean has an injected RegistrantRepository. The @SpringBean is a custom qualifier used to wrap around the Spring ApplicationContext to produce Spring bean in CDI context.
So far so good, only when I run the following within the RegistrantServiceBean:
Registrant = registrantRepository.findById(id);
I'm getting the following error: "Caused by: java.lang.IllegalStateException: WFTXN0084: UserTransaction access is forbidden in the current context".
Is there any way I can fix this and make it work?
Upvotes: 0
Views: 39