深拥浅沫 2021-11-16 17:18 采纳率: 100%
浏览 172
已结题

请教一个JavaWeb的bug , 关于IDEA启动Tomcat之后控制台一直刷新似地报异常 , 异常是关于ScalarHandler

IDEA启动Tomcat之后控制台会一直刷新异常 , 重复的异常是关于德鲁伊连接池的

关于我的异常定位到了这

img

这是控制台的一些异常

img

上面这个异常是启动以后不断刷新的那个异常

这是控制台异常的相关代码

16-Nov-2021 17:03:55.567 严重 [Druid-ConnectionPool-Create-437678869] com.alibaba.druid.support.logging.JakartaCommonsLoggingImpl.error create connection SQLException, url: jdbc:mysql://localhost:3306/book_store?useSSL=false&serverTimezone=GMT, errorCode 0, state 08001
 java.sql.SQLNonTransientConnectionException: Public Key Retrieval is not allowed
    at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:110)
    at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:122)
    at com.mysql.cj.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:833)
    at com.mysql.cj.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:453)
    at com.mysql.cj.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:246)
    at com.mysql.cj.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:198)
    at com.alibaba.druid.pool.DruidAbstractDataSource.createPhysicalConnection(DruidAbstractDataSource.java:1657)
    at com.alibaba.druid.pool.DruidAbstractDataSource.createPhysicalConnection(DruidAbstractDataSource.java:1723)
    at com.alibaba.druid.pool.DruidDataSource$CreateConnectionThread.run(DruidDataSource.java:2838)
Caused by: com.mysql.cj.exceptions.UnableToConnectException: Public Key Retrieval is not allowed
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
    at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:61)
    at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:85)
    at com.mysql.cj.protocol.a.authentication.CachingSha2PasswordPlugin.nextAuthenticationStep(CachingSha2PasswordPlugin.java:128)
    at com.mysql.cj.protocol.a.authentication.CachingSha2PasswordPlugin.nextAuthenticationStep(CachingSha2PasswordPlugin.java:49)
    at com.mysql.cj.protocol.a.NativeAuthenticationProvider.proceedHandshakeWithPluggableAuthentication(NativeAuthenticationProvider.java:432)
    at com.mysql.cj.protocol.a.NativeAuthenticationProvider.connect(NativeAuthenticationProvider.java:210)
    at com.mysql.cj.protocol.a.NativeProtocol.connect(NativeProtocol.java:1353)
    at com.mysql.cj.NativeSession.connect(NativeSession.java:157)
    at com.mysql.cj.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:953)
    at com.mysql.cj.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:823)
    ... 6 more


上面这个在启动时是不断刷新的 , 所以我只粘一份


