Olá pessoal.
Após a instalação do Java, Tomcat e MySQL e configuração do usuário root no Ubuntu consigo conectar corretamente:
mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.7.28-0ubuntu0.18.04.4 (Ubuntu)
Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql>
Após configurado o /usr/share/tomcat8/bin/setenv.sh
quando tento acesar a aplicação recebo o 404 mas ao contrário da grande maioria dos colegar o meu erro é:
The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
... 65 more
28-Dec-2019 05:24:05.285 SEVERE [localhost-startStop-2] org.apache.catalina.core.StandardContext.listenerStart 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)
Não consegui entender se o erro é de conexão ou falta rodar algum script de migração de base de dados. Se for conexão, não tem explicação eu conectar via terminal mas não com dados da envvar.
Para contextualizar, essa config é referente a Aula 2 do curso: Amazon EC2: Faça um deploy da sua webapp com alta disponibilidade e escalabilidade.