Solucionado (ver solução)
Solucionado
(ver solução)
3
respostas

Desde que subi o banco a primeira vez está dando esse erro Error creating bean with name 'criadorDeProdutos': Invocation of init method failed

Baixei o projeto e está dando esses erros ao iniciar o banco

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 java.lang.NullPointerException

E agora depois das mudanças na classe Produto está aparecendo esse:

Caused by: java.lang.NullPointerException
    at br.com.caelum.model.Produto.adicionarCategorias(Produto.java:58)
    at br.com.caelum.CriadorDeProdutos$1.doInTransactionWithoutResult(CriadorDeProdutos.java:55)

INFORMAÇÕES: Illegal access: this web application instance has been stopped already. Could not load []. The following stack trace is thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access.
java.lang.IllegalStateException: Illegal access: this web application instance has been stopped already. Could not load []. The following stack trace is thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access.

Está criando as tabelas, inclusive a tabela produto_categoria, mas não está populando.

3 respostas
solução!

Encontrei o problema, alterei as configurações do dataSource mudando para:

       dataSource.setDriverClassName("com.mysql.cj.jdbc.Driver");
        dataSource.setUrl("jdbc:mysql://localhost/projeto_jpa?useTimezone=true&serverTimezone=UTC");

E assim tudo funcionou.

Problema resolvido então amigo?

Resolvido, depois de quebrar muito a cabeça, obrigado Otávio.

Quer mergulhar em tecnologia e aprendizagem?

Receba a newsletter que o nosso CEO escreve pessoalmente, com insights do mercado de trabalho, ciência e desenvolvimento de software