Oi Pedro,
É isso mesmo. A aplicação foi inicializada pelo prompt e ele fica parado nesa tela.
A principio não deu erros para inicializar, então você pode tentar disparar requisições para ver se vai funcionar.
E para finalizar a aplicação no prompt, basta apertar ctrl+c
ou ctrl+x
Na vdd eu tentei entrar com esse endereço:
mas a pagina não abre, qual endereço eu devo tentar?
Aí vai depender de quais controllers você tem na aplicação e quais URLs você mapeou.
Tem algum controller mapeando o endereço /index?
sim, tem, mas agora to acompanhando a continuação pelo heroku, mas como já havia sido feito, não entendi porque não abriu na web
agora tá dando esse erro
022-08-17T16:55:30.236278+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=testbgb.herokuapp.com request_id=47da980b-0af9-4057-826d-6da09942f8da fwd="179.212.209.241" dyno= connect= service= status=503 bytes= protocol=https 2022-08-17T16:55:32.104605+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=testbgb.herokuapp.com request_id=426a7ffb-773e-4d8f-afb0-87a115ebb747 fwd="179.212.209.241" dyno= connect= service= status=503 bytes= protocol=https 2022-08-17T16:55:38.884448+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/index" host=testbgb.herokuapp.com request_id=02c34a0b-45a3-4adf-8005-f86f5e614afa fwd="179.212.209.241" dyno= connect= service= status=503 bytes= protocol=https 2022-08-17T16:55:39.220138+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=testbgb.herokuapp.com request_id=27896f68-8c97-4b88-8c61-b91054685b57 fwd="179.212.209.241" dyno= connect= service= status=503 bytes= protocol=https
Roda esse comando no prompt:
heroku ps:scale web=1
depois coloquei heroku open e nada de abrir
pela pagina do heroku ao fazer o deploy aparece esse erro
Your app does not include a heroku.yml build manifest. To deploy your app, either create a heroku.yml: https://devcenter.heroku.com/articles/build-docker-images-heroku-yml Or switch back to buildpack-based deploys: https://devcenter.heroku.com/articles/container-registry-and-runtime#changing-deployment-method
Geralmente o problema que mais acontece é com a porta da aplicação.
Confere no seu arquivo Dockerfile
se tem a propriedade do Spring indicando a porta:
"-Dserver.port=${port}"
sim, mas o port entre chaves está com letra maisc.
Your app does not include a heroku.yml build manifest.
Parece que seu projeto no Heroku está configurado de outra forma(ou isso mudou no heroku).
Crie no diretório raiz do seu projeto um arquivo chamado heroku.yml com esse conteudo:
build:
docker:
web: Dockerfile
E altere no Dockerfile o comando da última linha de ENTRYPOINT
para CMD
daí eu faço o push, release e depois o open, correto?
Isso mesmo
Esta página não está funcionandoNenhum dado foi enviado por testbgb.herokuapp.com ERR_EMPTY_RESPONSE
essa é a última linha no heroku logs --tail
2022-08-17T17:13:56.707901+00:00 heroku[web.1]: State changed from starting to up
desconsidere esses dois últimos, nao alterei o cmd
alterei para CMD mas continua o erro
2022-08-17T17:30:39.412352+00:00 heroku[web.1]: Process exited with status 143
2022-08-17T17:30:44.501653+00:00 heroku[web.1]: Starting process with command java -Xmx512m -Dserver.port\=\$\{PORT\} -jar /app.jar
Roda agora um heroku restart
para reiniciar e ver se resolve.
Acho que precisa ser heroku restart web
mesma mensagem, que os dados não foram enviados
fui conferir no h2-console e todos os dados estão lá
posta aqui o que saiu agora no log do heroku
agora eu coloquei o comando heroku ps:scale web=1
a pagina abriu mas sem os dados que estão no h2-console
Entrei aqui e vi que a aplicação subiu normalmente: https://testbgb.herokuapp.com/
O h2-console não está disponível: https://testbgb.herokuapp.com/h2-console
porque não aparece todos os dados que estão gravados no h2?
a ideia é subir os dados para mostrar as funcionalidades dos filtros/busca/cadastrar novos jogos
como voce entou no h2 para ver os dados? pois não consegui pelo enderço: https://testbgb.herokuapp.com/h2-console
pelo localhost como vc ensinou na aula
Mas aí é no localhost, ou seja, no seu computador local e não no servidor do heroku.
O Heroku não acessa os dados que estão rodando no seu locahost
no meu servidor local, mas a ideia do deploy é justamente passar esses dados tbm, correto?!
O deploy é para você subir a aplicação em algum servidor e poder acessá-la de outros computadores.
Mas os dados que estão no localhost não são compartilhados no servidor do heroku.
Mas como eu faço para os dados serem lidos em outro computador?
A ideia dessa app é ser usada como portfólio para mim, se eu enviar assim, sem funcionalidade, não serve para nada.
O que você pode fazer então, para quando subir a aplicação ela já ter dados, é criar o arquivo data.sql
e fazer alguns inserts nas tabelas.
Lembrando que precisa ter essas proprieades no application.properties para que o Spring popule o banco de dados ao iniciar a aplicação:
spring.jpa.defer-datasource-initialization=true
spring.sql.init.mode=always
eu fiz o data.sql, ele abre para mim no VScode são esses dados que estão lá, mas eu não coloquei o mode=always, vou tentar assim
eu fiz esse arquivo no eclipse, mas ele abre no vscode, e só tem o comando INSERT INTO, eu devo colocar o CREATE TABLE?
Pq só assim e com o mode=always nem abriu a pag
Se voce tiver essa propriedade no application.properties não precisa colocar o create table:
spring.jpa.hibernate.ddl-auto=update
eu tenho mas agora nem a pag abre
corrigindo:** abriu mas sem os dados**
Pra mim caregou normal: https://testbgb.herokuapp.com/
Lembre-se de sempre reiniciar o projeto no heroku quando fizer alterações no código:
heroku container:push web
heroku container:release web
heroku restart
bom, eu tinha colocado o modo always só no properties-prod agora coloquei no outro tbm, vamos ver se vai
nada, abre a pag, mas sem os dados
verifica no log do heroku se deu algum erro
to instalando isso no vscode, pode ser isso.....
=== Fetching app code === Building web (Dockerfile) Sending build context to Docker daemon 258kBStep 1/6 : FROM openjdk:8-jdk-alpine 8-jdk-alpine: Pulling from library/openjdk e7c96db7181b: Pulling fs layer f910a506b6cb: Pulling fs layer c2274a1a0e27: Pulling fs layer f910a506b6cb: Verifying Checksum f910a506b6cb: Download complete e7c96db7181b: Verifying Checksum e7c96db7181b: Download complete e7c96db7181b: Pull complete f910a506b6cb: Pull complete c2274a1a0e27: Verifying Checksum c2274a1a0e27: Download complete c2274a1a0e27: Pull complete Digest: sha256:94792824df2df33402f201713f932b58cb9de94a0cd524164a0f2283343547b3 Status: Downloaded newer image for openjdk:8-jdk-alpine ---> a3562aa0b991 Step 2/6 : RUN addgroup -S spring && adduser -S spring -G spring ---> Running in 89c2f85818cd Removing intermediate container 89c2f85818cd ---> efaf2d1097b2 Step 3/6 : USER spring:spring ---> Running in e9d612635e74 Removing intermediate container e9d612635e74 ---> 980857389e58 Step 4/6 : ARG JAR_FILE=target/*.jar ---> Running in 83b5a61f25e9 Removing intermediate container 83b5a61f25e9 ---> 39a4ffa81576 Step 5/6 : COPY ${JAR_FILE} app.jar COPY failed: no source files were specified
essa mensagem do log quando faço o deploy na pag do heroku, conectando com github e atualizando
será que tenho que gerar o jar tudo de novo?
gerei e nada
Lenovo@pedroaz MINGW64 ~/desktop/bg/boardgamesbusca (main)
$ heroku container:release web
» Warning: heroku update available from 7.53.0 to 7.62.0.
! The process type web was not updated, because it is already running the
! specified docker image.
Releasing images web to testbgb... don
e
O FATO DE NÃO CONSEGUIR FAZER O UPDATE POR JÁ TER SIDO FEITO ANTES, PODE GERAR PROBLEMAS ......
será que pode ser problema de acentuação, tava vendo na pág do vscode estava reclamando dos assentos, daí eu coloquei o UTF-8
Esse erro aparece no heroku quando faço o deploy pela pag.
Step 5/6 : COPY ${JAR_FILE} app.jar COPY failed: no source files were specified
É algum problema com o Heroku agora.
Como a sua aplicação já está toda ajustada, eu recomendo você começar de novo essa parte de deploy no heroku para evitar problemas.
Passo a passo no prompt:
mvn clean package
heroku login
heroku container:login
heroku create testbgb2
heroku container:push web
heroku container:release web
heroku open
ok vou tentar, mas estava vendos uns docs sobre o heroku postgres, parece que ele facilita a conexão com banco de dados, principalmente quando vc usa o h2. Até cheguei a usar esse comando: -heroku addons:create heroku-postgresql:hobby-dev
para instalar, mas nada....
tá complicado........ pelo prompt de comando eu ele não consegue achar o app quando faço o push, mas quando tento pelo git bash, ele não faz o login do heroku, só faz o container:login
agora nem pela linha de comando pelo git bash e nem pelo prompt ele acha o app
o que pode ser isso?
Manda um print aqui do problema no prompt
Não sei se isso é relevante, mas gerar o jar pelo prompt, ele não reconhece o comando, só consigo gerar o jar pela ide
Esqueci um comando: heroku git:remote -a testbgb2
.
Passo a passo completo:
mvn clean package
heroku login
heroku container:login
heroku create testbgb2
heroku git:remote -a testbgb2
heroku container:push web
heroku container:release web
heroku open
O jar pode ser gerado pela IDE sem problemas
esse comando eu vi lá na pag do heroku, igual vc mostrou na aula, mas ele dá esse erro agora
Error ID: not_found
Roda um heroku apps para ele listar os apps cadastrados e manda o print aqui
ele aparece igual na pag do heroku
agora foi espera um pouco
Agora subiu a aplicação, mas pelo log deu algum problema para executar o data.sql. Posta aqui o conteudo desse seu arquivo
aguarda um pouco, eu não fiz o config desse
mesmo erro h10
INSERT INTO `dados_jogo` (`id`, `descricao`, `loja`, `nome_do_jogo`, `nota`, `preco`, `url_imagem`) VALUES
(1, 'Incrível!!', 'Amazon', 'DixIt', 10, 279.99, 'https://images-na.ssl-images-amazon.com/images/I/71v70BVCqGL.__AC_SX300_SY300_QL70_ML2_.jpg'),
(2, 'Muito bom com os amigos!', 'Amazon', 'Black Stories', 8, 43.87, 'https://m.media-amazon.com/images/I/61-zbcN6HmL._AC_SY879_.jpg'),
(3, 'Muito complicado, mas aprendendo fica bom!', 'Amazon', 'Magic', 7, 229.9, 'https://m.media-amazon.com/images/I/61zEBPUEp-L._AC_SX569_.jpg'),
(4, 'Clássico', 'Americanas', 'Dectetive', 8, 99.99, 'https://m.media-amazon.com/images/I/91deu+m93jL._AC_SX569_.jpg'),
(5, 'Pura nostalgia!!', 'Americanas', 'Banco Imobiliario', 10, 163, 'https://http2.mlstatic.com/D_NQ_NP_815831-MLA46818901945_072021-O.webp'),
(6, 'Bem divertido', 'Americanas', 'Banco Imobiliario Mundo', 7, 139, 'https://http2.mlstatic.com/D_NQ_NP_989487-MLB41695008984_052020-O.webp'),
(7, 'Siniiiisxxxxxtroooo....', 'Amazon', 'Zombicide: Black Plague', 10, 799.99, 'https://m.media-amazon.com/images/I/81bBS06A9LL._AC_SX569_.jpg'),
(8, 'Bons tempos de rpg', 'Mercado Livre', 'Hero Quest', 6, 17.71, 'https://http2.mlstatic.com/D_NQ_NP_881688-MLB45649029491_042021-O.webp'),
(9,
'Excepcional, nunca vi um jogo assim!', 'Amazon', 'Gloomhaven', 10, 1329, 'https://m.media-amazon.com/images/I/51mmjCK-PiL._AC_.jpg'),
(10, 'Muito fiel a série', 'Amazon', 'Guerra dos Tronos', 8, 317, 'https://m.media-amazon.com/images/I/A105putUJ4L._AC_SX569_.jpg'),
(11, 'Mais um clássico dos anos 80!', 'RiHappy', 'WAR', 7, 209.9, 'https://a-static.mlcdn.com.br/800x600/title-reference/magazineluiza/220544300/a1fde1e72b47f486c040667c5ce7183a.jpg');
INSERT INTO dados_jogo
(id
, descricao
, loja
, nome_do_jogo
, nota
, preco
, url_imagem
) VALUES
(1, 'Incrível!!', 'Amazon', 'DixIt', 10, 279.99, 'https://images-na.ssl-images-amazon.com/images/I/71v70BVCqGL.__AC_SX300_SY300_QL70_ML2_.jpg'),
(2, 'Muito bom com os amigos!', 'Amazon', 'Black Stories', 8, 43.87, 'https://m.media-amazon.com/images/I/61-zbcN6HmL._AC_SY879_.jpg'),
(3, 'Muito complicado, mas aprendendo fica bom!', 'Amazon', 'Magic', 7, 229.9, 'https://m.media-amazon.com/images/I/61zEBPUEp-L._AC_SX569_.jpg'),
(4, 'Clássico', 'Americanas', 'Dectetive', 8, 99.99, 'https://m.media-amazon.com/images/I/91deu+m93jL._AC_SX569_.jpg'),
(5, 'Pura nostalgia!!', 'Americanas', 'Banco Imobiliario', 10, 163, 'https://http2.mlstatic.com/D_NQ_NP_815831-MLA46818901945_072021-O.webp'),
(6, 'Bem divertido', 'Americanas', 'Banco Imobiliario Mundo', 7, 139, 'https://http2.mlstatic.com/D_NQ_NP_989487-MLB41695008984_052020-O.webp'),
(7, 'Siniiiisxxxxxtroooo....', 'Amazon', 'Zombicide: Black Plague', 10, 799.99, 'https://m.media-amazon.com/images/I/81bBS06A9LL._AC_SX569_.jpg'),
(8, 'Bons tempos de rpg', 'Mercado Livre', 'Hero Quest', 6, 17.71, 'https://http2.mlstatic.com/D_NQ_NP_881688-MLB45649029491_042021-O.webp'),
(9, 'Excepcional, nunca vi um jogo assim!', 'Amazon', 'Gloomhaven', 10, 1329, 'https://m.media-amazon.com/images/I/51mmjCK-PiL._AC_.jpg'),
(10, 'Muito fiel a série', 'Amazon', 'Guerra dos Tronos', 8, 317, 'https://m.media-amazon.com/images/I/A105putUJ4L._AC_SX569_.jpg'),
(11, 'Mais um clássico dos anos 80!', 'RiHappy', 'WAR', 7, 209.9, 'https://a-static.mlcdn.com.br/800x600/title-reference/magazineluiza/220544300/a1fde1e72b47f486c040667c5ce7183a.jpg');
INSERT INTO `dados_jogo` (`id`, `descricao`, `loja`, `nome_do_jogo`, `nota`, `preco`, `url_imagem`) VALUES
(1, 'Incrível!!', 'Amazon', 'DixIt', 10, 279.99, 'https://images-na.ssl-images-amazon.com/images/I/71v70BVCqGL.__AC_SX300_SY300_QL70_ML2_.jpg'),
(2, 'Muito bom com os amigos!', 'Amazon', 'Black Stories', 8, 43.87, 'https://m.media-amazon.com/images/I/61-zbcN6HmL._AC_SY879_.jpg'),
(3, 'Muito complicado, mas aprendendo fica bom!', 'Amazon', 'Magic', 7, 229.9, 'https://m.media-amazon.com/images/I/61zEBPUEp-L._AC_SX569_.jpg'),
(4, 'Clássico', 'Americanas', 'Dectetive', 8, 99.99, 'https://m.media-amazon.com/images/I/91deu+m93jL._AC_SX569_.jpg'),
(5, 'Pura nostalgia!!', 'Americanas', 'Banco Imobiliario', 10, 163, 'https://http2.mlstatic.com/D_NQ_NP_815831-MLA46818901945_072021-O.webp'),
(6, 'Bem divertido', 'Americanas', 'Banco Imobiliario Mundo', 7, 139, 'https://http2.mlstatic.com/D_NQ_NP_989487-MLB41695008984_052020-O.webp'),
(7, 'Siniiiisxxxxxtroooo....', 'Amazon', 'Zombicide: Black Plague', 10, 799.99, 'https://m.media-amazon.com/images/I/81bBS06A9LL._AC_SX569_.jpg'),
(8, 'Bons tempos de rpg', 'Mercado Livre', 'Hero Quest', 6, 17.71, 'https://http2.mlstatic.com/D_NQ_NP_881688-MLB45649029491_042021-O.webp'),
(9, 'Excepcional, nunca vi um jogo assim!', 'Amazon', 'Gloomhaven', 10, 1329, 'https://m.media-amazon.com/images/I/51mmjCK-PiL._AC_.jpg'),
(10, 'Muito fiel a série', 'Amazon', 'Guerra dos Tronos', 8, 317, 'https://m.media-amazon.com/images/I/A105putUJ4L._AC_SX569_.jpg'),
(11, 'Mais um clássico dos anos 80!', 'RiHappy', 'WAR', 7, 209.9, 'https://a-static.mlcdn.com.br/800x600/title-reference/magazineluiza/220544300/a1fde1e72b47f486c040667c5ce7183a.jpg');
considera essa ultima, mas não entendi pq esse arquivo abre separado do eclipse, abre no vscode
O arquivo está certinho.
Deve ser problema então na sua entidade, que deve estar diferente os atributos em relação as colunas da tabela.
Posta aqui o codigo da sua entidade
package br.com.pedroaz.board.boardgamesbusca.model;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
@Entity
public class DadosJogo {
@Id @GeneratedValue(strategy=GenerationType.IDENTITY)
private long id;
private String nomeDoJogo;
private double preco;
private String urlImagem;
private String descricao;
private double nota;
private String loja;
public String getLoja() {
return loja;
}
public void setLoja(String loja) {
this.loja = loja;
}
public double getNota() {
return nota;
}
public void setNota(double nota) {
this.nota = nota;
}
public String getNomeDoJogo() {
return nomeDoJogo;
}
public void setNomeDoJogo(String nomeDoJogo) {
this.nomeDoJogo = nomeDoJogo;
}
public double getPreco() {
return preco;
}
public void setPreco(double preco) {
this.preco = preco;
}
public String getUrlImagem() {
return urlImagem;
}
public void setUrlImagem(String urlImagem) {
this.urlImagem = urlImagem;
}
public String getDescricao() {
return descricao;
}
public void setDescricao(String descricao) {
this.descricao = descricao;
}
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
}
Precisa adicionar as anotações da JPA para especificar o nome da tabela e de algumas colunas:
@Entity
@Table(name = "dados_jogo")
public class DadosJogo {
@Id @GeneratedValue(strategy=GenerationType.IDENTITY)
private long id;
@Column(name = "nome_do_jogo")
private String nomeDoJogo;
private double preco;
@Column(name = "url_imagem")
private String urlImagem;
private String descricao;
private double nota;
private String loja;
sera que devo colocar @table com dadosJogo?
Tanto faz. Mas no insert do arquivo data.sql o nome da tabela e das colunas devem ser iguais ao que está mapeado na entidade!
Como estava rodando localmente, não imaginava que deveria colocar essas anotações, e estava procurando erro fora, espero que agora dê certo, obrigado pela atenção, eu aviso se subir
não adiantou
Agora a aplicação subiu certinha: https://testbgb7.herokuapp.com/
Posta aqui o código do seu controller
package br.com.pedroaz.board.boardgamesbusca.controller;
import java.security.Principal;
import java.util.List;
import javax.transaction.Transactional;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Sort;
import org.springframework.stereotype.Controller;
import org.springframework.stereotype.Repository;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.ModelAndView;
import br.com.pedroaz.board.boardgamesbusca.model.DadosJogo;
import br.com.pedroaz.board.boardgamesbusca.repository.DadosJogosRepository;
@Repository
@Controller
public class IndexController {
@Autowired
private DadosJogosRepository pedidoRepository;
@Transactional
@GetMapping("/index")
public String index(Model model, Principal principal) {
PageRequest paginacao = PageRequest.of(0,7);
List<DadosJogo>dados = pedidoRepository.findAll(paginacao);
model.addAttribute("dados",dados);
return "/index";
}
@Transactional
@RequestMapping("/preco")
public String preco(Model model, Principal principal) {
Sort sort = Sort.by("preco").ascending();
PageRequest paginacao = PageRequest.of(0,7,sort);
List<DadosJogo>dados = pedidoRepository.findAll(paginacao);
model.addAttribute("dados",dados);
return "/index";
}
@Transactional
@RequestMapping("/notas")
public String notas(Model model, Principal principal) {
Sort sort = Sort.by("nota").descending();
PageRequest paginacao = PageRequest.of(0,7,sort);
List<DadosJogo>dados = pedidoRepository.findAll(paginacao);
model.addAttribute("dados",dados);
return "/index";
}
@Transactional
@RequestMapping("/lista")
public ModelAndView pesquisar (@RequestParam("nomeJogo")String nomeJogo){
ModelAndView modelAndView = new ModelAndView("/index");
modelAndView.addObject("dados",pedidoRepository.findByNomeDoJogoEqualsIgnoreCase(nomeJogo));
return modelAndView;
}
}
package br.com.pedroaz.board.boardgamesbusca.controller;
import java.beans.Transient;
import javax.transaction.Transactional;
import javax.validation.Valid;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.stereotype.Repository;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import br.com.pedroaz.board.boardgamesbusca.dto.RequisicaoNovoJogo;
import br.com.pedroaz.board.boardgamesbusca.model.DadosJogo;
import br.com.pedroaz.board.boardgamesbusca.repository.DadosJogosRepository;
@Controller
@Repository
public class JogosAddController {
//-----------------@Autowired--------------------------------------------------
//spring cria uma instância dessa classe
// e vai utilizar essa classe para salvar os dados no banco de dados
@Autowired
private DadosJogosRepository dadosJogosRepository;
@Transactional
@GetMapping("/dados/formulario")
public String formulario(RequisicaoNovoJogo requisicao) {
return "dados/formulario";
}
@Transactional
@PostMapping("dados/novo")
public String novo(@Valid RequisicaoNovoJogo requisicao,BindingResult result) {
if(result.hasErrors()) {
return "dados/formulario";
}
DadosJogo dadosJogo = requisicao.toDadosJogos();
dadosJogosRepository.save(dadosJogo);
return "redirect:/index";
}
}
são 2, um para adiconar e outro do index
Ta dando erro 500 ao entrar nos endereços /index e /notas.
Veja no log do heroku qual erro aconteceu: heroku logs --tail
2022-08-18T14:10:05.309180+00:00 heroku[router]: at=info method=GET path="/lista" host=testbgb7.herokuapp.com request_id=14143de0-8f08-42f2-8e66-c0dc8066a5fa fwd="189.6.6.29" dyno=web.1 connect=0ms service=4ms status=400 bytes=435 protocol=https
2022-08-18T14:10:05.306837+00:00 app[web.1]: 2022-08-18 14:10:05.306 WARN 3 --- [io-51512-exec-1] .w.s.m.s.DefaultHandlerExceptionResolver : Resolved [org.springframework.web.bind.MissingServletRequestParameterException: Required request parameter 'nomeJogo' for method parameter type String is not present]
2022-08-18T14:10:42.212130+00:00 heroku[router]: at=info method=GET path="/notas" host=testbgb7.herokuapp.com request_id=c598c362-a3b9-4bb8-94e3-7164bc6b22e9 fwd="189.6.6.29" dyno=web.1 connect=0ms service=14ms status=500 bytes=445 protocol=https
tá reclamando da string nomeJogo que coloquei no @requestParam, vou trocar para o nome igual está na classe model
Pedro, a recomendação agora é você revisar o codigo da aplicação. Ela está funcionando normalmente local? eu tentei cadastrar um novo jogo pelo heroku e deu erro: https://testbgb7.herokuapp.com/dados/formulario
Localmente sempre rodou perfeitamente tanto pelo HeidiSQL, quanto pelo H2-console
tá há quase 1 mês tentando fazer um deploy e nada, to desesperado com isso.
Eu tenho quase certeza que o problema agora é relacionado ao banco de dados.
Pega o log completo no site do heroku mesmo e posta aqui.
to fazendo um push já com outro nome, assim que terminar vou ver o log lá no heroku
esta demorando mais esse deploy, mas já te dou uma resposta
2022-08-18T15:16:47.990457+00:00 app[api]: Release v1 created by user pdegutty@gmail.com
2022-08-18T15:16:47.990457+00:00 app[api]: Initial release by user pdegutty@gmail.com
2022-08-18T15:16:48.225668+00:00 app[api]: Enable Logplex by user pdegutty@gmail.com
2022-08-18T15:16:48.225668+00:00 app[api]: Release v2 created by user pdegutty@gmail.com
2022-08-18T15:41:37.792931+00:00 heroku[web.1]: Starting process with command java -Xmx512m -Dserver.port\=\$\{port\} -jar /app.jar
2022-08-18T15:41:41.492600+00:00 app[web.1]:
2022-08-18T15:41:41.492621+00:00 app[web.1]: . __ _ __ _ _
2022-08-18T15:41:41.492659+00:00 app[web.1]: /\ / _'_ _ _ _()_ _ __ _ \ \ \ 2022-08-18T15:41:41.492664+00:00 app[web.1]: ( ( )___ | ' | '| | ' / ` | \ \ \ 2022-08-18T15:41:41.492693+00:00 app[web.1]: \/ ___)| |)| | | | | || (| | ) ) ) )
2022-08-18T15:41:41.492721+00:00 app[web.1]: ' |__| .|| ||_| |_, | / / / /
2022-08-18T15:41:41.492763+00:00 app[web.1]: =========||==============|__/=///_/
2022-08-18T15:41:41.493551+00:00 app[web.1]: :: Spring Boot :: (v2.7.1)
2022-08-18T15:41:41.493568+00:00 app[web.1]:
2022-08-18T15:41:41.811676+00:00 app[web.1]: 2022-08-18 15:41:41.806 INFO 3 --- [ main] b.c.p.b.b.BoardgamesbuscaApplication : Starting BoardgamesbuscaApplication v0.0.1-SNAPSHOT using Java 1.8.0212 on 3d6458b9-47fc-4fa4-a9c9-f5b98c4eefe3 with PID 3 (/app.jar started by u34169 in /)
2022-08-18T15:41:41.811684+00:00 app[web.1]: 2022-08-18 15:41:41.811 INFO 3 --- [ main] b.c.p.b.b.BoardgamesbuscaApplication : No active profile set, falling back to 1 default profile: "default"
2022-08-18T15:41:46.518370+00:00 app[web.1]: 2022-08-18 15:41:46.518 INFO 3 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data JPA repositories in DEFAULT mode.
2022-08-18T15:41:47.311284+00:00 app[web.1]: 2022-08-18 15:41:47.311 INFO 3 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 781 ms. Found 1 JPA repository interfaces.
2022-08-18T15:41:50.323135+00:00 app[web.1]: 2022-08-18 15:41:50.322 INFO 3 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 23045 (http)
2022-08-18T15:41:50.343661+00:00 app[web.1]: 2022-08-18 15:41:50.343 INFO 3 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2022-08-18T15:41:50.343957+00:00 app[web.1]: 2022-08-18 15:41:50.343 INFO 3 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.64]
(http) with context path '' 2022-08-18T15:42:03.513801+00:00 app[web.1]: 2022-08-18 15:42:03.513 INFO 3 --- [ main] b.c.p.b.b.BoardgamesbuscaApplication : Started BoardgamesbuscaApplication in 23.849 seconds (JVM running for 24.742) 2022-08-18T15:42:03.962180+00:00 heroku[web.1]: State changed from starting to up 2022-08-18T15:42:05.473488+00:00 app[web.1]: 2022-08-18 15:42:05.473 INFO 3 --- [io-23045-exec-3] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring DispatcherServlet 'dispatcherServlet' 2022-08-18T15:42:05.473557+00:00 app[web.1]: 2022-08-18 15:42:05.473 INFO 3 --- [io-23045-exec-3] o.s.web.servlet.DispatcherServlet : Initializing Servlet 'dispatcherServlet' 2022-08-18T15:42:05.474840+00:00 app[web.1]: 2022-08-18 15:42:05.474 INFO 3 --- [io-23045-exec-3] o.s.web.servlet.DispatcherServlet : Completed initialization in 1 ms 2022-08-18T15:42:05.880800+00:00 heroku[router]: at=info method=GET path="/" host=appbgb.herokuapp.com request_id=1f19f73f-6759-4a39-a20c-3702dc1c7e07 fwd="179.212.209.241" dyno=web.1 connect=0ms service=441ms status=200 bytes=1739 protocol=https 2022-08-18T15:42:06.726470+00:00 heroku[router]: at=info method=GET path="/favicon.ico" host=appbgb.herokuapp.com request_id=d3352cfd-0068-443d-a41a-ce9918483f85 fwd="179.212.209.241" dyno=web.1 connect=1ms service=93ms status=404 bytes=333 protocol=https 2022-08-18T15:42:17.518412+00:00 heroku[router]: at=info method=GET path="/index" host=appbgb.herokuapp.com request_id=ea07bf2a-0282-45f4-ab71-31d05a19d357 fwd="179.212.209.241" dyno=web.1 connect=0ms service=1048ms status=500 bytes=445 protocol=https
2022-08-18T15:42:17.505491+00:00 app[web.1]: 2022-08-18 15:42:17.505 ERROR 3 --- [io-23045-exec-5] org.thymeleaf.TemplateEngine : [THYMELEAF][http-nio-23045-exec-5] Exception processing template "/index": Error resolving template [/index], template might not exist or might not be accessible by any of the configured Template Resolvers 2022-08-18T15:42:17.505505+00:00 app[web.1]: 2022-08-18T15:42:17.505506+00:00 app[web.1]: org.thymeleaf.exceptions.TemplateInputException: Error resolving template [/index], template might not exist or might not be accessible by any of the configured Template Resolvers 2022-08-18T15:42:17.505517+00:00 app[web.1]: at org.thymeleaf.engine.TemplateManager.resolveTemplate(TemplateManager.java:869) ~[thymeleaf-3.0.15.RELEASE.jar!/:3.0.15.RELEASE]
2022-08-18T15:42:17.505517+00:00 app[web.1]: at org.thymeleaf.engine.TemplateManager.parseAndProcess(TemplateManager.java:607) ~[thymeleaf-3.0.15.RELEASE.jar!/:3.0.15.RELEASE] 2022-08-18T15:42:17.505517+00:00 app[web.1]: at org.thymeleaf.TemplateEngine.process(TemplateEngine.java:1098) [thymeleaf-3.0.15.RELEASE.jar!/:3.0.15.RELEASE] 2022-08-18T15:42:17.505517+00:00 app[web.1]: at org.thymeleaf.TemplateEngine.process(TemplateEngine.java:1072) [thymeleaf-3.0.15.RELEASE.jar!/:3.0.15.RELEASE] 2022-08-18T15:42:17.505518+00:00 app[web.1]: at org.thymeleaf.spring5.view.ThymeleafView.renderFragment(ThymeleafView.java:366) [thymeleaf-spring5-3.0.15.RELEASE.jar!/:3.0.15.RELEASE] 2022-08-18T15:42:17.505518+00:00 app[web.1]: at org.thymeleaf.spring5.view.ThymeleafView.render(ThymeleafView.java:190) [thymeleaf-spring5-3.0.15.RELEASE.jar!/:3.0.15.RELEASE] 2022-08-18T15:42:17.505518+00:00 app[web.1]: at org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1401) [spring-webmvc-5.3.21.jar!/:5.3.21] 2022-08-18T15:42:17.505518+00:00 app[web.1]: at org.springframework.web.servlet.DispatcherServlet.processDispatchResult(DispatcherServlet.java:1145) [spring-webmvc-5.3.21.jar!/:5.3.21] 2022-08-18T15:42:17.505518+00:00 app[web.1]: at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1084) [spring-webmvc-5.3.21.jar!/:5.3.21] 2022-08-18T15:42:17.505519+00:00 app[web.1]: at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:963) [spring-webmvc-5.3.21.jar!/:5.3.21] 2022-08-18T15:42:17.505519+00:00 app[web.1]: at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006) [spring-webmvc-5.3.21.jar!/:5.3.21] 2022-08-18T15:42:17.505519+00:00 app[web.1]: at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:898) [spring-webmvc-5.3.21.jar!/:5.3.21] 2022-08-18T15:42:17.505519+00:00 app[web.1]: at javax.servlet.http.HttpServlet.service(HttpServlet.java:655) [tomcat-embed-core-9.0.64.jar!/:na] 2022-08-18T15:42:17.505525+00:00 app[web.1]: at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883) [spring-webmvc-5.3.21.jar!/:5.3.21] 2022-08-18T15:42:17.505525+00:00 app[web.1]: at javax.servlet.http.HttpServlet.service(HttpServlet.java:764) [tomcat-embed-core-9.0.64.jar!/:na] 2022-08-18T15:42:17.505525+00:00 app[web.1]: at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:227) [tomcat-embed-core-9.0.64.jar!/:na] 2022-08-18T15:42:17.505525+00:00 app[web.1]: at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) [tomcat-embed-core-9.0.64.jar!/:na] 2022-08-18T15:42:17.505525+00:00 app[web.1]: at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53) [tomcat-embed-websocket-9.0.64.jar!/:na] 2022-08-18T15:42:17.505525+00:00 app[web.1]: at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) [tomcat-embed-core-9.0.64.jar!/:na]
2022-08-18T15:42:17.506698+00:00 app[web.1]: at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:197) ~[tomcat-embed-core-9.0.64.jar!/:na] 2022-08-18T15:42:17.506698+00:00 app[web.1]: at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:97) [tomcat-embed-core-9.0.64.jar!/:na] 2022-08-18T15:42:17.506698+00:00 app[web.1]: at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:541) [tomcat-embed-core-9.0.64.jar!/:na] 2022-08-18T15:42:17.506698+00:00 app[web.1]: at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:135) [tomcat-embed-core-9.0.64.jar!/:na] 2022-08-18T15:42:17.506698+00:00 app[web.1]: at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92) [tomcat-embed-core-9.0.64.jar!/:na] 2022-08-18T15:42:17.506698+00:00 app[web.1]: at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:78) [tomcat-embed-core-9.0.64.jar!/:na] 2022-08-18T15:42:17.506698+00:00 app[web.1]: at org.apache.catalina.valves.RemoteIpValve.invoke(RemoteIpValve.java:769) [tomcat-embed-core-9.0.64.jar!/:na] 2022-08-18T15:42:17.506699+00:00 app[web.1]: at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:360) [tomcat-embed-core-9.0.64.jar!/:na] 2022-08-18T15:42:17.506699+00:00 app[web.1]: at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:399) [tomcat-embed-core-9.0.64.jar!/:na] 2022-08-18T15:42:17.506699+00:00 app[web.1]: at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65) [tomcat-embed-core-9.0.64.jar!/:na] 2022-08-18T15:42:17.506699+00:00 app[web.1]: at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:890) [tomcat-embed-core-9.0.64.jar!/:na] 2022-08-18T15:42:17.506699+00:00 app[web.1]: at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1787) [tomcat-embed-core-9.0.64.jar!/:na] 2022-08-18T15:42:17.506699+00:00 app[web.1]: at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) [tomcat-embed-core-9.0.64.jar!/:na] 2022-08-18T15:42:17.506699+00:00 app[web.1]: at org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1191) [tomcat-embed-core-9.0.64.jar!/:na] 2022-08-18T15:42:17.506700+00:00 app[web.1]: at org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659) [tomcat-embed-core-9.0.64.jar!/:na] 2022-08-18T15:42:17.506700+00:00 app[web.1]: at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-embed-core-9.0.64.jar!/:na] 2022-08-18T15:42:17.506700+00:00 app[web.1]: at java.lang.Thread.run(Thread.java:748) [na:1.8.0_212] 2022-08-18T15:42:17.506700+00:00 app[web.1]: 2022-08-18T15:41:35.350140+00:00 app[api]: Deployed web (743b2e8ab455) by user pdegutty@gmail.com 2022-08-18T15:41:35.366386+00:00 app[api]: Scaled to web@1:Free by user pdegutty@gmail.com 2022-08-18T15:41:35.350140+00:00 app[api]: Release v3 created by user pdegutty@gmail.com 2022-08-18T15:46:22.110136+00:00 heroku[router]: at=info method=GET path="/" host=appbgb.herokuapp.com request_id=ec4ab23f-8ce6-43f9-9662-9c6cf7feec27 fwd="189.6.6.29" dyno=web.1 connect=0ms service=5ms status=200 bytes=1739 protocol=https 2022-08-18T15:46:22.407116+00:00 heroku[router]: at=info method=GET path="/favicon.ico" host=appbgb.herokuapp.com request_id=702289ef-2ef1-4905-bc6d-2ac467358dcd fwd="189.6.6.29" dyno=web.1 connect=1ms service=7ms status=404 bytes=333 protocol=https 2022-08-18T15:47:16.720067+00:00 app[web.1]: 2022-08-18 15:47:16.719 ERROR 3 --- [io-23045-exec-2] org.thymeleaf.TemplateEngine : [THYMELEAF][http-nio-23045-exec-2] Exception processing template "/index": Error resolving template [/index], template might not exist or might not be accessible by any of the configured Template Resolvers 2022-08-18T15:47:16.720087+00:00 app[web.1]: 2022-08-18T15:47:16.720088+00:00 app[web.1]: org.thymeleaf.exceptions.TemplateInputException: Error resolving template [/index], template might not exist or might not be accessible by any of the configured Template Resolvers 2022-08-18T15:47:16.720088+00:00 app[web.1]: at org.thymeleaf.engine.TemplateManager.resolveTemplate(TemplateManager.java:869) ~[thymeleaf-3.0.15.RELEASE.jar!/:3.0.15.RELEASE]
2022-08-18T15:47:16.720089+00:00 app[web.1]: at org.thymeleaf.engine.TemplateManager.parseAndProcess(TemplateManager.java:607) ~[thymeleaf-3.0.15.RELEASE.jar!/:3.0.15.RELEASE] 2022-08-18T15:47:16.720089+00:00 app[web.1]: at org.thymeleaf.TemplateEngine.process(TemplateEngine.java:1098) [thymeleaf-3.0.15.RELEASE.jar!/:3.0.15.RELEASE] 2022-08-18T15:47:16.720090+00:00 app[web.1]: at org.thymeleaf.TemplateEngine.process(TemplateEngine.java:1072) [thymeleaf-3.0.15.RELEASE.jar!/:3.0.15.RELEASE] 2022-08-18T15:47:16.720090+00:00 app[web.1]: at org.thymeleaf.spring5.view.ThymeleafView.renderFragment(ThymeleafView.java:366) [thymeleaf-spring5-3.0.15.RELEASE.jar!/:3.0.15.RELEASE] 2022-08-18T15:47:16.720090+00:00 app[web.1]: at org.thymeleaf.spring5.view.ThymeleafView.render(ThymeleafView.java:190) [thymeleaf-spring5-3.0.15.RELEASE.jar!/:3.0.15.RELEASE] 2022-08-18T15:47:16.720091+00:00 app[web.1]: at org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1401) [spring-webmvc-5.3.21.jar!/:5.3.21] 2022-08-18T15:47:16.720091+00:00 app[web.1]: at org.springframework.web.servlet.DispatcherServlet.processDispatchResult(DispatcherServlet.java:1145) [spring-webmvc-5.3.21.jar!/:5.3.21] 2022-08-18T15:47:16.720091+00:00 app[web.1]: at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1084) [spring-webmvc-5.3.21.jar!/:5.3.21] 2022-08-18T15:47:16.720091+00:00 app[web.1]: at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:963) [spring-webmvc-5.3.21.jar!/:5.3.21] 2022-08-18T15:47:16.720091+00:00 app[web.1]: at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006) [spring-webmvc-5.3.21.jar!/:5.3.21] 2022-08-18T15:47:16.720092+00:00 app[web.1]: at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:898) [spring-webmvc-5.3.21.jar!/:5.3.21] 2022-08-18T15:47:16.720092+00:00 app[web.1]: at javax.servlet.http.HttpServlet.service(HttpServlet.java:655) [tomcat-embed-core-9.0.64.jar!/:na] 2022-08-18T15:47:16.720092+00:00 app[web.1]: at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883) [spring-webmvc-5.3.21.jar!/:5.3.21] 2022-08-18T15:47:16.720093+00:00 app[web.1]: at javax.servlet.http.HttpServlet.service(HttpServlet.java:764) [tomcat-embed-core-9.0.64.jar!/:na] 2022-08-18T15:47:16.720093+00:00 app[web.1]: at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:227) [tomcat-embed-core-9.0.64.jar!/:na] 2022-08-18T15:47:16.720093+00:00 app[web.1]: at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) [tomcat-embed-core-9.0.64.jar!/:na] 2022-08-18T15:47:16.720093+00:00 app[web.1]: at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53) [tomcat-embed-websocket-9.0.64.jar!/:na] 2022-08-18T15:47:16.720094+00:00 app[web.1]: at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) [tomcat-embed-core-9.0.64.jar!/:na] 2022-08-18T15:47:16.720094+00:00 app[web.1]: at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) [tomcat-embed-core-9.0.64.jar!/:na] 2022-08-18T15:47:16.720095+00:00 app[web.1]: at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100) [spring-web-5.3.21.jar!/:5.3.21] 2022-08-18T15:47:16.720095+00:00 app[web.1]: at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:117) [spring-web-5.3.21.jar!/:5.3.21] 2022-08-18T15:47:16.720095+00:00 app[web.1]: at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) [tomcat-embed-core-9.0.64.jar!/:na] 2022-08-18T15:47:16.720095+00:00 app[web.1]: at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) [tomcat-embed-core-9.0.64.jar!/:na] 2022-08-18T15:47:16.720096+00:00 app[web.1]: at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93) [spring-web-5.3.21.jar!/:5.3.21] 2022-08-18T15:47:16.720096+00:00 app[web.1]: at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:117) [spring-web-5.3.21.jar!/:5.3.21] 2022-08-18T15:47:16.720096+00:00 app[web.1]: at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) [tomcat-embed-core-9.0.64.jar!/:na]
Subiu, mas deu esse erro: Exception processing template "/index": Error resolving template [/index], template might not exist or might not be accessible by any of the configured Template Resolvers
Ele não encontrou a página index no seu projeto, de acordo com o return do método index da sua classe Controller:
@Transactional
@GetMapping("/index")
public String index(Model model, Principal principal) {
PageRequest paginacao = PageRequest.of(0,7);
List<DadosJogo>dados = pedidoRepository.findAll(paginacao);
model.addAttribute("dados",dados);
return "/index";
}
Existe essa página index.html ou index.jsp no diretório src/main/resources/templates do seu projeto?
Posta aqui um print da estrutura de diretorios do seu projeto no Eclipse, com todas as pastas expandidas
2022-08-18T15:47:16.720096+00:00 app[web.1]: at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) [tomcat-embed-core-9.0.64.jar!/:na] 2022-08-18T15:47:16.720103+00:00 app[web.1]: at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201) [spring-web-5.3.21.jar!/:5.3.21] 2022-08-18T15:47:16.720103+00:00 app[web.1]: at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:117) [spring-web-5.3.21.jar!/:5.3.21] 2022-08-18T15:47:16.720103+00:00 app[web.1]: at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) [tomcat-embed-core-9.0.64.jar!/:na] 2022-08-18T15:47:16.720103+00:00 app[web.1]: at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) [tomcat-embed-core-9.0.64.jar!/:na] 2022-08-18T15:47:16.720103+00:00 app[web.1]: at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:197) [tomcat-embed-core-9.0.64.jar!/:na] 2022-08-18T15:47:16.720104+00:00 app[web.1]: at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:97) [tomcat-embed-core-9.0.64.jar!/:na] 2022-08-18T15:47:16.720104+00:00 app[web.1]: at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:541) [tomcat-embed-core-9.0.64.jar!/:na] 2022-08-18T15:47:16.720104+00:00 app[web.1]: at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:135) [tomcat-embed-core-9.0.64.jar!/:na] 2022-08-18T15:47:16.720104+00:00 app[web.1]: at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92) [tomcat-embed-core-9.0.64.jar!/:na] 2022-08-18T15:47:16.720105+00:00 app[web.1]: at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:78) [tomcat-embed-core-9.0.64.jar!/:na] 2022-08-18T15:47:16.720105+00:00 app[web.1]: at org.apache.catalina.valves.RemoteIpValve.invoke(RemoteIpValve.java:769) [tomcat-embed-core-9.0.64.jar!/:na] 2022-08-18T15:47:16.720105+00:00 app[web.1]: at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:360) [tomcat-embed-core-9.0.64.jar!/:na] 2022-08-18T15:47:16.720105+00:00 app[web.1]: at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:399) [tomcat-embed-core-9.0.64.jar!/:na]
2022-08-18T15:47:16.720106+00:00 app[web.1]: at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1787) [tomcat-embed-core-9.0.64.jar!/:na] 2022-08-18T15:47:16.720106+00:00 app[web.1]: at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) [tomcat-embed-core-9.0.64.jar!/:na] 2022-08-18T15:47:16.720106+00:00 app[web.1]: at org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1191) [tomcat-embed-core-9.0.64.jar!/:na] 2022-08-18T15:47:16.720107+00:00 app[web.1]: at org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659) [tomcat-embed-core-9.0.64.jar!/:na] 2022-08-18T15:47:16.720107+00:00 app[web.1]: at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-embed-core-9.0.64.jar!/:na] 2022-08-18T15:47:16.720107+00:00 app[web.1]: at java.lang.Thread.run(Thread.java:748) [na:1.8.0_212] 2022-08-18T15:47:16.720108+00:00 app[web.1]: 2022-08-18T15:47:16.720910+00:00 app[web.1]: 2022-08-18 15:47:16.720 ERROR 3 --- [io-23045-exec-2] o.a.c.c.C.[.[.[/].[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.thymeleaf.exceptions.TemplateInputException: Error resolving template [/index], template might not exist or might not be accessible by any of the configured Template Resolvers] with root cause 2022-08-18T15:47:16.720910+00:00 app[web.1]: 2022-08-18T15:47:16.720911+00:00 app[web.1]: org.thymeleaf.exceptions.TemplateInputException: Error resolving template [/index], template might not exist or might not be accessible by any of the configured Template Resolvers 2022-08-18T15:47:16.720912+00:00 app[web.1]: at org.thymeleaf.engine.TemplateManager.resolveTemplate(TemplateManager.java:869) ~[thymeleaf-3.0.15.RELEASE.jar!/:3.0.15.RELEASE] 2022-08-18T15:47:16.720912+00:00 app[web.1]: at org.thymeleaf.engine.TemplateManager.parseAndProcess(TemplateManager.java:607) ~[thymeleaf-3.0.15.RELEASE.jar!/:3.0.15.RELEASE] 2022-08-18T15:47:16.720912+00:00 app[web.1]: at org.thymeleaf.TemplateEngine.process(TemplateEngine.java:1098) ~[thymeleaf-3.0.15.RELEASE.jar!/:3.0.15.RELEASE] 2022-08-18T15:47:16.720913+00:00 app[web.1]: at org.thymeleaf.TemplateEngine.process(TemplateEngine.java:1072) ~[thymeleaf-3.0.15.RELEASE.jar!/:3.0.15.RELEASE] 2022-08-18T15:47:16.720913+00:00 app[web.1]: at org.thymeleaf.spring5.view.ThymeleafView.renderFragment(ThymeleafView.java:366) ~[thymeleaf-spring5-3.0.15.RELEASE.jar!/:3.0.15.RELEASE] 2022-08-18T15:47:16.720913+00:00 app[web.1]: at org.thymeleaf.spring5.view.ThymeleafView.render(ThymeleafView.java:190) ~[thymeleaf-spring5-3.0.15.RELEASE.jar!/:3.0.15.RELEASE] 2022-08-18T15:47:16.720914+00:00 app[web.1]: at org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1401) ~[spring-webmvc-5.3.21.jar!/:5.3.21] 2022-08-18T15:47:16.720914+00:00 app[web.1]: at org.springframework.web.servlet.DispatcherServlet.processDispatchResult(DispatcherServlet.java:1145) ~[spring-webmvc-5.3.21.jar!/:5.3.21] 2022-08-18T15:47:16.720914+00:00 app[web.1]: at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1084) ~[spring-webmvc-5.3.21.jar!/:5.3.21] 2022-08-18T15:47:16.720914+00:00 app[web.1]: at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:963) ~[spring-webmvc-5.3.21.jar!/:5.3.21] 2022-08-18T15:47:16.720915+00:00 app[web.1]: at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006) ~[spring-webmvc-5.3.21.jar!/:5.3.21] 2022-08-18T15:47:16.720915+00:00 app[web.1]: at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:898) ~[spring-webmvc-5.3.21.jar!/:5.3.21] 2022-08-18T15:47:16.720915+00:00 app[web.1]: at javax.servlet.http.HttpServlet.service(HttpServlet.java:655) ~[tomcat-embed-core-9.0.64.jar!/:na] 2022-08-18T15:47:16.720915+00:00 app[web.1]: at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883) ~[spring-webmvc-5.3.21.jar!/:5.3.21] 2022-08-18T15:47:16.720916+00:00 app[web.1]: at javax.servlet.http.HttpServlet.service(HttpServlet.java:764) ~[tomcat-embed-core-9.0.64.jar!/:na] 2022-08-18T15:47:16.720916+00:00 app[web.1]: at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:227) ~[tomcat-embed-core-9.0.64.jar!/:na] 2022-08-18T15:47:16.720916+00:00 app[web.1]: at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.64.jar!/:na]
2022-08-18T15:47:16.720917+00:00 app[web.1]: at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53) ~[tomcat-embed-websocket-9.0.64.jar!/:na] 2022-08-18T15:47:16.720917+00:00 app[web.1]: at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.64.jar!/:na] 2022-08-18T15:47:16.720917+00:00 app[web.1]: at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.64.jar!/:na] 2022-08-18T15:47:16.720917+00:00 app[web.1]: at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100) ~[spring-web-5.3.21.jar!/:5.3.21] 2022-08-18T15:47:16.720919+00:00 app[web.1]: at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:117) ~[spring-web-5.3.21.jar!/:5.3.21] 2022-08-18T15:47:16.720920+00:00 app[web.1]: at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.64.jar!/:na] 2022-08-18T15:47:16.720920+00:00 app[web.1]: at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.64.jar!/:na] 2022-08-18T15:47:16.720920+00:00 app[web.1]: at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93) ~[spring-web-5.3.21.jar!/:5.3.21] 2022-08-18T15:47:16.720920+00:00 app[web.1]: at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:117) ~[spring-web-5.3.21.jar!/:5.3.21] 2022-08-18T15:47:16.720921+00:00 app[web.1]: at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.64.jar!/:na] 2022-08-18T15:47:16.720925+00:00 app[web.1]: at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.64.jar!/:na] 2022-08-18T15:47:16.720925+00:00 app[web.1]: at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201) ~[spring-web-5.3.21.jar!/:5.3.21] 2022-08-18T15:47:16.720926+00:00 app[web.1]: at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:117) ~[spring-web-5.3.21.jar!/:5.3.21] 2022-08-18T15:47:16.720938+00:00 app[web.1]: at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189) ~[tomcat-embed-core-9.0.64.jar!/:na]
2022-08-18T15:47:16.720938+00:00 app[web.1]: at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162) ~[tomcat-embed-core-9.0.64.jar!/:na] 2022-08-18T15:47:16.720938+00:00 app[web.1]: at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:197) ~[tomcat-embed-core-9.0.64.jar!/:na] 2022-08-18T15:47:16.720939+00:00 app[web.1]: at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:97) [tomcat-embed-core-9.0.64.jar!/:na] 2022-08-18T15:47:16.720939+00:00 app[web.1]: at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:541) [tomcat-embed-core-9.0.64.jar!/:na] 2022-08-18T15:47:16.720939+00:00 app[web.1]: at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:135) [tomcat-embed-core-9.0.64.jar!/:na] 2022-08-18T15:47:16.720940+00:00 app[web.1]: at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92) [tomcat-embed-core-9.0.64.jar!/:na] 2022-08-18T15:47:16.720940+00:00 app[web.1]: at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:78) [tomcat-embed-core-9.0.64.jar!/:na] 2022-08-18T15:47:16.720940+00:00 app[web.1]: at org.apache.catalina.valves.RemoteIpValve.invoke(RemoteIpValve.java:769) [tomcat-embed-core-9.0.64.jar!/:na] 2022-08-18T15:47:16.720941+00:00 app[web.1]: at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:360) [tomcat-embed-core-9.0.64.jar!/:na] 2022-08-18T15:47:16.720941+00:00 app[web.1]: at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:399) [tomcat-embed-core-9.0.64.jar!/:na] 2022-08-18T15:47:16.720941+00:00 app[web.1]: at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65) [tomcat-embed-core-9.0.64.jar!/:na] 2022-08-18T15:47:16.720941+00:00 app[web.1]: at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:890) [tomcat-embed-core-9.0.64.jar!/:na] 2022-08-18T15:47:16.720941+00:00 app[web.1]: at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1787) [tomcat-embed-core-9.0.64.jar!/:na] 2022-08-18T15:47:16.720942+00:00 app[web.1]: at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) [tomcat-embed-core-9.0.64.jar!/:na] 2022-08-18T15:47:16.720942+00:00 app[web.1]: at org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1191) [tomcat-embed-core-9.0.64.jar!/:na] 2022-08-18T15:47:16.720942+00:00 app[web.1]: at org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659) [tomcat-embed-core-9.0.64.jar!/:na] 2022-08-18T15:47:16.720942+00:00 app[web.1]: at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-embed-core-9.0.64.jar!/:na] 2022-08-18T15:47:16.720943+00:00 app[web.1]: at java.lang.Thread.run(Thread.java:748) [na:1.8.0_212] 2022-08-18T15:47:16.720943+00:00 app[web.1]: 2022-08-18T15:47:16.726424+00:00 heroku[router]: at=info method=GET path="/index" host=appbgb.herokuapp.com request_id=6568bab1-6691-4017-b4fd-877cef038e3a fwd="189.6.6.29" dyno=web.1 connect=0ms service=12ms status=500 bytes=445 protocol=https
Teu projeto está no teu github? me manda o link do seu repositorio do github
ok, vou dar um push para atualizar o projeto no git, mas deve estar atualizado, já te passo ele
O problema está no seu controller, nos métodos que tem o return para a página index:
return "/index";
Não pode ter essa barra inicial, pois o Spring vai buscar a página index em outro diretório.
Altera para:
return "index";
@Controller
public class IndexController {
@Autowired
private DadosJogosRepository pedidoRepository;
@Transactional
@GetMapping("/index")
public String index(Model model, Principal principal) {
PageRequest paginacao = PageRequest.of(0,7);
List<DadosJogo>dados = pedidoRepository.findAll(paginacao);
model.addAttribute("dados",dados);
return "index";
}
@Transactional
@RequestMapping("/preco")
public String preco(Model model, Principal principal) {
Sort sort = Sort.by("preco").ascending();
PageRequest paginacao = PageRequest.of(0,7,sort);
List<DadosJogo>dados = pedidoRepository.findAll(paginacao);
model.addAttribute("dados",dados);
return "index";
}
@Transactional
@RequestMapping("/notas")
public String notas(Model model, Principal principal) {
Sort sort = Sort.by("nota").descending();
PageRequest paginacao = PageRequest.of(0,7,sort);
List<DadosJogo>dados = pedidoRepository.findAll(paginacao);
model.addAttribute("dados",dados);
return "index";
}
@Transactional
@RequestMapping("/lista")
public ModelAndView pesquisar (@RequestParam("nomeDoJogo")String nomeJogo) {
ModelAndView modelAndView = new ModelAndView("index");
modelAndView.addObject("dados",pedidoRepository.findByNomeDoJogoEqualsIgnoreCase(nomeJogo));
return modelAndView;
}
}
Outra coisa, altere o seu arquivo data.sql para deixar os comandos separados e sem as crases:
INSERT INTO dados_jogo(descricao, loja, nome_do_jogo, nota, preco, url_imagem) VALUES('Incrível!!', 'Amazon', 'DixIt', 10, 279.99, 'https://images-na.ssl-images-amazon.com/images/I/71v70BVCqGL.__AC_SX300_SY300_QL70_ML2_.jpg');
INSERT INTO dados_jogo(descricao, loja, nome_do_jogo, nota, preco, url_imagem) VALUES('Muito bom com os amigos!', 'Amazon', 'Black Stories', 8, 43.87, 'https://m.media-amazon.com/images/I/61-zbcN6HmL._AC_SY879_.jpg');
INSERT INTO dados_jogo(descricao, loja, nome_do_jogo, nota, preco, url_imagem) VALUES('Muito complicado, mas aprendendo fica bom!', 'Amazon', 'Magic', 7, 229.9, 'https://m.media-amazon.com/images/I/61zEBPUEp-L._AC_SX569_.jpg');
INSERT INTO dados_jogo(descricao, loja, nome_do_jogo, nota, preco, url_imagem) VALUES('Clássico', 'Americanas', 'Dectetive', 8, 99.99, 'https://m.media-amazon.com/images/I/91deu+m93jL._AC_SX569_.jpg');
INSERT INTO dados_jogo(descricao, loja, nome_do_jogo, nota, preco, url_imagem) VALUES('Pura nostalgia!!', 'Americanas', 'Banco Imobiliario', 10, 163, 'https://http2.mlstatic.com/D_NQ_NP_815831-MLA46818901945_072021-O.webp');
INSERT INTO dados_jogo(descricao, loja, nome_do_jogo, nota, preco, url_imagem) VALUES('Bem divertido', 'Americanas', 'Banco Imobiliario Mundo', 7, 139, 'https://http2.mlstatic.com/D_NQ_NP_989487-MLB41695008984_052020-O.webp');
INSERT INTO dados_jogo(descricao, loja, nome_do_jogo, nota, preco, url_imagem) VALUES('Siniiiisxxxxxtroooo....', 'Amazon', 'Zombicide: Black Plague', 10, 799.99, 'https://m.media-amazon.com/images/I/81bBS06A9LL._AC_SX569_.jpg');
INSERT INTO dados_jogo(descricao, loja, nome_do_jogo, nota, preco, url_imagem) VALUES('Bons tempos de rpg', 'Mercado Livre', 'Hero Quest', 6, 17.71, 'https://http2.mlstatic.com/D_NQ_NP_881688-MLB45649029491_042021-O.webp');
INSERT INTO dados_jogo(descricao, loja, nome_do_jogo, nota, preco, url_imagem) VALUES('Excepcional, nunca vi um jogo assim!', 'Amazon', 'Gloomhaven', 10, 1329, 'https://m.media-amazon.com/images/I/51mmjCK-PiL._AC_.jpg');
INSERT INTO dados_jogo(descricao, loja, nome_do_jogo, nota, preco, url_imagem) VALUES('Muito fiel a série', 'Amazon', 'Guerra dos Tronos', 8, 317, 'https://m.media-amazon.com/images/I/A105putUJ4L._AC_SX569_.jpg');
INSERT INTO dados_jogo(descricao, loja, nome_do_jogo, nota, preco, url_imagem) VALUES('Mais um clássico dos anos 80!', 'RiHappy', 'WAR', 7, 209.9, 'https://a-static.mlcdn.com.br/800x600/title-reference/magazineluiza/220544300/a1fde1e72b47f486c040667c5ce7183a.jpg');
arrumei isso e nada de aparecer os dados
vou ver se mudando o data resolva
Eu baixei o seu projeto e estava dando erro ao entrar na tela de lista de jogos e também ao tentar cadastrar um novo jogo.
Depois que fiz essas alterações que mencionei tudo funcionou certinho.
2022-08-18T16:38:18.145576+00:00 app[web.1]: 2022-08-18 16:38:18.145 INFO 3 --- [ main] o.s.b.a.w.s.WelcomePageHandlerMapping : Adding welcome page template: index 2022-08-18T16:38:20.271200+00:00 app[web.1]: 2022-08-18 16:38:20.270 INFO 3 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 24868 (http) with context path '' 2022-08-18T16:38:20.291500+00:00 app[web.1]: 2022-08-18 16:38:20.291 INFO 3 --- [ main] b.c.p.b.b.BoardgamesbuscaApplication : Started BoardgamesbuscaApplication in 25.22 seconds (JVM running for 26.059) 2022-08-18T16:38:20.697698+00:00 heroku[web.1]: State changed from starting to up 2022-08-18T16:38:22.989135+00:00 app[web.1]: 2022-08-18 16:38:22.988 INFO 3 --- [io-24868-exec-3] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring DispatcherServlet 'dispatcherServlet' 2022-08-18T16:38:22.989353+00:00 app[web.1]: 2022-08-18 16:38:22.989 INFO 3 --- [io-24868-exec-3] o.s.web.servlet.DispatcherServlet : Initializing Servlet 'dispatcherServlet' 2022-08-18T16:38:22.991230+00:00 app[web.1]: 2022-08-18 16:38:22.991 INFO 3 --- [io-24868-exec-3] o.s.web.servlet.DispatcherServlet : Completed initialization in 2 ms 2022-08-18T16:38:24.700881+00:00 heroku[router]: at=info method=GET path="/" host=appbgp2.herokuapp.com request_id=fe2c528a-9350-4fa1-969e-3257d762ced0 fwd="179.212.209.241" dyno=web.1 connect=0ms service=1752ms status=200 bytes=1739 protocol=https 2022-08-18T16:38:25.543345+00:00 heroku[router]: at=info method=GET path="/favicon.ico" host=appbgp2.herokuapp.com request_id=c07b22b6-445f-4630-8e31-05b854d2688f fwd="179.212.209.241" dyno=web.1 connect=0ms service=204ms status=404 bytes=333 protocol=https 2022-08-18T16:43:32.517971+00:00 heroku[router]: at=info method=GET path="/" host=appbgp2.herokuapp.com request_id=9827b8e4-d84f-48a7-a381-efa42ddf9a05 fwd="179.212.209.241" dyno=web.1 connect=0ms service=6ms status=200 bytes=1739 protocol=https
tem razão, não tava testando com index, pqp muito obrigado!!!! vc foi demais!!!! valeu!!
então era aquele return com / meu Deus!!!!
Obrigado!!!!