开发者社区> 问答> 正文

开发了一个图书商城,可是运行时报这个错?报错

严重: Servlet.service() for servlet [CategoryServlet] in context with path [/goods] threw exception
java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
    at cn.itcast.servlet.BaseServlet.service(BaseServlet.java:60)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
    at cn.itcast.filter.EncodingFilter.doFilter(EncodingFilter.java:30)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:505)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:956)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:423)
    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1079)
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:625)
    at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:316)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
    at java.lang.Thread.run(Thread.java:619)
Caused by: java.lang.reflect.InvocationTargetException
    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 cn.itcast.servlet.BaseServlet.service(BaseServlet.java:44)
    ... 21 more
Caused by: java.lang.RuntimeException: java.sql.SQLException: Connections could not be acquired from the underlying database!
    at cn.itcast.goods.category.service.CategoryService.findAll(CategoryService.java:89)
    at cn.itcast.goods.category.web.servlet.CategoryServlet.findAll(CategoryServlet.java:31)
    ... 26 more
Caused by: java.sql.SQLException: Connections could not be acquired from the underlying database!
    at com.mchange.v2.sql.SqlUtils.toSQLException(SqlUtils.java:106)
    at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool.checkoutPooledConnection(C3P0PooledConnectionPool.java:615)
    at com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource.getConnection(AbstractPoolBackedDataSource.java:128)
    at cn.itcast.jdbc.JdbcUtils.getConnection(JdbcUtils.java:43)
    at cn.itcast.jdbc.TxQueryRunner.query(TxQueryRunner.java:30)
    at cn.itcast.goods.category.dao.CategoryDao.findAll(CategoryDao.java:69)
    at cn.itcast.goods.category.service.CategoryService.findAll(CategoryService.java:87)
    ... 27 more
Caused by: com.mchange.v2.resourcepool.CannotAcquireResourceException: A ResourcePool could not acquire a resource from its primary factory or source.
    at com.mchange.v2.resourcepool.BasicResourcePool.awaitAvailable(BasicResourcePool.java:1406)
    at com.mchange.v2.resourcepool.BasicResourcePool.prelimCheckoutResource(BasicResourcePool.java:594)
    at com.mchange.v2.resourcepool.BasicResourcePool.checkoutResource(BasicResourcePool.java:514)
    at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool.checkoutAndMarkConnectionInUse(C3P0PooledConnectionPool.java:681)
    at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool.checkoutPooledConnection(C3P0PooledConnectionPool.java:608)
    ... 32 more
运行后报错的500,也不知道哪里有问题

展开
收起
爱吃鱼的程序员 2020-06-07 16:47:23 511 0
1 条回答
写回答
取消 提交回答
  • https://developer.aliyun.com/profile/5yerqm5bn5yqg?spm=a2c6h.12873639.0.0.6eae304abcjaIB
                        可能是网络,防火墙问题。 
                    
    
                        <p>从错误堆栈里看到的问题是 数据库连接除了问题,检查一下数据库连接的参数;查看一下数据库的连接数</p>
    
                    
    
                        <p>这年头还有人用JAVA开发图书商城 , PHP7难道满足不了你 ?!~</p>
    
                    
    
                        <p>换下druid试试</p>
    

     

                        <p>果断放弃。</p>
    
    2020-06-07 16:47:34
    赞同 展开评论 打赏
问答地址:
问答排行榜
最热
最新

相关电子书

更多
支付宝小程序教程 立即下载
QQ移送页面框架优化实践 立即下载
QQ移动页面框架优化实践 立即下载