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