16-Nov-2021 17:04:00.486 信息 [localhost-startStop-1] org.apache.catalina.core.StandardWrapper.unload Waiting for 1 instance(s) to be deallocated for Servlet [ClientBookServlet]
16-Nov-2021 17:04:00.599 警告 [localhost-startStop-1] org.apache.catalina.loader.WebappClassLoaderBase.clearReferencesJdbc The web application [BookStore] registered the JDBC driver [com.alibaba.druid.proxy.DruidDriver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered.
16-Nov-2021 17:04:00.600 警告 [localhost-startStop-1] org.apache.catalina.loader.WebappClassLoaderBase.clearReferencesThreads The web application [BookStore] is still processing a request that has yet to finish. This is very likely to create a memory leak. You can control the time allowed for requests to finish by using the unloadDelay attribute of the standard Context implementation. Stack trace of request processing thread:
 sun.misc.Unsafe.park(Native Method)
 java.util.concurrent.locks.LockSupport.park(LockSupport.java:175)
 java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2039)
 com.alibaba.druid.pool.DruidDataSource.takeLast(DruidDataSource.java:2218)
 com.alibaba.druid.pool.DruidDataSource.getConnectionInternal(DruidDataSource.java:1690)
 com.alibaba.druid.pool.DruidDataSource.getConnectionDirect(DruidDataSource.java:1427)
 com.alibaba.druid.pool.DruidDataSource.getConnection(DruidDataSource.java:1407)
 com.alibaba.druid.pool.DruidDataSource.getConnection(DruidDataSource.java:1397)
 com.athome.utils.JdbcUtils.getConnection(JdbcUtils.java:51)
 com.athome.dao.impl.BaseDao.queryForSingleValue(BaseDao.java:92)
 com.athome.dao.impl.BookDAOImpl.queryForPageTotalCount(BookDAOImpl.java:56)
 com.athome.service.impl.BookServiceImpl.page(BookServiceImpl.java:53)
 com.athome.web.ClientBookServlet.page(ClientBookServlet.java:28)
 sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
 sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
 java.lang.reflect.Method.invoke(Method.java:498)
 com.athome.web.BaseServlet.doPost(BaseServlet.java:37)
 com.athome.web.BaseServlet.doGet(BaseServlet.java:24)
 javax.servlet.http.HttpServlet.service(HttpServlet.java:622)
 javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
 org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:292)
 org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
 org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
 org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
 org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
 org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:716)
 org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:466)
 org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:391)
 org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:318)
 org.apache.jasper.runtime.PageContextImpl.doForward(PageContextImpl.java:742)
 org.apache.jasper.runtime.PageContextImpl.forward(PageContextImpl.java:712)
 org.apache.jsp.index_jsp._jspService(index_jsp.java:116)
 org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
 javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
 org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:438)
 org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:396)
 org.apache.jasper.servlet.JspServlet.service(JspServlet.java:340)
 javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
 org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:292)
 org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
 org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
 org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
 org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
 org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:212)
 org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:94)
 org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141)
 org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
 org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:620)
 org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
 org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:502)
 org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1132)
 org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:684)
 org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.doRun(AprEndpoint.java:2527)
 org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:2516)
 java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
 java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
 org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
 java.lang.Thread.run(Thread.java:748)
16-Nov-2021 17:04:00.600 警告 [localhost-startStop-1] org.apache.catalina.loader.WebappClassLoaderBase.clearReferencesThreads The web application [BookStore] appears to have started a thread named [Druid-ConnectionPool-Create-437678869] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread:
 java.lang.Thread.sleep(Native Method)
 com.alibaba.druid.pool.DruidDataSource$CreateConnectionThread.run(DruidDataSource.java:2861)
16-Nov-2021 17:04:00.601 警告 [localhost-startStop-1] org.apache.catalina.loader.WebappClassLoaderBase.clearReferencesThreads The web application [BookStore] appears to have started a thread named [Druid-ConnectionPool-Destroy-437678869] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread:
 java.lang.Thread.sleep(Native Method)
 com.alibaba.druid.pool.DruidDataSource$DestroyConnectionThread.run(DruidDataSource.java:2913)
16-Nov-2021 17:04:00.603 信息 [main] org.apache.coyote.AbstractProtocol.stop Stopping ProtocolHandler ["http-apr-8080"]
java.sql.SQLException
    at com.alibaba.druid.pool.DruidDataSource.getConnectionInternal(DruidDataSource.java:1707)
    at com.alibaba.druid.pool.DruidDataSource.getConnectionDirect(DruidDataSource.java:1427)
    at com.alibaba.druid.pool.DruidDataSource.getConnection(DruidDataSource.java:1407)
    at com.alibaba.druid.pool.DruidDataSource.getConnection(DruidDataSource.java:1397)
    at com.athome.utils.JdbcUtils.getConnection(JdbcUtils.java:51)
    at com.athome.dao.impl.BaseDao.queryForSingleValue(BaseDao.java:92)
    at com.athome.dao.impl.BookDAOImpl.queryForPageTotalCount(BookDAOImpl.java:56)
    at com.athome.service.impl.BookServiceImpl.page(BookServiceImpl.java:53)
    at com.athome.web.ClientBookServlet.page(ClientBookServlet.java:28)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at com.athome.web.BaseServlet.doPost(BaseServlet.java:37)
    at com.athome.web.BaseServlet.doGet(BaseServlet.java:24)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:622)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:292)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
    at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
    at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:716)
    at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:466)
    at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:391)
    at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:318)
    at org.apache.jasper.runtime.PageContextImpl.doForward(PageContextImpl.java:742)
    at org.apache.jasper.runtime.PageContextImpl.forward(PageContextImpl.java:712)
    at org.apache.jsp.index_jsp._jspService(index_jsp.java:116)
    at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:438)
    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:396)
    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:340)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:292)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
    at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    
    at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:2516)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
    at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.InterruptedException
    at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.reportInterruptAfterWait(AbstractQueuedSynchronizer.java:2014)
    at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2048)

