Java 使用带有属性config的JDBC连接抛出outofmemoryerror
属性文件请确认applicationContext.xml文件中是否正确提到占位符Java 使用带有属性config的JDBC连接抛出outofmemoryerror,java,xml,spring,model-view-controller,ibatis,Java,Xml,Spring,Model View Controller,Ibatis,属性文件请确认applicationContext.xml文件中是否正确提到占位符 mysql.database=MYSQL mysql.driverClassName=com.mysql.jdbc.Driver mysql.url=jdbc:mysql://xxx.xx.xxx.xxx:3306/vod?autoReconnect=true mysql.username=voddb mysql.password=vod@123 mysql.initialSize=4 mysql.maxA
mysql.database=MYSQL
mysql.driverClassName=com.mysql.jdbc.Driver
mysql.url=jdbc:mysql://xxx.xx.xxx.xxx:3306/vod?autoReconnect=true
mysql.username=voddb
mysql.password=vod@123
mysql.initialSize=4
mysql.maxActive=30
如果配置正确,请尝试从属性文件和测试中删除mysql.initialSize=4 mysql.maxActive=30,这可能是根本原因。因为这是您在属性文件中提到的附加属性
您可以尝试在xml本身中将这些maxActive、initialSize值配置为属性
<context:property-placeholder location="classpath*:catalina.properties" ignore-unresolvable="true"/>
线程“http-bio-8081”-exec-3”中的异常这是在执行10到15个查询后打印的。您需要添加一些连接池。您还可以添加属性文件吗?发布日志。我觉得很好,只要您配置了占位符和其他必要的东西,这不是异常的原因。看看别的地方。
mysql.database=MYSQL
mysql.driverClassName=com.mysql.jdbc.Driver
mysql.url=jdbc:mysql://xxx.xx.xxx.xxx:3306/vod?autoReconnect=true
mysql.username=voddb
mysql.password=vod@123
mysql.initialSize=4
mysql.maxActive=30
<context:property-placeholder location="classpath*:catalina.properties" ignore-unresolvable="true"/>
<property name="removeAbandonedTimeout" value="180"/>
<property name="removeAbandoned" value="true"/>
<property name="logAbandoned" value="true"/>
<property name="timeBetweenEvictionRunsMillis" value="5000"/>
<property name="minEvictableIdleTimeMillis" value="900000"/>
<property name="maxActive" value="20"/>
<property name="maxIdle" value="4"/>