List of usage examples for org.springframework.transaction CannotCreateTransactionException getMessage
@Override
@Nullable
public String getMessage()
From source file:org.atomsphere.management.authentication.UserDetailsServiceImpl.java
@Override public UserDetails loadUserByUsername(String userName) throws AuthenticationException, DataAccessException { User user = null;/*from w w w. ja v a2 s . c o m*/ try { // Return member from DB and populate roles. user = (User) userService.getUserByUserName(userName); if (user == null) { if (logger.isDebugEnabled()) { logger.debug("User name " + userName + " is missing in database !!!"); } throw new BadCredentialsException(MessageSourceUtils.getMessage(authenticationMessageSource, AuthenticationMessages.class, AuthenticationMessages.AUTHENTICATION_FAILED.name())); } user.setAuthorities(AuthenticationUtils.toGrantedAuthority((User) user)); logger.trace("User: " + user.getUsername() + " grantedAuthorities: " + user.getAuthorities()); } catch (CannotCreateTransactionException e) { logger.error("No connection to the database. Exception: " + e.getMessage()); if (logger.isDebugEnabled()) { logger.debug("No connection to the database. Exception: " + e.getMessage(), e); } throw new NoDBConnectionException("No connection to the database. Exception: ", e); } return user; }