By yonetmen
I have this problem that I can’t really find a solution. It can be a silly question for most of you but I hope someone offers a little help to this newbie :)
I have 1GB droplet and I installed mysql using this page. I logged in mysql console, imported my database, created a new user with required permissions. Its all good until this point.
I have pulled my docker image from docker hub with this line:
docker run --rm -p 80:80 my-username/image-name
It downloaded for the first time and started my Spring boot application but I got this exception every time I try to run my image.
com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
....
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaAutoConfiguration.class]: Invocation of init method failed; nested exception is org.hibernate.HibernateException: Access to DialectResolutionInfo cannot be null when 'hibernate.dialect' not set
my application.yaml file looks like this:
spring:
mvc:
view:
prefix: /WEB-INF/jsp/
suffix: .jsp
datasource:
url: jdbc:mysql://localhost:3306/db-name
username: my-username
password: secret-pwd
driver-class-name: com.mysql.jdbc.Driver
jpa:
hibernate:
dialect: org.hibernate.dialect.MySQLInnoDBDialect
generate-ddl: true
MySQL server is up and running. What am I missing here?
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
This comment has been deleted
Issue docker ps to see the name of the running mysql container, it’s the last column of this output. I will assume soberb_mysql (I presume you’re running mysql in a container).
Then when you run the main container with your application, use --link=soberb_mysql parameter (the name of the mysql container), or --link=[HEXADECIMAL ID OF CONTAINER]:
docker run --rm -p 80:80 --link=soberb_mysql my-username/image-name
https://docs.docker.com/engine/userguide/networking/default_network/container-communication/
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.