Good evening everyone, let me start by saying that I am not a Docker expert. So far I have created Docker images independent of the database and all API resources and, if someone helps me, I will take this opportunity to learn something new. I’m trying to build a container composed of a sql container and a web container. I can do it without problems but, once I access the url I get: Failed to load resource: the server responded with a status of 404 () to the api: midoripol/beats . I think it’s a network-related problem, could it be? If so, what should I do? I’m also a bit confused about the role of my persistence.xml and web.xml files. In the persistence I have some red lines, specifically:
<provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
<class>com.midoriPol.model.Person</class>
<class>com.midoriPol.model.Product</class>
<class>com.midoriPol.model.Cart</class>
and here:
<property name="javax.persistence.jdbc.driver" value="com.mysql.cj.jdbc.Driver"/>
which makes me think there are configuration issues related to Jpa-Hibernate.
This is my docker-compose:
version: “3”
services:
db:
image: mysql:latest
environment:
MYSQL_ROOT_PASSWORD: edam15!k2Mp_
MYSQL_DATABASE: newdb
MYSQL_PASSWORD: edam15!k2Mp_
ports:
- “3307:3306”
volumes: - ./db:/docker-entrypoint-initdb.d
networks: - mynetwork
web:
image: tomcat:latest
environment:
JDBC_URL: jdbc:mysql://db:3306/newdb?connectTimeout=0&socketTimeout=0&autoReconnect=true
JDBC_USER: root
JDBC_PASS: edam15!k2Mp_
ports:
- “8080:8080”
volumes: - ./tomcat/webapps:/usr/local/tomcat/webapps
networks: - mynetwork
networks:
mynetwork:
drivers: bridge
However, I have put a public repository: GitHub - Luca-Liseros-Ferrari/dockerComposeBeats: dockerComposeBeats
Any help is truly appreciated and I am willing to provide details, in case they are requested.