java程序执行一条sql语句的时候就报JDBC连接错误 启动tomcat 的时候不报错 请问有可能是哪里出问题了谢谢
[http-8080-1][2014-03-0711:07:21.449][INFO]-com.bjltwg.dao.impl.GetUserMenuOptionTree...
[http-8080-1] [2014-03-07 11:07:21.449] [INFO] - com.bjltwg.dao.impl.GetUserMenuOptionTreeDao.fetchDemoData(GetUserMenuOptionTreeDao.java:29) - 执行GetUserMenuOptionTreeDao...
[http-8080-1] [2014-03-07 11:07:21.449] [INFO] - com.bjltwg.dao.impl.GetUserMenuOptionTreeDao.fetchDemoData(GetUserMenuOptionTreeDao.java:32) - select * from TJ_STATITREE
org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (validationQuery didn't return a row)
at org.springframework.jdbc.datasource.DataSourceUtils.getConnection(DataSourceUtils.java:82)
at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:382)
at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:458)
at mt.framework.core.dialect.impl.AIAble.doOpenRowSet(AIAble.java:424)
at mt.framework.core.dialect.impl.AIAble.openRowSet(AIAble.java:301)
at com.bjltwg.dao.impl.GetUserMenuOptionTreeDao.fetchDemoData(GetUserMenuOptionTreeDao.java:32)
at com.bjltwg.busi.impl.GetUserMenuOptionTreeDemo.run(GetUserMenuOptionTreeDemo.java:28)
at mt.framework.core.work.impl.XWorker.doTask(XWorker.java:33)
at mt.framework.core.work.Executor.doTask(Executor.java:36)
at mt.framework.core.dialect.impl.AIAble.run(AIAble.java:407)
at com.bjltwg.action.XAction.doAllWork(XAction.java:91)
at com.bjltwg.action.impl.GetUserMenuOptionTreeAction.demo(GetUserMenuOptionTreeAction.java:25)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:452)
at com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:291)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:254)
at com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:176)
at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) 展开
[http-8080-1] [2014-03-07 11:07:21.449] [INFO] - com.bjltwg.dao.impl.GetUserMenuOptionTreeDao.fetchDemoData(GetUserMenuOptionTreeDao.java:32) - select * from TJ_STATITREE
org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (validationQuery didn't return a row)
at org.springframework.jdbc.datasource.DataSourceUtils.getConnection(DataSourceUtils.java:82)
at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:382)
at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:458)
at mt.framework.core.dialect.impl.AIAble.doOpenRowSet(AIAble.java:424)
at mt.framework.core.dialect.impl.AIAble.openRowSet(AIAble.java:301)
at com.bjltwg.dao.impl.GetUserMenuOptionTreeDao.fetchDemoData(GetUserMenuOptionTreeDao.java:32)
at com.bjltwg.busi.impl.GetUserMenuOptionTreeDemo.run(GetUserMenuOptionTreeDemo.java:28)
at mt.framework.core.work.impl.XWorker.doTask(XWorker.java:33)
at mt.framework.core.work.Executor.doTask(Executor.java:36)
at mt.framework.core.dialect.impl.AIAble.run(AIAble.java:407)
at com.bjltwg.action.XAction.doAllWork(XAction.java:91)
at com.bjltwg.action.impl.GetUserMenuOptionTreeAction.demo(GetUserMenuOptionTreeAction.java:25)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:452)
at com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:291)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:254)
at com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:176)
at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) 展开
展开全部
连接池不能初始化错误
检查你的数据库连接是否正常
检查 你项目的数据库连接是否正常
检查连接参数是否正确
检查你的数据库连接是否正常
检查 你项目的数据库连接是否正常
检查连接参数是否正确
更多追问追答
追问
该检查的位置都已经检查了 没发现什么问题
追答
错误的信息 : 不能创建数据库连接池
validationQuery didn't return a row 检查语句没有返回任何一条记录
获取连接失败
这种错误 我以前也遇到过,启动tomcat没有一点错误信息,因为这个时候 tomcat 或者你的应用没有启动连接池
但是当你调用连接的时候,他才会去,这个时候也就报错了
当初我处理的办法就是把连接检查了一遍 发现我的数据库配置文件里面写错了
所以你的问题解决办法,应该也是同样的
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询