Hibernate: select profile0_.user_entity_id as user_ent1_4_0_, profile0_.profile_id as profile_2_4_0_, profile1_.id as id1_2_1_, profile1_.name as name2_2_1_ from user_profile profile0_ inner join profile profile1_ on profile0_.profile_id=profile1_.id where profile0_.user_entity_id=? 2021-05-13 20:39:33.121 ERROR 22472 --- [nio-8081-exec-6] o.a.c.c.C.[.[.[/].[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Handler dispatch failed; nested exception is java.lang.NoClassDefFoundError: io/jsonwebtoken/Jwts] with root cause
java.lang.NoClassDefFoundError: io/jsonwebtoken/Jwts
at br.com.itau.monitor.preco.config.security.TokenService.generationToken(TokenService.java:29) ~[classes/:na]
at br.com.itau.monitor.preco.controller.AuthenticateController.authentication(AuthenticateController.java:36) ~[classes/:na]
import io.jsonwebtoken.Jwts; import io.jsonwebtoken.SignatureAlgorithm;
@Service public class TokenService {
@Value("${everis.jwt.expiration}")
private String expiration;
@Value("${everis.jwt.secret}")
private String secret;
public String generationToken(Authentication authentication) {
UserEntity userLog = (UserEntity) authentication.getPrincipal();
Date date = new Date();
Date dateExpiration = new Date(date.getTime() + Long.parseLong(expiration));
return Jwts.builder()
.setIssuer("API Everis")
.setSubject(userLog.getId()
.toString()).setIssuedAt(date)
.setExpiration(dateExpiration)
.signWith(SignatureAlgorithm.HS256, secret)
.compact();
}
}
Coloquei um endpoind no Jwts.builder() e quando vai executar ele da varios tipos de erro até de ClasseNotFoundJwts
já troquei senha umas 10 vezes mas não consegui gerar o token
server.port=8081 spring.datasource.url=jdbc:mysql://localhost:3306/shadow?createDatabaseIfNotExist=true&serverTimezone=UTC spring.datasource.username=root spring.datasource.password=root spring.jpa.database-platform = org.hibernate.dialect.MySQL5Dialect spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.jpa.show-sql=true spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL5InnoDBDialect
#spring.jpa.properties.javax.persistence.schema-generation.scripts.action=create
#spring.jpa.properties.javax.persistence.schema-generation.scripts.create-target=src/main/resources/ddl.sql
spring.flyway.locations=classpath:db/migration,classpath:db/data
jwt
everis.jwt.expiration=86400000 everis.jwt.secret=lEAnEZSLi8qbVhnHe3Cixkq7Ty2wMs6VVu8pjPZsNfrymC5pwvxTFMQmaGIKXCwGXsV47ImKLB9W42bqoy7R8L49fAH233yOkiIhQVSqmPceHduTzrzy0tv6R2YKUlm4tVb7ERnOwnT2qdJOt8cjpvd7n2F5bSXsDXp5CBJZOsP3uoHLlHUA2YvdO17NHU58Fi38JCVmVyddMKOVfwk7iD8Ws5xZOsXhBQd8hYi0ml3XTHGY3QTckQWCLkqnAdtZ