docker mysql同一端口_是否可以在docker mysql運行容器以及windows 10 mysql中使用3306端口(相同端口)...

I deploy my war file in tomcat 7 successfully and start tomcat using following command

我成功地在tomcat 7中部署war文件,並使用以下命令啟動tomcat

docker run -it --rm -p 7008:8080 -v //d/docker_tomcat/tomcat-users.xml:/usr/local/tomcat/conf/tomcat-users.xml:ro -v //d/docker_tomcat/webapps:/usr/local/tomcat/webapps:rw tomcat:7.0

when tomcat start it shows following error logs:-

AbandonedObjectPool is used (org.apache.commons.dbcp.AbandonedObjectPool@9030ca2)

LogAbandoned: true

RemoveAbandoned: true

RemoveAbandonedTimeout: 90

[localhost-startStop-1] ERROR org.hibernate.util.JDBCExceptionReporter - Cannot create PoolableConnectionFactory

當tomcat啟動時,它顯示以下錯誤日志: - 使用AbandonedObjectPool(org.apache.commons.dbcp.AbandonedObjectPool@9030ca2)LogAbandoned:true RemoveAbandoned:true RemoveAbandonedTimeout:90 [localhost-startStop-1] ERROR org.hibernate.util.JDBCExceptionReporter - 無法創建PoolableConnectionFactory

i think that above error means that database studentdb is not accessible

我認為上述錯誤意味着數據庫studentdb無法訪問

here is my hibernate.properties file:-

這是我的hibernate.properties文件: -

hibernate.dialect=org.hibernate.dialect.MySQLDialect

hibernate.connection.driver_class=com.mysql.jdbc.Driver

hibernate.connection.username=root

hibernate.connection.password=root

hibernate.connection.url=jdbc:mysql://10.0.75.x:3306/studentdb?autoreconnect=true&zeroDateTimeBehavior=convertToNull&jdbcCompliantTruncation=false

show_sql=false

hibernate.jdbc.use_streams_for_binary=false

hibernate.dbcp.testOnBorrow=true

hibernate.dbcp.validationQuery=SELECT 1 FROM DUAL

hibernate.dbcp.testOnReturn=false

hibernate.dbcp.maxWait=2000

hibernate.dbcp.testWhileIdle=true

hibernate.dbcp.minEvictableIdleTimeMillis=1800000

hibernate.dbcp.timeBetweenEvictionRunsMillis=300000

hibernate.dbcp.numTestsPerEvictionRun=5

hibernate.dbcp.removeAbandoned=true

hibernate.dbcp.removeAbandonedTimeout=90

hibernate.dbcp.logAbandoned=true

i think there may be error in hibernate.connection.url property of hibernate.properties file.

我認為hibernate.properties文件的hibernate.connection.url屬性可能存在錯誤。

and also doubt is it becuase my windows 10 uses port 3306 for mysql as well as docker also uses port 3306 for mysql. if is it problem then how can i change port of mysql container running in docker with some different port

並且還懷疑是因為我的Windows 10使用端口3306用於mysql以及docker也使用端口3306用於mysql。如果是問題那么我怎么能改變在docker中運行的mysql容器的端口與一些不同的端口

1 个解决方案

#1

1

Use following command to forward your local port to docker container port

使用以下命令將本地端口轉發到docker容器端口

docker run -p :3306

docker run -p

:3306

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值