java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at com.athome.web.BaseServlet.doPost(BaseServlet.java:37)
    at com.athome.web.BaseServlet.doGet(BaseServlet.java:24)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:622)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
    at org.apache.jsp.index_jsp._jspService(index_jsp.java:116)
    at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:438)
    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:396)
    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:340)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:292)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
    at java.lang.Thread.run(Thread.java:748)
        ......
Caused by: java.lang.NoClassDefFoundError: org/apache/commons/dbutils/handlers/ScalarHandler
    at com.athome.dao.impl.BaseDao.queryForSingleValue(BaseDao.java:95)
    at com.athome.dao.impl.BookDAOImpl.queryForPageTotalCount(BookDAOImpl.java:56)
    at com.athome.service.impl.BookServiceImpl.page(BookServiceImpl.java:53)
    at com.athome.web.ClientBookServlet.page(ClientBookServlet.java:28)
    ... 46 more
Caused by: java.lang.ClassNotFoundException: Illegal access: this web application instance has been stopped already. Could not load [org.apache.commons.dbutils.handlers.ScalarHandler]. The following stack trace is thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access.
    at org.apache.catalina.loader.WebappClassLoaderBase.checkStateForClassLoading(WebappClassLoaderBase.java:1345)
    at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1202)
    at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1163)
    ... 50 more
Caused by: java.lang.IllegalStateException: Illegal access: this web application instance has been stopped already. Could not load [org.apache.commons.dbutils.handlers.ScalarHandler]. The following stack trace is thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access.
    at org.apache.catalina.loader.WebappClassLoaderBase.checkStateForResourceLoading(WebappClassLoaderBase.java:1355)
    at org.apache.catalina.loader.WebappClassLoaderBase.checkStateForClassLoading(WebappClassLoaderBase.java:1343)
    ... 52 more
16-Nov-2021 17:04:00.674 信息 [main] org.apache.coyote.AbstractProtocol.stop Stopping ProtocolHandler ["ajp-apr-8009"]
16-Nov-2021 17:04:00.739 信息 [main] org.apache.coyote.AbstractProtocol.destroy Destroying ProtocolHandler ["http-apr-8080"]
16-Nov-2021 17:04:00.739 信息 [main] org.apache.coyote.AbstractProtocol.destroy Destroying ProtocolHandler ["ajp-apr-8009"]
Disconnected from server

操作环境是:jdk8 Tomcat8 IDEA2021.2 win10 20H1

  • 写回答

2条回答 默认 最新

  • 酷爱码 2021-11-16 17:28
    关注

    这个谈不上什么异常,你没有设置时区而已,在你的数据库url后加上?useUnicode=true&characterEncoding=utf8&serverTimezone=Asia/Shanghai即可
    例如
    jdbc:mysql://localhost:3306/aa?useUnicode=true&characterEncoding=utf8&serverTimezone=Asia/Shanghai

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

问题事件

  • 系统已结题 4月13日
  • 已采纳回答 4月5日
  • 修改了问题 11月16日
  • 创建了问题 11月16日

悬赏问题

  • ¥15 docker实践项目
  • ¥15 数电几道习题,写出作答过程,ai一律不采用
  • ¥15 利用pthon计算薄膜结构的光导纳
  • ¥15 海康hlss视频流怎么播放
  • ¥15 Paddleocr:out of memory error on GPU
  • ¥30 51单片机C语言数码管驱动单片机为AT89C52
  • ¥100 只改动本课件的 cal_portfolio_weight_series(decision_date), 跑完本课件。设计一个信息比率尽量高的策略。
  • ¥20 如何在visual studio 2022中添加ImageMagick库
  • ¥50 如何实现uniapp编译的微信小程序做可回溯视频
  • ¥15 求Houdini使用行家,付费。价格面议。