启动tomcat服务器JDBC报错

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了启动tomcat服务器JDBC报错相关的知识,希望对你有一定的参考价值。

- Setting the server's publish address to be /query
- Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'securityMetadataSource': Invocation of init method failed; nested exception is org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.exceptions.PersistenceException:
### Error querying database. Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is java.sql.SQLException: An attempt by a client to checkout a Connection has timed out.
### The error may exist in file [D:\work\p1011\WebRoot\WEB-INF\classes\com\shadow\mvc\main\dao\mybatis\mapper\res.xml]
### The error may involve com.shadow.mvc.main.dao.mybatis.ResDao.queryForAll
### The error occurred while executing a query
### Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is java.sql.SQLException: An attempt by a client to checkout a Connection has timed out.
at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:135)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:394)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1448)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:294)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225)
at

参考技术A jdbc和连接池对于你这个场景来说,都足够,既然用spring管理了,建议还是使用连接池,另外,spring自身没有实现连接池,一般都是对第三方连接池的包装,常见的有C3P0,dbcp以及最近比较流行的boneCP等,这几个配置都差不多太多,以boneCP为例:
<bean id="dataSource" class="com.jolbox.bonecp.BoneCPDataSource"
destroy-method="close">
<property name="driverClass" value="$jdbc.driverClass" />
<property name="jdbcUrl" value="$jdbc.url" />
<property name="username" value="$jdbc.user" />
<property name="password" value="$jdbc.password" />
<property name="idleConnectionTestPeriod" value="60" />
<property name="idleMaxAge" value="240" />
<property name="maxConnectionsPerPartition" value="30" />
<property name="minConnectionsPerPartition" value="10" />
<property name="partitionCount" value="2" />
<property name="acquireIncrement" value="5" />
<property name="statementsCacheSize" value="100" />
<property name="releaseHelperThreads" value="3" />
</bean>
<bean id="jdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate">
<property name="dataSource" ref="dataSource" />
</bean>追问

现在用的就是C3P0报的这个错

本回答被提问者和网友采纳
参考技术B 实体类的名称问题,得仔细找了

以上是关于启动tomcat服务器JDBC报错的主要内容,如果未能解决你的问题,请参考以下文章

java服务tomcat启动报错

用sc create 创建的Tomcat服务不能启动 报错:1053

启动Tomcat服务器报错

启动Tomcat服务器报错

tomcat启动后报错Bad version number in .class file (unable to load class oracle.jdbc.OracleDriver)

tomcat启动报错!