Heim > Fragen und Antworten > Hauptteil
项目是(spring+mybatis+oracle)
docker是安装在虚拟机下面的,jdbc连接的数据库是安装另外一台linux的物理机上面,本机测试能通过,但是到虚拟机里的docker环境下就报这个错误,是什么原因?
报错信息如下:
Error querying database. Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (ORA-00604: 递归 SQL 级别 1 出现错误
ORA-01882: 未找到时区
)
Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (The Network Adapter could not establish the connection)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:334)
習慣沉默2017-04-26 09:04:21
Docker容器如果需要链接其他主机的话,运行时需要使用"--net=host"选项,表示容器与主机共享网络。
sudo docker run --net=host