使用MySQL与Spring启动泊坞窗图像
我有这个问题,我不能真正find解决scheme。
我在digitalocean上有1GB的液滴(Ubuntu),我使用这个页面安装了mysql。 我loginmysql控制台,导入我的数据库,创build一个具有所需权限的新用户。 这一切都很好,直到这一点。
我用Docker集线器从Docker集线器中取出了Docker镜像:
docker run --rm -p 80:80 my-username/image-name
它第一次下载,并开始我的春季启动应用程序,但我得到这个例外,每次我尝试运行我的形象。
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
我的application.yaml文件看起来像这样:
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服务器已启动并正在运行。 我在这里错过了什么?
编辑:
我编辑了application.yaml文件
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: generate-ddl: true database: mysql
我能够启动应用程序。 但是,当我尝试打开页面 :我得到404
错误。
There was an unexpected error (type=Not Found, status=404). /WEB-INF/jsp/index.jsp
这似乎像你的docker图像无法连接到您的MySQL服务器…
要解决这个问题,你可以尝试以下…
1)检查你是否正确configuration了mysql!
2)基于Linux的操作系统中的Mysql需要configuration来自不同远程IP地址或位置的login权限…(由于docker是在您的环境中自行托pipe的,请尝试编辑用于访问您的用户的mysql服务器的IP地址)。
3)检查每个mysql用户是否可以从远程访问该用户。 如果不再configuration它。
4)检查您的MySQL端口上的防火墙。
PS:我使用mysql工作台来远程访问mysql,因此可以给予我为不同的操作和查询创build的其他用户的特殊权限。
- 我如何运行Hetionet v1.0docker集装箱?
- 如何在数字海洋液滴上configuration浮动IP地址的docker?
- Docker云Ubuntu节点的默认凭据是什么?
- Docker / Dokku镜像支持SBT 0.13.5吗?
- 服务器设置:用于API的子域或不同端口以及用于docker,nginx,web和api设置的单个或多个ssl证书?
- Docker Swarm容器可到达虽然端口没有打开?
- docker-machine使用digitalocean驱动程序和Ubuntu 16.04 x64创build失败
- 运行在runner- … -concurrent-0通过…亚军长时间永远不会结束
- 部署meteor数字海洋Ubuntu – 没有这样的容器错误