Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@EntityScan(basePackageClasses = {Jsr310JpaConverters.class}) #7

Open
monxarat opened this issue Nov 25, 2018 · 2 comments
Open

@EntityScan(basePackageClasses = {Jsr310JpaConverters.class}) #7

monxarat opened this issue Nov 25, 2018 · 2 comments

Comments

@monxarat
Copy link

monxarat commented Nov 25, 2018

Hi @callicoder
When I add config @EntityScan(basePackageClasses = {Jsr310JpaConverters.class}) to Application class.

and add method init(). The bellow error has occurred. And not started Tomcat.

@PostConstruct
void init() {
        TimeZone.setDefault(TimeZone.getTimeZone("UTC"));
    }

org.springframework.beans.factory.UnsatisfiedDependencyException: 
Error creating bean with name 'securityConfiguration': Unsatisfied dependency expressed through field 
'userDetailsService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: 
Error creating bean with name 'userDetailsService': Unsatisfied dependency expressed through field 'userService'; 
nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 
'userService': Unsatisfied dependency expressed through field 'userRepository'; 
nested exception is org.springframework.beans.factory.BeanCreationException: 
Error creating bean with name 'userRepository': Invocation of init method failed; 
nested exception is java.lang.IllegalArgumentException: Not a managed type: class example.database.entry.User
@monxarat monxarat changed the title Not a managed type: class example.database.entry.User @EntityScan(basePackageClasses = {Jsr310JpaConverters.class}) Nov 25, 2018
@monxarat
Copy link
Author

I have solved. Because I forgot to add Application.class to @EntityScan.
When login perform error has occurred.

Can't cast String to UserPrincipal in the method generaterToken();

@monxarat
Copy link
Author

When I have performed signin, the bellow error has occurred.

org.springframework.security.authentication.BadCredentialsException: Bad credentials
	at org.springframework.security.authentication.dao.DaoAuthenticationProvider.additionalAuthenticationChecks(DaoAuthenticationProvider.java:89) ~[spring-security-core-5.0.5.RELEASE.jar:5.0.5.RELEASE]
	at org.springframework.security.authentication.dao.AbstractUserDetailsAuthenticationProvider.authenticate(AbstractUserDetailsAuthenticationProvider.java:166) ~[spring-security-core-5.0.5.RELEASE.jar:5.0.5.RELEASE]
	at org.springframework.security.authentication.ProviderManager.authenticate(ProviderManager.java:174) ~[spring-security-core-5.0.5.RELEASE.jar:5.0.5.RELEASE]
	at org.springframework.security.authentication.ProviderManager.authenticate(ProviderManager.java:199) ~[spring-security-core-5.0.5.RELEASE.jar:5.0.5.RELEASE]
	at org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter$AuthenticationManagerDelegator.authenticate(WebSecurityConfigurerAdapter.java:512) ~[spring-security-config-5.0.5.RELEASE.jar:5.0.5.RELEASE]
	at example.service.impl.LoginServiceImpl.login(LoginServiceImpl.java:69) ~[classes/:na]
	at example.sso.auth.LoginController.authenticateUser(LoginController.java:63) ~[classes/:na]

DaoAuthenticationProvider.java:89

if (!passwordEncoder.matches(presentedPassword, userDetails.getPassword())) {
			logger.debug("Authentication failed: password does not match stored value");

			throw new BadCredentialsException(messages.getMessage(
					"AbstractUserDetailsAuthenticationProvider.badCredentials",
					"Bad credentials"));
		}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant