I have deployed Spring Boot application on WAS Liberty. The application has JMS and JDBC operations that have to happen in same transaction. But part of the application needs new "isolated" transaction. I have added @Transactional(propagation = Propagation.REQUIRES_NEW) annotation on the method but it throws TransactionSuspensionNotSupportedException.
The following features are enabled in server.xml
localConnector-1.0
servlet-6.0
pages-3.1
xmlBinding-4.0
persistence-3.1
messagingClient-3.0
messagingServer-3.0
appSecurity-5.0
restConnector-2.0
Any advice on how to enable transaction suspension or configure TransactionManager in Liberty is greatly appreciated.
Versions:
- Java 21
- Spring boot 3.4.5
- WAS Liberty 23.0.0.9
I tried adding .... but got the following error on startup Caused by: javax.naming.NameNotFoundException: javax.naming.NameNotFoundException: java:comp/TransactionManager
@Bean
public JtaTransactionManager transactionManager() throws Exception {
InitialContext context = new InitialContext();
UserTransaction utx = (UserTransaction) context.lookup("java:comp/UserTransaction");
TransactionManager tm = (TransactionManager) context.lookup("java:comp/TransactionManager");
return new JtaTransactionManager(utx, tm);
}