Olá pessoal, importei o projeto projeto-jpa-2 aqui no meu eclipse, o mysql está configurado padrão inclusive funciona em um outro projeto JPA. também fiz a configuração da classe JpaConfigurator , vi aqui no fórum que varias pessoas tiveram este problema e conseguiram resolver no maven trocando a versão do conector mysql: Assim o fiz e o problema persiste. alguém tem ideia do que possa ser?
Estou sem entender. Sinceramente.
GRAVE: Exception sending context initialized event to listener instance of class [org.springframework.web.context.ContextLoaderListener]
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'criadorDeProdutos': Invocation of init method failed; nested exception is org.springframework.transaction.CannotCreateTransactionException: Could not open JPA EntityManager for transaction; nested exception is javax.persistence.PersistenceException: org.hibernate.exception.JDBCConnectionException: Could not open connection
at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:136)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:408)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1566)
JpaConfigurator
@Bean
public DataSource getDataSource() {
DriverManagerDataSource dataSource = new DriverManagerDataSource();
dataSource.setDriverClassName("com.mysql.jdbc.Driver");
dataSource.setUrl("jdbc:mysql://localhost/projeto_jpa");
dataSource.setUsername("root");
dataSource.setPassword("8508");
return dataSource;
}
pom.xml
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.12</version>
</dependency>
Versão mysql
mysql> select VERSION();
+-----------+
| VERSION() |
+-----------+
| 8.0.12 |
+-----------+
1 row in set (0.00 sec)
mysql> use projeto_jpa;
Database changed