SQLException: Deferred enlistment not supported
See original GitHub issueDescribe the bug
More already here: https://groups.google.com/g/quarkus-dev/c/gVffENNZPiU
Expected behavior
Like 1.12.2.Final - no error
Actual behavior
SQLException: Deferred enlistment not supported
To Reproduce
@Dependent
@Path( USER_ENDPOINT )
@Authenticated
public class UserEndpoint implements UserApi {
@Inject
UserService userService;
@GET
@Consumes( MediaType.APPLICATION_JSON )
@Produces( MediaType.APPLICATION_JSON )
@Path( GET_USER_FROM_EMAIL )
public ResponseDTO<UserDTO> getUserFromEmail( @QueryParam( value = "email" ) String email )
throws UserNotExistingException {
return ResponseDTO.of( userService.getUserByEmail( email ) );
}
}
@ApplicationScoped
@Transactional( Transactional.TxType.REQUIRED )
public class UserService {
@Inject
UserMapper userMapper;
@Inject
CurrentUserProvider currentUserProvider;
@Inject
KeycloakService keycloakService;
...
@Transactional( Transactional.TxType.NOT_SUPPORTED )
public UserDTO getUserByEmail( String email ) throws UserNotExistingException {
Optional<UserRepresentation> keycloakUserOpt = keycloakService.findUserByEmail( email );
if ( keycloakUserOpt.isEmpty() ) {
throw new UserNotExistingException( "User with email <" + email + "> not registered in keycloak.", null );
}
UserRepresentation keycloakUser = keycloakUserOpt.get();
try {
User user = userDao.findByKeycloakUsername( keycloakUser.getUsername() );
return userMapper.mapFullUser( user, email );
} catch ( NoResultException e ) {
throw new UserNotExistingException( e.getMessage(), e );
}
}
}
@ApplicationScoped
************************************************************************************************
THIS CODE DIFFERS FROM VERSION 1.12.2.Final to 1.13.4.Final. In 1.13.4.Final I had to remove this following line. In 1.12 it was working with this:**
@Transactional( Transactional.TxType.REQUIRED )
************************************************************************************************
public class UserMapper {
@Inject
FeatureMapper featureMapper;
@Inject
...
public UserDTO mapFullUser( User user ) {
return userDTO;
}
}
Configuration
# portal settings
portal.send-verify-email=true
%dev.portal.send-verify-email=false
quarkus.mailer.from=noreply@URL.at
quarkus.mailer.host=Host
quarkus.mailer.port=465
quarkus.mailer.ssl=true
quarkus.mailer.username=username
quarkus.mailer.password=Password
quarkus.mailer.mock=false
# Logging
quarkus.log.level=INFO
#%dev.quarkus.log.level=DEBUG
#%dev.quarkus.log.min-level=DEBUG
# datasource settings
quarkus.http.port=8180
quarkus.http.limits.max-body-size=20240K
quarkus.datasource.jdbc.url=jdbc:postgresql://localhost:5432/portal
quarkus.datasource.db-kind=postgresql
quarkus.hibernate-orm.database.default-schema=public
quarkus.datasource.username=username
quarkus.datasource.password=password
quarkus.datasource.jdbc.min-size=2
quarkus.datasource.jdbc.max-size=8
quarkus.hibernate-orm.database.generation=update
quarkus.package.type=uber-jar
# Rest-api settings
my-api/mp-rest/url=http://localhost:8080/
my-api/mp-rest/scope=javax.inject.Singleton
org.eclipse.microprofile.rest.client.propagateHeaders=Authorization
# flush mode hibernate
# OIDC Configuration
keycloak.url=http://localhost:8280/auth/
## general
keycloak.clientId=admin-cli
quarkus.oidc.client-id=quarkus-portal
keycloak.realm=myrealm
keycloak.username=myrealm
keycloak.password=myrealm
quarkus.oidc.auth-server-url=http://localhost:8280/auth/realms/myrealm
quarkus.oidc.token.issuer=https://URL/auth/realms/myrealm
quarkus.oidc.credentials.secret=CREDENTIALS
## Scheduler Automatic Remove of MP3 files. Jeden Monat am 1sten um 02:15am
cron.expr=0 15 02 1 * ?
## Scheduler Automatic Remove of alten Angeboten. Jeden Monat am 1sten um 03:15am
cron.expr2=0 15 03 1 * ?
# Enable Policy Enforcement
quarkus.keycloak.policy-enforcer.enable=false
# Dev variables
%dev.quarkus.hibernate-orm.log.sql=false
quarkus version 1.13.4.Final
Issue Analytics
- State:
- Created 2 years ago
- Comments:11 (7 by maintainers)
Top Results From Across the Web
Upgrading to 1.13.1.Final causes java.sql.SQLException
'Defered enlistment not supported' means that the JDBC Connection was acquired without a transaction and, later on, was being used in the ...
Read more >deeper integration between Hibernate ORM and Agroal ...
Since deferred enlistment isn't supported by Agroal - if any resource manager (MQ, ...) - you will have to make sure that UserTransaction....
Read more >java.sql.SQLException: This function is not supported using ...
SQLException : This function is not supported using HSQL and Spring? I am trying to insert a new row into my database.. Below...
Read more >Using Transactions in Quarkus
@Transactional(NOT_SUPPORTED) : if a transaction was started, suspends it and works with no transaction for the boundary of the method ; otherwise works...
Read more >Tuning connection pools - IBM
Avoid trouble: Connection pooling is not supported in an application client. ... In the application server environment, deferred enlistment refers to the ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@jonathasgabriel that sounds expected, the entity would be attached to a different TX than the repository transaction. You can’t share entities between transactions and expect lazy loading to work.
@Paul6552 did you get a chance to verify this problem with a more recent version of Quarkus?