Hibernate(十九): 异常"Session was already closed"

本文通过一个具体的Hibernate实验案例,详细解析了Session被提前关闭异常的出现原因,并追踪到Transaction的commit过程,揭示了session关闭背后的机制。同时,文章提出了在关闭Session前进行状态检查的解决方案。


    做一个Hibernate简单实验时, 碰到了这个异常: Session was already closed. 现在有点时间, 这样见了异常就想看看: 是怎么"触犯"了hibernate导致这个异常的抛出?

    例子中的代码结构是这样的:

   
    Session session = sessionFactory.getCurrentSession();
    Transaction t = session.beginTransaction();

    // do something with the session

    t.commit();
    session.close();
 


    异常是在session.close()一句抛出来的,Hibernate中SessionImpl类close方法里有这样的代码:

         if ( isClosed() ) {
            throw new SessionException( "Session was already closed" );
        }
 


而自己写用session来干事的代码中没有把session关掉,那是什么时候session给关掉了呢? 第一个怀疑点放到了Transaction的提交上,即t.commit()这一句.
    
    那t.commit()里具体做了什么? 这得先看org.hibernate.Transaction接口都有哪些实现类, 例子中又是用的哪个实现类的commit方法. 不难发现Transaction接口有如下实现类:
    
debug跟到t.commit()代码里,发现是调用的JDBCTransaction实现类的方法. 一番找寻后终于在finally里看到了closeIfRequired方法,很是可疑!名字都起的那么"此地无银三百两".

    一番跟踪这后,在transactionContext.managedClose 方法里找到了"犯罪现场": close()! 原来已经调用此方法给关掉了!


    疑问解决了.
    在关session前先通过isOpen方法做个判断也就OK了.

    但这个小问题引起的思考给我深入drill Hibernate打开一条小道: session.beginTransaction()做了什么?具体把session给关掉的transactionContext是干啥的? 它们又与getCurrentSession方法有什么关联?敬请关注后续报道.

D:\devenconf\jdk8\bin\java.exe -XX:TieredStopAtLevel=1 -noverify -Dspring.output.ansi.enabled=always -Dcom.sun.management.jmxremote -Dspring.jmx.enabled=true -Dspring.liveBeansView.mbeanDomain -Dspring.application.admin.enabled=true "-Dmanagement.endpoints.jmx.exposure.include=*" "-javaagent:D:\Intellij IDEA\IntelliJ IDEA 2024.2.4\lib\idea_rt.jar=5970:D:\Intellij IDEA\IntelliJ IDEA 2024.2.4\bin" -Dfile.encoding=UTF-8 -classpath D:\devenconf\jdk8\jre\lib\charsets.jar;D:\devenconf\jdk8\jre\lib\deploy.jar;D:\devenconf\jdk8\jre\lib\ext\access-bridge-64.jar;D:\devenconf\jdk8\jre\lib\ext\cldrdata.jar;D:\devenconf\jdk8\jre\lib\ext\dnsns.jar;D:\devenconf\jdk8\jre\lib\ext\jaccess.jar;D:\devenconf\jdk8\jre\lib\ext\jfxrt.jar;D:\devenconf\jdk8\jre\lib\ext\localedata.jar;D:\devenconf\jdk8\jre\lib\ext\nashorn.jar;D:\devenconf\jdk8\jre\lib\ext\sunec.jar;D:\devenconf\jdk8\jre\lib\ext\sunjce_provider.jar;D:\devenconf\jdk8\jre\lib\ext\sunmscapi.jar;D:\devenconf\jdk8\jre\lib\ext\sunpkcs11.jar;D:\devenconf\jdk8\jre\lib\ext\zipfs.jar;D:\devenconf\jdk8\jre\lib\javaws.jar;D:\devenconf\jdk8\jre\lib\jce.jar;D:\devenconf\jdk8\jre\lib\jfr.jar;D:\devenconf\jdk8\jre\lib\jfxswt.jar;D:\devenconf\jdk8\jre\lib\jsse.jar;D:\devenconf\jdk8\jre\lib\management-agent.jar;D:\devenconf\jdk8\jre\lib\plugin.jar;D:\devenconf\jdk8\jre\lib\resources.jar;D:\devenconf\jdk8\jre\lib\rt.jar;D:\JavaCode\IdeaPrograms\springCloud01\student_server\target\classes;D:\devenconf\apache-maven-3.9.9\maven-repo\org\springframework\boot\spring-boot-starter-web\2.0.4.RELEASE\spring-boot-starter-web-2.0.4.RELEASE.jar;D:\devenconf\apache-maven-3.9.9\maven-repo\org\springframework\boot\spring-boot-starter\2.0.4.RELEASE\spring-boot-starter-2.0.4.RELEASE.jar;D:\devenconf\apache-maven-3.9.9\maven-repo\org\springframework\boot\spring-boot\2.0.4.RELEASE\spring-boot-2.0.4.RELEASE.jar;D:\devenconf\apache-maven-3.9.9\maven-repo\org\springframework\boot\spring-boot-starter-logging\2.0.4.RELEASE\spring-boot-starter-logging-2.0.4.RELEASE.jar;D:\devenconf\apache-maven-3.9.9\maven-repo\ch\qos\logback\logback-classic\1.2.3\logback-classic-1.2.3.jar;D:\devenconf\apache-maven-3.9.9\maven-repo\ch\qos\logback\logback-core\1.2.3\logback-core-1.2.3.jar;D:\devenconf\apache-maven-3.9.9\maven-repo\org\apache\logging\log4j\log4j-to-slf4j\2.10.0\log4j-to-slf4j-2.10.0.jar;D:\devenconf\apache-maven-3.9.9\maven-repo\org\apache\logging\log4j\log4j-api\2.10.0\log4j-api-2.10.0.jar;D:\devenconf\apache-maven-3.9.9\maven-repo\org\slf4j\jul-to-slf4j\1.7.25\jul-to-slf4j-1.7.25.jar;D:\devenconf\apache-maven-3.9.9\maven-repo\javax\annotation\javax.annotation-api\1.3.2\javax.annotation-api-1.3.2.jar;D:\devenconf\apache-maven-3.9.9\maven-repo\org\springframework\spring-core\5.0.8.RELEASE\spring-core-5.0.8.RELEASE.jar;D:\devenconf\apache-maven-3.9.9\maven-repo\org\springframework\spring-jcl\5.0.8.RELEASE\spring-jcl-5.0.8.RELEASE.jar;D:\devenconf\apache-maven-3.9.9\maven-repo\org\yaml\snakeyaml\1.19\snakeyaml-1.19.jar;D:\devenconf\apache-maven-3.9.9\maven-repo\org\springframework\boot\spring-boot-starter-json\2.0.4.RELEASE\spring-boot-starter-json-2.0.4.RELEASE.jar;D:\devenconf\apache-maven-3.9.9\maven-repo\com\fasterxml\jackson\core\jackson-databind\2.9.6\jackson-databind-2.9.6.jar;D:\devenconf\apache-maven-3.9.9\maven-repo\com\fasterxml\jackson\datatype\jackson-datatype-jdk8\2.9.6\jackson-datatype-jdk8-2.9.6.jar;D:\devenconf\apache-maven-3.9.9\maven-repo\com\fasterxml\jackson\datatype\jackson-datatype-jsr310\2.9.6\jackson-datatype-jsr310-2.9.6.jar;D:\devenconf\apache-maven-3.9.9\maven-repo\com\fasterxml\jackson\module\jackson-module-parameter-names\2.9.6\jackson-module-parameter-names-2.9.6.jar;D:\devenconf\apache-maven-3.9.9\maven-repo\org\springframework\boot\spring-boot-starter-tomcat\2.0.4.RELEASE\spring-boot-starter-tomcat-2.0.4.RELEASE.jar;D:\devenconf\apache-maven-3.9.9\maven-repo\org\apache\tomcat\embed\tomcat-embed-core\8.5.32\tomcat-embed-core-8.5.32.jar;D:\devenconf\apache-maven-3.9.9\maven-repo\org\apache\tomcat\embed\tomcat-embed-el\8.5.32\tomcat-embed-el-8.5.32.jar;D:\devenconf\apache-maven-3.9.9\maven-repo\org\apache\tomcat\embed\tomcat-embed-websocket\8.5.32\tomcat-embed-websocket-8.5.32.jar;D:\devenconf\apache-maven-3.9.9\maven-repo\org\hibernate\validator\hibernate-validator\6.0.11.Final\hibernate-validator-6.0.11.Final.jar;D:\devenconf\apache-maven-3.9.9\maven-repo\javax\validation\validation-api\2.0.1.Final\validation-api-2.0.1.Final.jar;D:\devenconf\apache-maven-3.9.9\maven-repo\org\jboss\logging\jboss-logging\3.3.2.Final\jboss-logging-3.3.2.Final.jar;D:\devenconf\apache-maven-3.9.9\maven-repo\com\fasterxml\classmate\1.3.4\classmate-1.3.4.jar;D:\devenconf\apache-maven-3.9.9\maven-repo\org\springframework\spring-web\5.0.8.RELEASE\spring-web-5.0.8.RELEASE.jar;D:\devenconf\apache-maven-3.9.9\maven-repo\org\springframework\spring-beans\5.0.8.RELEASE\spring-beans-5.0.8.RELEASE.jar;D:\devenconf\apache-maven-3.9.9\maven-repo\org\springframework\spring-webmvc\5.0.8.RELEASE\spring-webmvc-5.0.8.RELEASE.jar;D:\devenconf\apache-maven-3.9.9\maven-repo\org\springframework\spring-aop\5.0.8.RELEASE\spring-aop-5.0.8.RELEASE.jar;D:\devenconf\apache-maven-3.9.9\maven-repo\org\springframework\spring-context\5.0.8.RELEASE\spring-context-5.0.8.RELEASE.jar;D:\devenconf\apache-maven-3.9.9\maven-repo\org\springframework\spring-expression\5.0.8.RELEASE\spring-expression-5.0.8.RELEASE.jar;D:\devenconf\apache-maven-3.9.9\maven-repo\org\springframework\cloud\spring-cloud-starter-netflix-eureka-client\2.0.1.RELEASE\spring-cloud-starter-netflix-eureka-client-2.0.1.RELEASE.jar;D:\devenconf\apache-maven-3.9.9\maven-repo\org\springframework\cloud\spring-cloud-starter\2.0.1.RELEASE\spring-cloud-starter-2.0.1.RELEASE.jar;D:\devenconf\apache-maven-3.9.9\maven-repo\org\springframework\cloud\spring-cloud-context\2.0.1.RELEASE\spring-cloud-context-2.0.1.RELEASE.jar;D:\devenconf\apache-maven-3.9.9\maven-repo\org\springframework\security\spring-security-crypto\5.0.7.RELEASE\spring-security-crypto-5.0.7.RELEASE.jar;D:\devenconf\apache-maven-3.9.9\maven-repo\org\springframework\cloud\spring-cloud-commons\2.0.1.RELEASE\spring-cloud-commons-2.0.1.RELEASE.jar;D:\devenconf\apache-maven-3.9.9\maven-repo\org\springframework\security\spring-security-rsa\1.0.5.RELEASE\spring-security-rsa-1.0.5.RELEASE.jar;D:\devenconf\apache-maven-3.9.9\maven-repo\org\bouncycastle\bcpkix-jdk15on\1.56\bcpkix-jdk15on-1.56.jar;D:\devenconf\apache-maven-3.9.9\maven-repo\org\bouncycastle\bcprov-jdk15on\1.56\bcprov-jdk15on-1.56.jar;D:\devenconf\apache-maven-3.9.9\maven-repo\org\springframework\cloud\spring-cloud-netflix-core\2.0.1.RELEASE\spring-cloud-netflix-core-2.0.1.RELEASE.jar;D:\devenconf\apache-maven-3.9.9\maven-repo\org\springframework\boot\spring-boot-starter-aop\2.0.4.RELEASE\spring-boot-starter-aop-2.0.4.RELEASE.jar;D:\devenconf\apache-maven-3.9.9\maven-repo\org\aspectj\aspectjweaver\1.8.13\aspectjweaver-1.8.13.jar;D:\devenconf\apache-maven-3.9.9\maven-repo\org\springframework\cloud\spring-cloud-netflix-eureka-client\2.0.1.RELEASE\spring-cloud-netflix-eureka-client-2.0.1.RELEASE.jar;D:\devenconf\apache-maven-3.9.9\maven-repo\com\netflix\eureka\eureka-client\1.9.3\eureka-client-1.9.3.jar;D:\devenconf\apache-maven-3.9.9\maven-repo\org\codehaus\jettison\jettison\1.3.7\jettison-1.3.7.jar;D:\devenconf\apache-maven-3.9.9\maven-repo\stax\stax-api\1.0.1\stax-api-1.0.1.jar;D:\devenconf\apache-maven-3.9.9\maven-repo\com\netflix\netflix-commons\netflix-eventbus\0.3.0\netflix-eventbus-0.3.0.jar;D:\devenconf\apache-maven-3.9.9\maven-repo\com\netflix\netflix-commons\netflix-infix\0.3.0\netflix-infix-0.3.0.jar;D:\devenconf\apache-maven-3.9.9\maven-repo\commons-jxpath\commons-jxpath\1.3\commons-jxpath-1.3.jar;D:\devenconf\apache-maven-3.9.9\maven-repo\joda-time\joda-time\2.9.9\joda-time-2.9.9.jar;D:\devenconf\apache-maven-3.9.9\maven-repo\org\antlr\antlr-runtime\3.4\antlr-runtime-3.4.jar;D:\devenconf\apache-maven-3.9.9\maven-repo\org\antlr\stringtemplate\3.2.1\stringtemplate-3.2.1.jar;D:\devenconf\apache-maven-3.9.9\maven-repo\antlr\antlr\2.7.7\antlr-2.7.7.jar;D:\devenconf\apache-maven-3.9.9\maven-repo\com\google\code\gson\gson\2.8.5\gson-2.8.5.jar;D:\devenconf\apache-maven-3.9.9\maven-repo\org\apache\commons\commons-math\2.2\commons-math-2.2.jar;D:\devenconf\apache-maven-3.9.9\maven-repo\com\netflix\archaius\archaius-core\0.7.6\archaius-core-0.7.6.jar;D:\devenconf\apache-maven-3.9.9\maven-repo\com\google\guava\guava\16.0\guava-16.0.jar;D:\devenconf\apache-maven-3.9.9\maven-repo\javax\ws\rs\jsr311-api\1.1.1\jsr311-api-1.1.1.jar;D:\devenconf\apache-maven-3.9.9\maven-repo\com\netflix\servo\servo-core\0.12.21\servo-core-0.12.21.jar;D:\devenconf\apache-maven-3.9.9\maven-repo\com\sun\jersey\jersey-core\1.19.1\jersey-core-1.19.1.jar;D:\devenconf\apache-maven-3.9.9\maven-repo\com\sun\jersey\jersey-client\1.19.1\jersey-client-1.19.1.jar;D:\devenconf\apache-maven-3.9.9\maven-repo\com\sun\jersey\contribs\jersey-apache-client4\1.19.1\jersey-apache-client4-1.19.1.jar;D:\devenconf\apache-maven-3.9.9\maven-repo\org\apache\httpcomponents\httpclient\4.5.6\httpclient-4.5.6.jar;D:\devenconf\apache-maven-3.9.9\maven-repo\org\apache\httpcomponents\httpcore\4.4.10\httpcore-4.4.10.jar;D:\devenconf\apache-maven-3.9.9\maven-repo\commons-codec\commons-codec\1.11\commons-codec-1.11.jar;D:\devenconf\apache-maven-3.9.9\maven-repo\com\google\inject\guice\4.1.0\guice-4.1.0.jar;D:\devenconf\apache-maven-3.9.9\maven-repo\javax\inject\javax.inject\1\javax.inject-1.jar;D:\devenconf\apache-maven-3.9.9\maven-repo\aopalliance\aopalliance\1.0\aopalliance-1.0.jar;D:\devenconf\apache-maven-3.9.9\maven-repo\com\github\vlsi\compactmap\compactmap\1.2.1\compactmap-1.2.1.jar;D:\devenconf\apache-maven-3.9.9\maven-repo\com\github\andrewoma\dexx\dexx-collections\0.2\dexx-collections-0.2.jar;D:\devenconf\apache-maven-3.9.9\maven-repo\com\fasterxml\jackson\core\jackson-annotations\2.9.0\jackson-annotations-2.9.0.jar;D:\devenconf\apache-maven-3.9.9\maven-repo\com\fasterxml\jackson\core\jackson-core\2.9.6\jackson-core-2.9.6.jar;D:\devenconf\apache-maven-3.9.9\maven-repo\com\netflix\eureka\eureka-core\1.9.3\eureka-core-1.9.3.jar;D:\devenconf\apache-maven-3.9.9\maven-repo\org\codehaus\woodstox\woodstox-core-asl\4.4.1\woodstox-core-asl-4.4.1.jar;D:\devenconf\apache-maven-3.9.9\maven-repo\javax\xml\stream\stax-api\1.0-2\stax-api-1.0-2.jar;D:\devenconf\apache-maven-3.9.9\maven-repo\org\codehaus\woodstox\stax2-api\3.1.4\stax2-api-3.1.4.jar;D:\devenconf\apache-maven-3.9.9\maven-repo\org\springframework\cloud\spring-cloud-starter-netflix-archaius\2.0.1.RELEASE\spring-cloud-starter-netflix-archaius-2.0.1.RELEASE.jar;D:\devenconf\apache-maven-3.9.9\maven-repo\org\springframework\cloud\spring-cloud-netflix-ribbon\2.0.1.RELEASE\spring-cloud-netflix-ribbon-2.0.1.RELEASE.jar;D:\devenconf\apache-maven-3.9.9\maven-repo\org\springframework\cloud\spring-cloud-netflix-archaius\2.0.1.RELEASE\spring-cloud-netflix-archaius-2.0.1.RELEASE.jar;D:\devenconf\apache-maven-3.9.9\maven-repo\commons-configuration\commons-configuration\1.8\commons-configuration-1.8.jar;D:\devenconf\apache-maven-3.9.9\maven-repo\commons-lang\commons-lang\2.6\commons-lang-2.6.jar;D:\devenconf\apache-maven-3.9.9\maven-repo\org\springframework\cloud\spring-cloud-starter-netflix-ribbon\2.0.1.RELEASE\spring-cloud-starter-netflix-ribbon-2.0.1.RELEASE.jar;D:\devenconf\apache-maven-3.9.9\maven-repo\com\netflix\ribbon\ribbon\2.2.5\ribbon-2.2.5.jar;D:\devenconf\apache-maven-3.9.9\maven-repo\com\netflix\ribbon\ribbon-transport\2.2.5\ribbon-transport-2.2.5.jar;D:\devenconf\apache-maven-3.9.9\maven-repo\io\reactivex\rxnetty-contexts\0.4.9\rxnetty-contexts-0.4.9.jar;D:\devenconf\apache-maven-3.9.9\maven-repo\io\reactivex\rxnetty-servo\0.4.9\rxnetty-servo-0.4.9.jar;D:\devenconf\apache-maven-3.9.9\maven-repo\com\netflix\hystrix\hystrix-core\1.5.12\hystrix-core-1.5.12.jar;D:\devenconf\apache-maven-3.9.9\maven-repo\org\hdrhistogram\HdrHistogram\2.1.9\HdrHistogram-2.1.9.jar;D:\devenconf\apache-maven-3.9.9\maven-repo\io\reactivex\rxnetty\0.4.9\rxnetty-0.4.9.jar;D:\devenconf\apache-maven-3.9.9\maven-repo\io\netty\netty-codec-http\4.1.27.Final\netty-codec-http-4.1.27.Final.jar;D:\devenconf\apache-maven-3.9.9\maven-repo\io\netty\netty-codec\4.1.27.Final\netty-codec-4.1.27.Final.jar;D:\devenconf\apache-maven-3.9.9\maven-repo\io\netty\netty-transport-native-epoll\4.1.27.Final\netty-transport-native-epoll-4.1.27.Final.jar;D:\devenconf\apache-maven-3.9.9\maven-repo\io\netty\netty-common\4.1.27.Final\netty-common-4.1.27.Final.jar;D:\devenconf\apache-maven-3.9.9\maven-repo\io\netty\netty-buffer\4.1.27.Final\netty-buffer-4.1.27.Final.jar;D:\devenconf\apache-maven-3.9.9\maven-repo\io\netty\netty-transport-native-unix-common\4.1.27.Final\netty-transport-native-unix-common-4.1.27.Final.jar;D:\devenconf\apache-maven-3.9.9\maven-repo\io\netty\netty-transport\4.1.27.Final\netty-transport-4.1.27.Final.jar;D:\devenconf\apache-maven-3.9.9\maven-repo\io\netty\netty-resolver\4.1.27.Final\netty-resolver-4.1.27.Final.jar;D:\devenconf\apache-maven-3.9.9\maven-repo\com\netflix\ribbon\ribbon-core\2.2.5\ribbon-core-2.2.5.jar;D:\devenconf\apache-maven-3.9.9\maven-repo\com\netflix\ribbon\ribbon-httpclient\2.2.5\ribbon-httpclient-2.2.5.jar;D:\devenconf\apache-maven-3.9.9\maven-repo\commons-collections\commons-collections\3.2.2\commons-collections-3.2.2.jar;D:\devenconf\apache-maven-3.9.9\maven-repo\com\netflix\netflix-commons\netflix-commons-util\0.3.0\netflix-commons-util-0.3.0.jar;D:\devenconf\apache-maven-3.9.9\maven-repo\com\netflix\ribbon\ribbon-loadbalancer\2.2.5\ribbon-loadbalancer-2.2.5.jar;D:\devenconf\apache-maven-3.9.9\maven-repo\com\netflix\netflix-commons\netflix-statistics\0.1.1\netflix-statistics-0.1.1.jar;D:\devenconf\apache-maven-3.9.9\maven-repo\io\reactivex\rxjava\1.3.8\rxjava-1.3.8.jar;D:\devenconf\apache-maven-3.9.9\maven-repo\com\netflix\ribbon\ribbon-eureka\2.2.5\ribbon-eureka-2.2.5.jar;D:\devenconf\apache-maven-3.9.9\maven-repo\com\thoughtworks\xstream\xstream\1.4.10\xstream-1.4.10.jar;D:\devenconf\apache-maven-3.9.9\maven-repo\xmlpull\xmlpull\1.1.3.1\xmlpull-1.1.3.1.jar;D:\devenconf\apache-maven-3.9.9\maven-repo\xpp3\xpp3_min\1.1.4c\xpp3_min-1.1.4c.jar;D:\devenconf\apache-maven-3.9.9\maven-repo\org\springframework\boot\spring-boot-starter-jdbc\2.0.4.RELEASE\spring-boot-starter-jdbc-2.0.4.RELEASE.jar;D:\devenconf\apache-maven-3.9.9\maven-repo\com\zaxxer\HikariCP\2.7.9\HikariCP-2.7.9.jar;D:\devenconf\apache-maven-3.9.9\maven-repo\org\springframework\spring-jdbc\5.0.8.RELEASE\spring-jdbc-5.0.8.RELEASE.jar;D:\devenconf\apache-maven-3.9.9\maven-repo\org\springframework\spring-tx\5.0.8.RELEASE\spring-tx-5.0.8.RELEASE.jar;D:\devenconf\apache-maven-3.9.9\maven-repo\com\mysql\mysql-connector-j\8.0.33\mysql-connector-j-8.0.33.jar;D:\devenconf\apache-maven-3.9.9\maven-repo\com\google\protobuf\protobuf-java\3.21.9\protobuf-java-3.21.9.jar;D:\devenconf\apache-maven-3.9.9\maven-repo\com\alibaba\druid-spring-boot-starter\1.1.10\druid-spring-boot-starter-1.1.10.jar;D:\devenconf\apache-maven-3.9.9\maven-repo\com\alibaba\druid\1.1.10\druid-1.1.10.jar;D:\devenconf\apache-maven-3.9.9\maven-repo\org\slf4j\slf4j-api\1.7.25\slf4j-api-1.7.25.jar;D:\devenconf\apache-maven-3.9.9\maven-repo\org\springframework\boot\spring-boot-autoconfigure\2.0.4.RELEASE\spring-boot-autoconfigure-2.0.4.RELEASE.jar;D:\JavaCode\IdeaPrograms\springCloud01\student_common\target\classes;D:\devenconf\apache-maven-3.9.9\maven-repo\com\baomidou\mybatis-plus-boot-starter\3.2.0\mybatis-plus-boot-starter-3.2.0.jar;D:\devenconf\apache-maven-3.9.9\maven-repo\com\baomidou\mybatis-plus\3.2.0\mybatis-plus-3.2.0.jar;D:\devenconf\apache-maven-3.9.9\maven-repo\com\baomidou\mybatis-plus-extension\3.2.0\mybatis-plus-extension-3.2.0.jar;D:\devenconf\apache-maven-3.9.9\maven-repo\com\baomidou\mybatis-plus-core\3.2.0\mybatis-plus-core-3.2.0.jar;D:\devenconf\apache-maven-3.9.9\maven-repo\com\baomidou\mybatis-plus-annotation\3.2.0\mybatis-plus-annotation-3.2.0.jar;D:\devenconf\apache-maven-3.9.9\maven-repo\com\alibaba\fastjson\1.2.47\fastjson-1.2.47.jar;D:\devenconf\apache-maven-3.9.9\maven-repo\com\github\pagehelper\pagehelper-spring-boot-starter\1.2.5\pagehelper-spring-boot-starter-1.2.5.jar;D:\devenconf\apache-maven-3.9.9\maven-repo\org\mybatis\spring\boot\mybatis-spring-boot-starter\1.3.2\mybatis-spring-boot-starter-1.3.2.jar;D:\devenconf\apache-maven-3.9.9\maven-repo\org\mybatis\spring\boot\mybatis-spring-boot-autoconfigure\1.3.2\mybatis-spring-boot-autoconfigure-1.3.2.jar;D:\devenconf\apache-maven-3.9.9\maven-repo\org\mybatis\mybatis\3.4.6\mybatis-3.4.6.jar;D:\devenconf\apache-maven-3.9.9\maven-repo\org\mybatis\mybatis-spring\1.3.2\mybatis-spring-1.3.2.jar;D:\devenconf\apache-maven-3.9.9\maven-repo\com\github\pagehelper\pagehelper-spring-boot-autoconfigure\1.2.5\pagehelper-spring-boot-autoconfigure-1.2.5.jar;D:\devenconf\apache-maven-3.9.9\maven-repo\com\github\pagehelper\pagehelper\5.1.4\pagehelper-5.1.4.jar;D:\devenconf\apache-maven-3.9.9\maven-repo\com\github\jsqlparser\jsqlparser\1.0\jsqlparser-1.0.jar;D:\devenconf\apache-maven-3.9.9\maven-repo\org\apache\commons\commons-lang3\3.4\commons-lang3-3.4.jar;D:\devenconf\apache-maven-3.9.9\maven-repo\org\projectlombok\lombok\1.16.22\lombok-1.16.22.jar com.gyx.StudentServerApplication 2025-07-21 09:13:16.944 INFO 5544 --- [ main] s.c.a.AnnotationConfigApplicationContext : Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext@1ef6d34c: startup date [Mon Jul 21 09:13:16 CST 2025]; root of context hierarchy 2025-07-21 09:13:17.071 INFO 5544 --- [ main] f.a.AutowiredAnnotationBeanPostProcessor : JSR-330 'javax.inject.Inject' annotation found and supported for autowiring 2025-07-21 09:13:17.087 INFO 5544 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'configurationPropertiesRebinderAutoConfiguration' of type [org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration$$EnhancerBySpringCGLIB$$730311f6] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying) . ____ _ __ _ _ /\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \ ( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \ \\/ ___)| |_)| | | | | || (_| | ) ) ) ) ' |____| .__|_| |_|_| |_\__, | / / / / =========|_|==============|___/=/_/_/_/ :: Spring Boot :: (v2.0.4.RELEASE) 2025-07-21 09:13:17.480 INFO 5544 --- [ main] com.gyx.StudentServerApplication : No active profile set, falling back to default profiles: default 2025-07-21 09:13:17.489 INFO 5544 --- [ main] ConfigServletWebServerApplicationContext : Refreshing org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext@55e7a35c: startup date [Mon Jul 21 09:13:17 CST 2025]; parent: org.springframework.context.annotation.AnnotationConfigApplicationContext@1ef6d34c 2025-07-21 09:13:17.918 WARN 5544 --- [ main] o.m.s.mapper.ClassPathMapperScanner : Skipping MapperFactoryBean with name 'clazzMapper' and 'com.gyx.mapper.ClazzMapper' mapperInterface. Bean already defined with the same name! 2025-07-21 09:13:17.919 WARN 5544 --- [ main] o.m.s.mapper.ClassPathMapperScanner : Skipping MapperFactoryBean with name 'studentMapper' and 'com.gyx.mapper.StudentMapper' mapperInterface. Bean already defined with the same name! 2025-07-21 09:13:17.919 WARN 5544 --- [ main] o.m.s.mapper.ClassPathMapperScanner : Skipping MapperFactoryBean with name 'userMapper' and 'com.gyx.mapper.UserMapper' mapperInterface. Bean already defined with the same name! 2025-07-21 09:13:17.919 WARN 5544 --- [ main] o.m.s.mapper.ClassPathMapperScanner : No MyBatis mapper was found in '[com.gyx]' package. Please check your configuration. 2025-07-21 09:13:17.994 INFO 5544 --- [ main] o.s.cloud.context.scope.GenericScope : BeanFactory id=d5719b05-689f-3f68-b3ff-b3d8b15227a9 2025-07-21 09:13:18.002 INFO 5544 --- [ main] f.a.AutowiredAnnotationBeanPostProcessor : JSR-330 'javax.inject.Inject' annotation found and supported for autowiring 2025-07-21 09:13:18.063 INFO 5544 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration' of type [org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration$$EnhancerBySpringCGLIB$$56e90ef9] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying) 2025-07-21 09:13:18.077 INFO 5544 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration' of type [org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration$$EnhancerBySpringCGLIB$$730311f6] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying) 2025-07-21 09:13:18.326 INFO 5544 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8090 (http) 2025-07-21 09:13:18.338 INFO 5544 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat] 2025-07-21 09:13:18.338 INFO 5544 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet Engine: Apache Tomcat/8.5.32 2025-07-21 09:13:18.340 INFO 5544 --- [ost-startStop-1] o.a.catalina.core.AprLifecycleListener : The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: [D:\devenconf\jdk8\bin;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;D:\VMware Workstation\bin\;C:\Program Files (x86)\Common Files\Oracle\Java\java8path;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;D:\devenconf\mingw64\bin;C:\Program Files\dotnet\;C:\Program Files\MySQL\MySQL Server 8.0\bin;D:\devenconf\apache-maven-3.9.9\bin;D:\devenconf\jdk11\bin;D:\Git\cmd;D:\nodejs\;D:\PuTTY\;C:\Users\32370\AppData\Local\Microsoft\WindowsApps;D:\Microsoft VS Code\bin;C:\Users\32370\AppData\Roaming\npm;.] 2025-07-21 09:13:18.415 INFO 5544 --- [ost-startStop-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext 2025-07-21 09:13:18.416 INFO 5544 --- [ost-startStop-1] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 927 ms 2025-07-21 09:13:18.469 INFO 5544 --- [ost-startStop-1] o.s.b.w.servlet.ServletRegistrationBean : Servlet dispatcherServlet mapped to [/] 2025-07-21 09:13:18.470 INFO 5544 --- [ost-startStop-1] o.s.b.w.servlet.ServletRegistrationBean : Servlet statViewServlet mapped to [/druid/*] 2025-07-21 09:13:18.473 INFO 5544 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'characterEncodingFilter' to: [/*] 2025-07-21 09:13:18.473 INFO 5544 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'hiddenHttpMethodFilter' to: [/*] 2025-07-21 09:13:18.473 INFO 5544 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'httpPutFormContentFilter' to: [/*] 2025-07-21 09:13:18.473 INFO 5544 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'requestContextFilter' to: [/*] 2025-07-21 09:13:18.473 INFO 5544 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'webStatFilter' to urls: [/*] Logging initialized using 'class org.apache.ibatis.logging.stdout.StdOutImpl' adapter. 2025-07-21 09:13:18.589 INFO 5544 --- [ main] c.a.d.s.b.a.DruidDataSourceAutoConfigure : Init DruidDataSource 2025-07-21 09:13:18.871 INFO 5544 --- [ main] com.alibaba.druid.pool.DruidDataSource : {dataSource-1} inited 2025-07-21 09:13:18.882 WARN 5544 --- [ main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'clazzController': Unsatisfied dependency expressed through field 'clazzService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'clazzServiceImpl': Unsatisfied dependency expressed through field 'baseMapper'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'clazzMapper' defined in file [D:\JavaCode\IdeaPrograms\springCloud01\student_server\target\classes\com\gyx\mapper\ClazzMapper.class]: Unsatisfied dependency expressed through bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [com/baomidou/mybatisplus/autoconfigure/MybatisPlusAutoConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.ibatis.session.SqlSessionFactory]: Factory method 'sqlSessionFactory' threw exception; nested exception is java.lang.NoClassDefFoundError: org/mybatis/logging/LoggerFactory 2025-07-21 09:13:18.885 INFO 5544 --- [ main] com.alibaba.druid.pool.DruidDataSource : {dataSource-1} closed 2025-07-21 09:13:18.885 INFO 5544 --- [ main] o.apache.catalina.core.StandardService : Stopping service [Tomcat] 2025-07-21 09:13:18.894 INFO 5544 --- [ main] ConditionEvaluationReportLoggingListener : Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled. 2025-07-21 09:13:18.899 ERROR 5544 --- [ main] o.s.boot.SpringApplication : Application run failed org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'clazzController': Unsatisfied dependency expressed through field 'clazzService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'clazzServiceImpl': Unsatisfied dependency expressed through field 'baseMapper'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'clazzMapper' defined in file [D:\JavaCode\IdeaPrograms\springCloud01\student_server\target\classes\com\gyx\mapper\ClazzMapper.class]: Unsatisfied dependency expressed through bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [com/baomidou/mybatisplus/autoconfigure/MybatisPlusAutoConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.ibatis.session.SqlSessionFactory]: Factory method 'sqlSessionFactory' threw exception; nested exception is java.lang.NoClassDefFoundError: org/mybatis/logging/LoggerFactory at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:586) ~[spring-beans-5.0.8.RELEASE.jar:5.0.8.RELEASE] at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:91) ~[spring-beans-5.0.8.RELEASE.jar:5.0.8.RELEASE] at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:372) ~[spring-beans-5.0.8.RELEASE.jar:5.0.8.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1341) ~[spring-beans-5.0.8.RELEASE.jar:5.0.8.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:572) ~[spring-beans-5.0.8.RELEASE.jar:5.0.8.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:495) ~[spring-beans-5.0.8.RELEASE.jar:5.0.8.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:317) ~[spring-beans-5.0.8.RELEASE.jar:5.0.8.RELEASE] at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) ~[spring-beans-5.0.8.RELEASE.jar:5.0.8.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:315) ~[spring-beans-5.0.8.RELEASE.jar:5.0.8.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) ~[spring-beans-5.0.8.RELEASE.jar:5.0.8.RELEASE] at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:759) ~[spring-beans-5.0.8.RELEASE.jar:5.0.8.RELEASE] at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:869) ~[spring-context-5.0.8.RELEASE.jar:5.0.8.RELEASE] at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:550) ~[spring-context-5.0.8.RELEASE.jar:5.0.8.RELEASE] at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:140) ~[spring-boot-2.0.4.RELEASE.jar:2.0.4.RELEASE] at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:762) [spring-boot-2.0.4.RELEASE.jar:2.0.4.RELEASE] at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:398) [spring-boot-2.0.4.RELEASE.jar:2.0.4.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:330) [spring-boot-2.0.4.RELEASE.jar:2.0.4.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1258) [spring-boot-2.0.4.RELEASE.jar:2.0.4.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1246) [spring-boot-2.0.4.RELEASE.jar:2.0.4.RELEASE] at com.gyx.StudentServerApplication.main(StudentServerApplication.java:16) [classes/:na] Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'clazzServiceImpl': Unsatisfied dependency expressed through field 'baseMapper'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'clazzMapper' defined in file [D:\JavaCode\IdeaPrograms\springCloud01\student_server\target\classes\com\gyx\mapper\ClazzMapper.class]: Unsatisfied dependency expressed through bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [com/baomidou/mybatisplus/autoconfigure/MybatisPlusAutoConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.ibatis.session.SqlSessionFactory]: Factory method 'sqlSessionFactory' threw exception; nested exception is java.lang.NoClassDefFoundError: org/mybatis/logging/LoggerFactory at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:586) ~[spring-beans-5.0.8.RELEASE.jar:5.0.8.RELEASE] at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:91) ~[spring-beans-5.0.8.RELEASE.jar:5.0.8.RELEASE] at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:372) ~[spring-beans-5.0.8.RELEASE.jar:5.0.8.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1341) ~[spring-beans-5.0.8.RELEASE.jar:5.0.8.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:572) ~[spring-beans-5.0.8.RELEASE.jar:5.0.8.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:495) ~[spring-beans-5.0.8.RELEASE.jar:5.0.8.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:317) ~[spring-beans-5.0.8.RELEASE.jar:5.0.8.RELEASE] at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) ~[spring-beans-5.0.8.RELEASE.jar:5.0.8.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:315) ~[spring-beans-5.0.8.RELEASE.jar:5.0.8.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) ~[spring-beans-5.0.8.RELEASE.jar:5.0.8.RELEASE] at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:251) ~[spring-beans-5.0.8.RELEASE.jar:5.0.8.RELEASE] at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1135) ~[spring-beans-5.0.8.RELEASE.jar:5.0.8.RELEASE] at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1062) ~[spring-beans-5.0.8.RELEASE.jar:5.0.8.RELEASE] at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:583) ~[spring-beans-5.0.8.RELEASE.jar:5.0.8.RELEASE] ... 19 common frames omitted Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'clazzMapper' defined in file [D:\JavaCode\IdeaPrograms\springCloud01\student_server\target\classes\com\gyx\mapper\ClazzMapper.class]: Unsatisfied dependency expressed through bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [com/baomidou/mybatisplus/autoconfigure/MybatisPlusAutoConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.ibatis.session.SqlSessionFactory]: Factory method 'sqlSessionFactory' threw exception; nested exception is java.lang.NoClassDefFoundError: org/mybatis/logging/LoggerFactory at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireByType(AbstractAutowireCapableBeanFactory.java:1436) ~[spring-beans-5.0.8.RELEASE.jar:5.0.8.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1323) ~[spring-beans-5.0.8.RELEASE.jar:5.0.8.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:572) ~[spring-beans-5.0.8.RELEASE.jar:5.0.8.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:495) ~[spring-beans-5.0.8.RELEASE.jar:5.0.8.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:317) ~[spring-beans-5.0.8.RELEASE.jar:5.0.8.RELEASE] at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) ~[spring-beans-5.0.8.RELEASE.jar:5.0.8.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:315) ~[spring-beans-5.0.8.RELEASE.jar:5.0.8.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) ~[spring-beans-5.0.8.RELEASE.jar:5.0.8.RELEASE] at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:251) ~[spring-beans-5.0.8.RELEASE.jar:5.0.8.RELEASE] at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1135) ~[spring-beans-5.0.8.RELEASE.jar:5.0.8.RELEASE] at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1062) ~[spring-beans-5.0.8.RELEASE.jar:5.0.8.RELEASE] at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:583) ~[spring-beans-5.0.8.RELEASE.jar:5.0.8.RELEASE] ... 32 common frames omitted Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [com/baomidou/mybatisplus/autoconfigure/MybatisPlusAutoConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.ibatis.session.SqlSessionFactory]: Factory method 'sqlSessionFactory' threw exception; nested exception is java.lang.NoClassDefFoundError: org/mybatis/logging/LoggerFactory at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:590) ~[spring-beans-5.0.8.RELEASE.jar:5.0.8.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1247) ~[spring-beans-5.0.8.RELEASE.jar:5.0.8.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1096) ~[spring-beans-5.0.8.RELEASE.jar:5.0.8.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:535) ~[spring-beans-5.0.8.RELEASE.jar:5.0.8.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:495) ~[spring-beans-5.0.8.RELEASE.jar:5.0.8.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:317) ~[spring-beans-5.0.8.RELEASE.jar:5.0.8.RELEASE] at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) ~[spring-beans-5.0.8.RELEASE.jar:5.0.8.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:315) ~[spring-beans-5.0.8.RELEASE.jar:5.0.8.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) ~[spring-beans-5.0.8.RELEASE.jar:5.0.8.RELEASE] at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:251) ~[spring-beans-5.0.8.RELEASE.jar:5.0.8.RELEASE] at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1135) ~[spring-beans-5.0.8.RELEASE.jar:5.0.8.RELEASE] at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1062) ~[spring-beans-5.0.8.RELEASE.jar:5.0.8.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireByType(AbstractAutowireCapableBeanFactory.java:1421) ~[spring-beans-5.0.8.RELEASE.jar:5.0.8.RELEASE] ... 43 common frames omitted Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.ibatis.session.SqlSessionFactory]: Factory method 'sqlSessionFactory' threw exception; nested exception is java.lang.NoClassDefFoundError: org/mybatis/logging/LoggerFactory at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:185) ~[spring-beans-5.0.8.RELEASE.jar:5.0.8.RELEASE] at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:582) ~[spring-beans-5.0.8.RELEASE.jar:5.0.8.RELEASE] ... 55 common frames omitted Caused by: java.lang.NoClassDefFoundError: org/mybatis/logging/LoggerFactory at com.baomidou.mybatisplus.extension.spring.MybatisSqlSessionFactoryBean.<clinit>(MybatisSqlSessionFactoryBean.java:94) ~[mybatis-plus-extension-3.2.0.jar:3.2.0] at com.baomidou.mybatisplus.autoconfigure.MybatisPlusAutoConfiguration.sqlSessionFactory(MybatisPlusAutoConfiguration.java:157) ~[mybatis-plus-boot-starter-3.2.0.jar:3.2.0] at com.baomidou.mybatisplus.autoconfigure.MybatisPlusAutoConfiguration$$EnhancerBySpringCGLIB$$94b17b93.CGLIB$sqlSessionFactory$0(<generated>) ~[mybatis-plus-boot-starter-3.2.0.jar:3.2.0] at com.baomidou.mybatisplus.autoconfigure.MybatisPlusAutoConfiguration$$EnhancerBySpringCGLIB$$94b17b93$$FastClassBySpringCGLIB$$e348f613.invoke(<generated>) ~[mybatis-plus-boot-starter-3.2.0.jar:3.2.0] at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228) ~[spring-core-5.0.8.RELEASE.jar:5.0.8.RELEASE] at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:361) ~[spring-context-5.0.8.RELEASE.jar:5.0.8.RELEASE] at com.baomidou.mybatisplus.autoconfigure.MybatisPlusAutoConfiguration$$EnhancerBySpringCGLIB$$94b17b93.sqlSessionFactory(<generated>) ~[mybatis-plus-boot-starter-3.2.0.jar:3.2.0] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_441] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_441] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_441] at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_441] at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154) ~[spring-beans-5.0.8.RELEASE.jar:5.0.8.RELEASE] ... 56 common frames omitted Caused by: java.lang.ClassNotFoundException: org.mybatis.logging.LoggerFactory at java.net.URLClassLoader.findClass(URLClassLoader.java:387) ~[na:1.8.0_441] at java.lang.ClassLoader.loadClass(ClassLoader.java:418) ~[na:1.8.0_441] at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:359) ~[na:1.8.0_441] at java.lang.ClassLoader.loadClass(ClassLoader.java:351) ~[na:1.8.0_441] ... 68 common frames omitted Process finished with exit code 1
07-22
程序 [csp] 注册了JDBC驱动程序 [com.alibaba.druid.proxy.DruidDriver],但在Web应用程序停止时无法注销它。 为防止内存泄漏,JDBC驱动程序已被强制取消注册。 30-Jun-2025 10:41:03.125 警告 [main] org.apache.catalina.loader.WebappClassLoaderBase.clearReferencesJdbc Web应用程序 [csp] 注册了JDBC驱动程序 [com.mysql.cj.jdbc.Driver],但在Web应用程序停止时无法注销它。 为防止内存泄漏,JDBC驱动程序已被强制取消注册。 30-Jun-2025 10:41:03.126 警告 [main] org.apache.catalina.loader.WebappClassLoaderBase.clearReferencesThreads Web应用程序[csp]似乎启动了一个名为[mysql-cj-abandoned-connection-cleanup]的线程,但未能停止它。这很可能会造成内存泄漏。线程的堆栈跟踪:[ java.lang.Object.wait(Native Method) java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:143) com.mysql.cj.jdbc.AbandonedConnectionCleanupThread.run(AbandonedConnectionCleanupThread.java:91) java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) java.lang.Thread.run(Thread.java:745)] 30-Jun-2025 10:41:08.216 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Server.服务器版本: Apache Tomcat/9.0.106 30-Jun-2025 10:41:08.218 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log 服务器构建: Jun 5 2025 19:02:30 UTC 30-Jun-2025 10:41:08.218 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log 服务器版本号: 9.0.106.0 30-Jun-2025 10:41:08.218 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log 操作系统名称: Linux 30-Jun-2025 10:41:08.219 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log OS.版本: 3.10.0-862.el7.x86_64 30-Jun-2025 10:41:08.219 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log 架构: amd64 30-Jun-2025 10:41:08.219 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Java 环境变量: /usr/local/jdk/jre 30-Jun-2025 10:41:08.219 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Java虚拟机版本: 1.8.0_44-b02 30-Jun-2025 10:41:08.219 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log JVM.供应商: Oracle Corporation 30-Jun-2025 10:41:08.219 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_BASE: /home/csp/apache-tomcat-9.0.106 30-Jun-2025 10:41:08.219 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_HOME: /home/csp/apache-tomcat-9.0.106 30-Jun-2025 10:41:08.219 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log 命令行参数: -Djava.util.logging.config.file=/home/csp/apache-tomcat-9.0.106/conf/logging.properties 30-Jun-2025 10:41:08.220 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log 命令行参数: -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager 30-Jun-2025 10:41:08.220 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log 命令行参数: -Djdk.tls.ephemeralDHKeySize=2048 30-Jun-2025 10:41:08.220 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log 命令行参数: -Djava.protocol.handler.pkgs=org.apache.catalina.webresources 30-Jun-2025 10:41:08.220 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log 命令行参数: -Dsun.io.useCanonCaches=false 30-Jun-2025 10:41:08.220 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log 命令行参数: -Dorg.apache.catalina.security.SecurityListener.UMASK=0027 30-Jun-2025 10:41:08.220 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log 命令行参数: -Dignore.endorsed.dirs= 30-Jun-2025 10:41:08.220 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log 命令行参数: -Dcatalina.base=/home/csp/apache-tomcat-9.0.106 30-Jun-2025 10:41:08.220 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log 命令行参数: -Dcatalina.home=/home/csp/apache-tomcat-9.0.106 30-Jun-2025 10:41:08.220 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log 命令行参数: -Djava.io.tmpdir=/home/csp/apache-tomcat-9.0.106/temp 30-Jun-2025 10:41:08.221 信息 [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent 在java.library.path:[/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib]上找不到基于APR的Apache Tomcat本机库,该库允许在生产环境中获得最佳性能 30-Jun-2025 10:41:08.401 信息 [main] org.apache.coyote.AbstractProtocol.init 初始化协议处理器 ["http-nio-8080"] 30-Jun-2025 10:41:08.419 信息 [main] org.apache.catalina.startup.Catalina.load 服务器在[340]毫秒内初始化 30-Jun-2025 10:41:08.440 信息 [main] org.apache.catalina.core.StandardService.startInternal 正在启动服务[Catalina] 30-Jun-2025 10:41:08.440 信息 [main] org.apache.catalina.core.StandardEngine.startInternal 正在启动 Servlet 引擎:[Apache Tomcat/9.0.106] 30-Jun-2025 10:41:08.453 信息 [main] org.apache.catalina.startup.HostConfig.deployWAR 正在部署web应用程序存档文件[/home/csp/apache-tomcat-9.0.106/webapps/csp.war] 30-Jun-2025 10:41:12.531 信息 [main] org.apache.jasper.servlet.TldScanner.scanJars 至少有一个JAR被扫描用于TLD但尚未包含TLD。 为此记录器启用调试日志记录,以获取已扫描但未在其中找到TLD的完整JAR列表。 在扫描期间跳过不需要的JAR可以缩短启动时间和JSP编译时间。 10:41:12,573 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Could NOT find resource [logback-test.xml] 10:41:12,573 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Found resource [logback.xml] at [file:/home/csp/apache-tomcat-9.0.106/webapps/csp/WEB-INF/classes/logback.xml] 10:41:12,574 |-WARN in ch.qos.logback.classic.LoggerContext[default] - Resource [logback.xml] occurs multiple times on the classpath. 10:41:12,574 |-WARN in ch.qos.logback.classic.LoggerContext[default] - Resource [logback.xml] occurs at [jar:file:/home/csp/apache-tomcat-9.0.106/webapps/csp/WEB-INF/lib/client-collect-api-0.3.28.0.jar!/logback.xml] 10:41:12,574 |-WARN in ch.qos.logback.classic.LoggerContext[default] - Resource [logback.xml] occurs at [file:/home/csp/apache-tomcat-9.0.106/webapps/csp/WEB-INF/classes/logback.xml] 10:41:12,608 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - debug attribute not set 10:41:12,614 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [ch.qos.logback.core.rolling.RollingFileAppender] 10:41:12,618 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [FILE] 10:41:12,632 |-INFO in c.q.l.core.rolling.SizeAndTimeBasedRollingPolicy@263577281 - setting totalSizeCap to 200 GB 10:41:12,635 |-INFO in c.q.l.core.rolling.SizeAndTimeBasedRollingPolicy@263577281 - Archive files will be limited to [100 MB] each. 10:41:12,649 |-INFO in c.q.l.core.rolling.SizeAndTimeBasedRollingPolicy@263577281 - Will use gz compression 10:41:12,650 |-INFO in c.q.l.core.rolling.SizeAndTimeBasedRollingPolicy@263577281 - Will use the pattern ./logs/csp-%d{yyyy-MM-dd}.%i.log.tar for the active file 10:41:12,655 |-INFO in ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP@3e81a56b - The date pattern is 'yyyy-MM-dd' from file name pattern './logs/csp-%d{yyyy-MM-dd}.%i.log.tar.gz'. 10:41:12,655 |-INFO in ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP@3e81a56b - Roll-over at midnight. 10:41:12,655 |-INFO in ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP@3e81a56b - Setting initial period to Thu Jun 26 15:58:50 CST 2025 10:41:12,657 |-INFO in ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Assuming default type [ch.qos.logback.classic.encoder.PatternLayoutEncoder] for [encoder] property 10:41:12,672 |-INFO in ch.qos.logback.core.rolling.RollingFileAppender[FILE] - Active log file name: ./logs/csp.log 10:41:12,672 |-INFO in ch.qos.logback.core.rolling.RollingFileAppender[FILE] - File property is set to [./logs/csp.log] 10:41:12,673 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [ch.qos.logback.core.ConsoleAppender] 10:41:12,675 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [STDOUT] 10:41:12,675 |-INFO in ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Assuming default type [ch.qos.logback.classic.encoder.PatternLayoutEncoder] for [encoder] property 10:41:12,677 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting level of logger [org.springframework] to INFO 10:41:12,677 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting level of logger [springfox.documentation] to ERROR 10:41:12,677 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting level of logger [org.quartz] to ERROR 10:41:12,677 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting level of logger [org.mybatis] to ERROR 10:41:12,677 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting level of logger [org.pbccrc] to ERROR 10:41:12,677 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting level of logger [com.sine] to DEBUG 10:41:12,677 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting level of logger [com.sine.csp.validate.utils] to DEBUG 10:41:12,677 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting level of logger [com.sine.csp.common.dao] to ERROR 10:41:12,677 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting level of logger [com.sine.csp.serviceresult.dao] to ERROR 10:41:12,677 |-INFO in ch.qos.logback.classic.joran.action.RootLoggerAction - Setting level of ROOT logger to INFO 10:41:12,677 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [STDOUT] to Logger[ROOT] 10:41:12,678 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - End of configuration. 10:41:12,685 |-INFO in ch.qos.logback.classic.joran.JoranConfigurator@4bc614fc - Registering current configuration as safe fallback point . ____ _ __ _ _ /\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \ ( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \ \\/ ___)| |_)| | | | | || (_| | ) ) ) ) ' |____| .__|_| |_|_| |_\__, | / / / / =========|_|==============|___/=/_/_/_/ :: Spring Boot :: (v2.7.18) 2025-06-30 10:41:13.285 [background-preinit] INFO org.hibernate.validator.internal.util.Version - HV000001: Hibernate Validator 6.2.5.Final 2025-06-30 10:41:13.307 [main] INFO com.sine.Application - Starting Application v1.0.35-SNAPSHOT using Java 1.8.0_44 on localhost with PID 92930 (/home/csp/apache-tomcat-9.0.106/webapps/csp/WEB-INF/classes started by root in /home/csp/apache-tomcat-9.0.106/bin) 2025-06-30 10:41:13.308 [main] DEBUG com.sine.Application - Running with Spring Boot v2.7.18, Spring v5.3.39 2025-06-30 10:41:13.308 [main] INFO com.sine.Application - The following 1 profile is active: "dev" 2025-06-30 10:41:14.873 [main] INFO org.springframework.data.repository.config.RepositoryConfigurationDelegate - Multiple Spring Data modules found, entering strict repository configuration mode 2025-06-30 10:41:14.877 [main] INFO org.springframework.data.repository.config.RepositoryConfigurationDelegate - Bootstrapping Spring Data Redis repositories in DEFAULT mode. 2025-06-30 10:41:14.945 [main] INFO org.springframework.data.repository.config.RepositoryConfigurationDelegate - Finished Spring Data repository scanning in 51 ms. Found 0 Redis repository interfaces. 2025-06-30 10:41:15.963 [main] INFO org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext - Root WebApplicationContext: initialization completed in 2629 ms 2025-06-30 10:41:16.575 [main] INFO org.springframework.boot.web.servlet.RegistrationBean - Filter xssFilter was not registered (possibly already registered?) 2025-06-30 10:41:17.892 [main] INFO com.alibaba.druid.pool.DruidDataSource - {dataSource-1} inited 2025-06-30 10:41:20.438 [main] INFO org.springframework.scheduling.quartz.LocalDataSourceJobStore - Using db table-based data access locking (synchronization). 2025-06-30 10:41:20.439 [main] INFO org.springframework.scheduling.quartz.LocalDataSourceJobStore - JobStoreCMT initialized. 2025-06-30 10:41:21.526 [main] INFO org.springframework.aop.framework.CglibAopProxy - Unable to proxy interface-implementing method [public final void org.springframework.scheduling.quartz.QuartzJobBean.execute(org.quartz.JobExecutionContext) throws org.quartz.JobExecutionException] because it is marked as final: Consider using interface-based JDK proxies instead! 2025-06-30 10:41:21.528 [main] INFO org.springframework.aop.framework.CglibAopProxy - Unable to proxy interface-implementing method [public final void org.springframework.scheduling.quartz.QuartzJobBean.execute(org.quartz.JobExecutionContext) throws org.quartz.JobExecutionException] because it is marked as final: Consider using interface-based JDK proxies instead! 2025-06-30 10:41:21.531 [main] INFO org.springframework.aop.framework.CglibAopProxy - Unable to proxy interface-implementing method [public final void org.springframework.scheduling.quartz.QuartzJobBean.execute(org.quartz.JobExecutionContext) throws org.quartz.JobExecutionException] because it is marked as final: Consider using interface-based JDK proxies instead! 2025-06-30 10:41:21.829 [main] INFO org.springframework.aop.framework.CglibAopProxy - Unable to proxy interface-implementing method [public final void org.springframework.scheduling.quartz.QuartzJobBean.execute(org.quartz.JobExecutionContext) throws org.quartz.JobExecutionException] because it is marked as final: Consider using interface-based JDK proxies instead! 2025-06-30 10:41:21.839 [main] INFO org.springframework.aop.framework.CglibAopProxy - Unable to proxy interface-implementing method [public final void org.springframework.scheduling.quartz.QuartzJobBean.execute(org.quartz.JobExecutionContext) throws org.quartz.JobExecutionException] because it is marked as final: Consider using interface-based JDK proxies instead! 2025-06-30 10:41:21.843 [main] INFO org.springframework.aop.framework.CglibAopProxy - Unable to proxy interface-implementing method [public final void org.springframework.scheduling.quartz.QuartzJobBean.execute(org.quartz.JobExecutionContext) throws org.quartz.JobExecutionException] because it is marked as final: Consider using interface-based JDK proxies instead! 2025-06-30 10:41:22.696 [main] WARN org.thymeleaf.templatemode.TemplateMode - [THYMELEAF][main] Template Mode 'HTML5' is deprecated. Using Template Mode 'HTML' instead. 2025-06-30 10:41:23.124 [main] INFO org.springframework.boot.actuate.endpoint.web.EndpointLinksResolver - Exposing 0 endpoint(s) beneath base path '/actuator' 2025-06-30 10:41:23.164 [main] INFO org.springframework.scheduling.quartz.SchedulerFactoryBean - Starting Quartz Scheduler now 2025-06-30 10:41:24.144 [main] INFO com.sine.Application - Started Application in 11.303 seconds (JVM running for 16.22) 2025-06-30 10:41:24.458 [main] INFO org.springframework.boot.autoconfigure.logging.ConditionEvaluationReportLoggingListener - Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled. 2025-06-30 10:41:24.486 [main] ERROR org.springframework.boot.SpringApplication - Application run failed java.lang.IllegalStateException: Failed to execute ApplicationRunner at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:759) at org.springframework.boot.SpringApplication.lambda$callRunners$2(SpringApplication.java:746) at org.springframework.boot.SpringApplication$$Lambda$1079/1133797119.accept(Unknown Source) at java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:184) at java.util.stream.SortedOps$SizedRefSortingSink.end(SortedOps.java:352) at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:513) at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:502) at java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:151) at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:174) at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) at java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:418) at org.springframework.boot.SpringApplication.callRunners(SpringApplication.java:744) at org.springframework.boot.SpringApplication.run(SpringApplication.java:315) at org.springframework.boot.web.servlet.support.SpringBootServletInitializer.run(SpringBootServletInitializer.java:175) at org.springframework.boot.web.servlet.support.SpringBootServletInitializer.createRootApplicationContext(SpringBootServletInitializer.java:155) at org.springframework.boot.web.servlet.support.SpringBootServletInitializer.onStartup(SpringBootServletInitializer.java:97) at org.springframework.web.SpringServletContainerInitializer.onStartup(SpringServletContainerInitializer.java:174) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:4491) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:164) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:599) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:571) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:603) at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:1013) at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1861) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:76) at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:112) at org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:817) at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:468) at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1579) at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:312) at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:109) at org.apache.catalina.util.LifecycleBase.setStateInternal(LifecycleBase.java:389) at org.apache.catalina.util.LifecycleBase.setState(LifecycleBase.java:336) at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:776) at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:721) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:164) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1203) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1193) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:76) at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:134) at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:749) at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:211) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:164) at org.apache.catalina.core.StandardService.startInternal(StandardService.java:412) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:164) at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:874) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:164) at org.apache.catalina.startup.Catalina.start(Catalina.java:739) 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:497) at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:345) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:476) Caused by: org.springframework.data.redis.RedisConnectionFailureException: Unable to connect to Redis; nested exception is org.springframework.data.redis.connection.PoolException: Could not get a resource from the pool; nested exception is io.lettuce.core.RedisConnectionException: Unable to connect to 127.0.0.1:6379 at org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory$ExceptionTranslatingConnectionProvider.translateException(LettuceConnectionFactory.java:1689) at org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory$ExceptionTranslatingConnectionProvider.getConnection(LettuceConnectionFactory.java:1597) at org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory$SharedConnection.getNativeConnection(LettuceConnectionFactory.java:1383) at org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory$SharedConnection.getConnection(LettuceConnectionFactory.java:1366) at org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory.getSharedConnection(LettuceConnectionFactory.java:1093) at org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory.getConnection(LettuceConnectionFactory.java:421) at org.springframework.data.redis.core.RedisConnectionUtils.fetchConnection(RedisConnectionUtils.java:193) at org.springframework.data.redis.core.RedisConnectionUtils.doGetConnection(RedisConnectionUtils.java:144) at org.springframework.data.redis.core.RedisConnectionUtils.getConnection(RedisConnectionUtils.java:105) at org.springframework.data.redis.core.RedisTemplate.execute(RedisTemplate.java:211) at org.springframework.data.redis.core.RedisTemplate.execute(RedisTemplate.java:191) at org.springframework.data.redis.core.RedisTemplate.keys(RedisTemplate.java:896) at com.sine.csp.common.boot.RedisCleanService.run(RedisCleanService.java:27) at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:756) ... 56 common frames omitted Caused by: org.springframework.data.redis.connection.PoolException: Could not get a resource from the pool; nested exception is io.lettuce.core.RedisConnectionException: Unable to connect to 127.0.0.1:6379 at org.springframework.data.redis.connection.lettuce.LettucePoolingConnectionProvider.getConnection(LettucePoolingConnectionProvider.java:109) at org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory$ExceptionTranslatingConnectionProvider.getConnection(LettuceConnectionFactory.java:1595) ... 68 common frames omitted Caused by: io.lettuce.core.RedisConnectionException: Unable to connect to 127.0.0.1:6379 at io.lettuce.core.RedisConnectionException.create(RedisConnectionException.java:78) at io.lettuce.core.RedisConnectionException.create(RedisConnectionException.java:56) at io.lettuce.core.AbstractRedisClient.getConnection(AbstractRedisClient.java:330) at io.lettuce.core.RedisClient.connect(RedisClient.java:216) at org.springframework.data.redis.connection.lettuce.StandaloneConnectionProvider.lambda$getConnection$1(StandaloneConnectionProvider.java:115) at org.springframework.data.redis.connection.lettuce.StandaloneConnectionProvider$$Lambda$1084/1822563181.get(Unknown Source) at java.util.Optional.orElseGet(Optional.java:267) at org.springframework.data.redis.connection.lettuce.StandaloneConnectionProvider.getConnection(StandaloneConnectionProvider.java:115) at org.springframework.data.redis.connection.lettuce.LettucePoolingConnectionProvider.lambda$null$0(LettucePoolingConnectionProvider.java:97) at org.springframework.data.redis.connection.lettuce.LettucePoolingConnectionProvider$$Lambda$1082/1664936139.get(Unknown Source) at io.lettuce.core.support.ConnectionPoolSupport$RedisPooledObjectFactory.create(ConnectionPoolSupport.java:211) at io.lettuce.core.support.ConnectionPoolSupport$RedisPooledObjectFactory.create(ConnectionPoolSupport.java:201) at org.apache.commons.pool2.BasePooledObjectFactory.makeObject(BasePooledObjectFactory.java:70) at org.apache.commons.pool2.impl.GenericObjectPool.create(GenericObjectPool.java:571) at org.apache.commons.pool2.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:298) at org.apache.commons.pool2.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:223) at io.lettuce.core.support.ConnectionPoolSupport$1.borrowObject(ConnectionPoolSupport.java:122) at io.lettuce.core.support.ConnectionPoolSupport$1.borrowObject(ConnectionPoolSupport.java:117) at org.springframework.data.redis.connection.lettuce.LettucePoolingConnectionProvider.getConnection(LettucePoolingConnectionProvider.java:103) ... 69 common frames omitted Caused by: io.lettuce.core.RedisCommandExecutionException: NOAUTH HELLO must be called with the client already authenticated, otherwise the HELLO AUTH <user> <pass> option can be used to authenticate the client and select the RESP protocol version at the same time at io.lettuce.core.internal.ExceptionFactory.createExecutionException(ExceptionFactory.java:147) at io.lettuce.core.internal.ExceptionFactory.createExecutionException(ExceptionFactory.java:116) at io.lettuce.core.protocol.AsyncCommand.completeResult(AsyncCommand.java:120) at io.lettuce.core.protocol.AsyncCommand.complete(AsyncCommand.java:111) at io.lettuce.core.protocol.CommandWrapper.complete(CommandWrapper.java:63) at io.lettuce.core.protocol.CommandHandler.complete(CommandHandler.java:747) at io.lettuce.core.protocol.CommandHandler.decode(CommandHandler.java:682) at io.lettuce.core.protocol.CommandHandler.channelRead(CommandHandler.java:599) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:442) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420) at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412) at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:440) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420) at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:919) at io.netty.channel.epoll.AbstractEpollStreamChannel$EpollStreamUnsafe.epollInReady(AbstractEpollStreamChannel.java:800) at io.netty.channel.epoll.EpollEventLoop.processReady(EpollEventLoop.java:509) at io.netty.channel.epoll.EpollEventLoop.run(EpollEventLoop.java:407) at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:997) at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74) at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) at java.lang.Thread.run(Thread.java:745) 2025-06-30 10:41:24.514 [main] INFO org.springframework.scheduling.quartz.SchedulerFactoryBean - Shutting down Quartz Scheduler 2025-06-30 10:41:25.601 [main] INFO com.alibaba.druid.pool.DruidDataSource - {dataSource-1} closing ... 2025-06-30 10:41:25.616 [main] INFO com.alibaba.druid.pool.DruidDataSource - {dataSource-1} closed 30-Jun-2025 10:41:25.621 严重 [main] org.apache.catalina.startup.HostConfig.deployWAR 部署 Web 应用程序 archive [/home/csp/apache-tomcat-9.0.106/webapps/csp.war] 时出错 java.lang.IllegalStateException: 启动子级时出错 at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:602) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:571) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:603) at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:1013) at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1861) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:76) at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:112) at org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:817) at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:468) at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1579) at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:312) at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:109) at org.apache.catalina.util.LifecycleBase.setStateInternal(LifecycleBase.java:389) at org.apache.catalina.util.LifecycleBase.setState(LifecycleBase.java:336) at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:776) at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:721) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:164) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1203) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1193) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:76) at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:134) at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:749) at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:211) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:164) at org.apache.catalina.core.StandardService.startInternal(StandardService.java:412) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:164) at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:874) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:164) at org.apache.catalina.startup.Catalina.start(Catalina.java:739) 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:497) at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:345) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:476) Caused by: org.apache.catalina.LifecycleException: 无法启动组件[StandardEngine[Catalina].StandardHost[localhost].StandardContext[/csp]] at org.apache.catalina.util.LifecycleBase.handleSubClassException(LifecycleBase.java:406) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:179) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:599) ... 37 more Caused by: java.lang.IllegalStateException: Failed to execute ApplicationRunner at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:759) at org.springframework.boot.SpringApplication.lambda$callRunners$2(SpringApplication.java:746) at org.springframework.boot.SpringApplication$$Lambda$1079/1133797119.accept(Unknown Source) at java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:184) at java.util.stream.SortedOps$SizedRefSortingSink.end(SortedOps.java:352) at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:513) at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:502) at java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:151) at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:174) at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) at java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:418) at org.springframework.boot.SpringApplication.callRunners(SpringApplication.java:744) at org.springframework.boot.SpringApplication.run(SpringApplication.java:315) at org.springframework.boot.web.servlet.support.SpringBootServletInitializer.run(SpringBootServletInitializer.java:175) at org.springframework.boot.web.servlet.support.SpringBootServletInitializer.createRootApplicationContext(SpringBootServletInitializer.java:155) at org.springframework.boot.web.servlet.support.SpringBootServletInitializer.onStartup(SpringBootServletInitializer.java:97) at org.springframework.web.SpringServletContainerInitializer.onStartup(SpringServletContainerInitializer.java:174) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:4491) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:164) ... 38 more Caused by: org.springframework.data.redis.RedisConnectionFailureException: Unable to connect to Redis; nested exception is org.springframework.data.redis.connection.PoolException: Could not get a resource from the pool; nested exception is io.lettuce.core.RedisConnectionException: Unable to connect to 127.0.0.1:6379 at org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory$ExceptionTranslatingConnectionProvider.translateException(LettuceConnectionFactory.java:1689) at org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory$ExceptionTranslatingConnectionProvider.getConnection(LettuceConnectionFactory.java:1597) at org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory$SharedConnection.getNativeConnection(LettuceConnectionFactory.java:1383) at org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory$SharedConnection.getConnection(LettuceConnectionFactory.java:1366) at org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory.getSharedConnection(LettuceConnectionFactory.java:1093) at org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory.getConnection(LettuceConnectionFactory.java:421) at org.springframework.data.redis.core.RedisConnectionUtils.fetchConnection(RedisConnectionUtils.java:193) at org.springframework.data.redis.core.RedisConnectionUtils.doGetConnection(RedisConnectionUtils.java:144) at org.springframework.data.redis.core.RedisConnectionUtils.getConnection(RedisConnectionUtils.java:105) at org.springframework.data.redis.core.RedisTemplate.execute(RedisTemplate.java:211) at org.springframework.data.redis.core.RedisTemplate.execute(RedisTemplate.java:191) at org.springframework.data.redis.core.RedisTemplate.keys(RedisTemplate.java:896) at com.sine.csp.common.boot.RedisCleanService.run(RedisCleanService.java:27) at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:756) ... 56 more Caused by: org.springframework.data.redis.connection.PoolException: Could not get a resource from the pool; nested exception is io.lettuce.core.RedisConnectionException: Unable to connect to 127.0.0.1:6379 at org.springframework.data.redis.connection.lettuce.LettucePoolingConnectionProvider.getConnection(LettucePoolingConnectionProvider.java:109) at org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory$ExceptionTranslatingConnectionProvider.getConnection(LettuceConnectionFactory.java:1595) ... 68 more Caused by: io.lettuce.core.RedisConnectionException: Unable to connect to 127.0.0.1:6379 at io.lettuce.core.RedisConnectionException.create(RedisConnectionException.java:78) at io.lettuce.core.RedisConnectionException.create(RedisConnectionException.java:56) at io.lettuce.core.AbstractRedisClient.getConnection(AbstractRedisClient.java:330) at io.lettuce.core.RedisClient.connect(RedisClient.java:216) at org.springframework.data.redis.connection.lettuce.StandaloneConnectionProvider.lambda$getConnection$1(StandaloneConnectionProvider.java:115) at org.springframework.data.redis.connection.lettuce.StandaloneConnectionProvider$$Lambda$1084/1822563181.get(Unknown Source) at java.util.Optional.orElseGet(Optional.java:267) at org.springframework.data.redis.connection.lettuce.StandaloneConnectionProvider.getConnection(StandaloneConnectionProvider.java:115) at org.springframework.data.redis.connection.lettuce.LettucePoolingConnectionProvider.lambda$null$0(LettucePoolingConnectionProvider.java:97) at org.springframework.data.redis.connection.lettuce.LettucePoolingConnectionProvider$$Lambda$1082/1664936139.get(Unknown Source) at io.lettuce.core.support.ConnectionPoolSupport$RedisPooledObjectFactory.create(ConnectionPoolSupport.java:211) at io.lettuce.core.support.ConnectionPoolSupport$RedisPooledObjectFactory.create(ConnectionPoolSupport.java:201) at org.apache.commons.pool2.BasePooledObjectFactory.makeObject(BasePooledObjectFactory.java:70) at org.apache.commons.pool2.impl.GenericObjectPool.create(GenericObjectPool.java:571) at org.apache.commons.pool2.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:298) at org.apache.commons.pool2.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:223) at io.lettuce.core.support.ConnectionPoolSupport$1.borrowObject(ConnectionPoolSupport.java:122) at io.lettuce.core.support.ConnectionPoolSupport$1.borrowObject(ConnectionPoolSupport.java:117) at org.springframework.data.redis.connection.lettuce.LettucePoolingConnectionProvider.getConnection(LettucePoolingConnectionProvider.java:103) ... 69 more Caused by: io.lettuce.core.RedisCommandExecutionException: NOAUTH HELLO must be called with the client already authenticated, otherwise the HELLO AUTH <user> <pass> option can be used to authenticate the client and select the RESP protocol version at the same time at io.lettuce.core.internal.ExceptionFactory.createExecutionException(ExceptionFactory.java:147) at io.lettuce.core.internal.ExceptionFactory.createExecutionException(ExceptionFactory.java:116) at io.lettuce.core.protocol.AsyncCommand.completeResult(AsyncCommand.java:120) at io.lettuce.core.protocol.AsyncCommand.complete(AsyncCommand.java:111) at io.lettuce.core.protocol.CommandWrapper.complete(CommandWrapper.java:63) at io.lettuce.core.protocol.CommandHandler.complete(CommandHandler.java:747) at io.lettuce.core.protocol.CommandHandler.decode(CommandHandler.java:682) at io.lettuce.core.protocol.CommandHandler.channelRead(CommandHandler.java:599) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:442) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420) at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412) at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:440) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420) at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:919) at io.netty.channel.epoll.AbstractEpollStreamChannel$EpollStreamUnsafe.epollInReady(AbstractEpollStreamChannel.java:800) at io.netty.channel.epoll.EpollEventLoop.processReady(EpollEventLoop.java:509) at io.netty.channel.epoll.EpollEventLoop.run(EpollEventLoop.java:407) at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:997) at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74) at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) at java.lang.Thread.run(Thread.java:745) 30-Jun-2025 10:41:25.637 信息 [main] org.apache.catalina.startup.HostConfig.deployWAR web应用程序存档文件[/home/csp/apache-tomcat-9.0.106/webapps/csp.war]的部署已在[17,181]ms内完成 30-Jun-2025 10:41:25.637 信息 [main] org.apache.catalina.startup.HostConfig.deployDirectory 把web 应用程序部署到目录 [/home/csp/apache-tomcat-9.0.106/webapps/ROOT] 30-Jun-2025 10:41:25.659 信息 [main] org.apache.catalina.startup.HostConfig.deployDirectory Web应用程序目录[/home/csp/apache-tomcat-9.0.106/webapps/ROOT]的部署已在[22]毫秒内完成 30-Jun-2025 10:41:25.659 信息 [main] org.apache.catalina.startup.HostConfig.deployDirectory 把web 应用程序部署到目录 [/home/csp/apache-tomcat-9.0.106/webapps/docs] 30-Jun-2025 10:41:25.672 信息 [main] org.apache.catalina.startup.HostConfig.deployDirectory Web应用程序目录[/home/csp/apache-tomcat-9.0.106/webapps/docs]的部署已在[12]毫秒内完成 30-Jun-2025 10:41:25.672 信息 [main] org.apache.catalina.startup.HostConfig.deployDirectory 把web 应用程序部署到目录 [/home/csp/apache-tomcat-9.0.106/webapps/examples] 30-Jun-2025 10:41:25.770 信息 [main] org.apache.catalina.startup.HostConfig.deployDirectory Web应用程序目录[/home/csp/apache-tomcat-9.0.106/webapps/examples]的部署已在[97]毫秒内完成 30-Jun-2025 10:41:25.770 信息 [main] org.apache.catalina.startup.HostConfig.deployDirectory 把web 应用程序部署到目录 [/home/csp/apache-tomcat-9.0.106/webapps/host-manager] 30-Jun-2025 10:41:25.782 信息 [main] org.apache.catalina.startup.HostConfig.deployDirectory Web应用程序目录[/home/csp/apache-tomcat-9.0.106/webapps/host-manager]的部署已在[12]毫秒内完成 30-Jun-2025 10:41:25.783 信息 [main] org.apache.catalina.startup.HostConfig.deployDirectory 把web 应用程序部署到目录 [/home/csp/apache-tomcat-9.0.106/webapps/manager] 30-Jun-2025 10:41:25.805 信息 [main] org.apache.catalina.startup.HostConfig.deployDirectory Web应用程序目录[/home/csp/apache-tomcat-9.0.106/webapps/manager]的部署已在[23]毫秒内完成 30-Jun-2025 10:41:25.809 信息 [main] org.apache.coyote.AbstractProtocol.start 开始协议处理句柄["http-nio-8080"] 30-Jun-2025 10:41:25.836 信息 [main] org.apache.catalina.startup.Catalina.start [17417]毫秒后服务器启动 30-Jun-2025 10:41:29.190 警告 [http-nio-8080-exec-3] org.apache.catalina.loader.WebappClassLoaderBase.clearReferencesJdbc Web应用程序 [csp] 注册了JDBC驱动程序 [com.alibaba.druid.proxy.DruidDriver],但在Web应用程序停止时无法注销它。 为防止内存泄漏,JDBC驱动程序已被强制取消注册。 30-Jun-2025 10:41:29.191 警告 [http-nio-8080-exec-3] org.apache.catalina.loader.WebappClassLoaderBase.clearReferencesJdbc Web应用程序 [csp] 注册了JDBC驱动程序 [com.mysql.cj.jdbc.Driver],但在Web应用程序停止时无法注销它。 为防止内存泄漏,JDBC驱动程序已被强制取消注册。 30-Jun-2025 10:41:29.193 警告 [http-nio-8080-exec-3] org.apache.catalina.loader.WebappClassLoaderBase.clearReferencesThreads Web应用程序[csp]似乎启动了一个名为[mysql-cj-abandoned-connection-cleanup]的线程,但未能停止它。这很可能会造成内存泄漏。线程的堆栈跟踪:[ java.lang.Object.wait(Native Method) java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:143) com.mysql.cj.jdbc.AbandonedConnectionCleanupThread.run(AbandonedConnectionCleanupThread.java:91) java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) java.lang.Thread.run(Thread.java:745)] 30-Jun-2025 10:41:29.194 严重 [http-nio-8080-exec-3] org.apache.catalina.loader.WebappClassLoaderBase.checkThreadLocalMapForLeaks web应用程序[csp]创建了一个ThreadLocal,其键类型为[org.springframework.boot.SpringBootExceptionHandler.LoggedExceptionHandlerThreadLocal](值为[org.springframework.boot.SpringBootExceptionHandler$LoggedExceptionHandlerThreadLocal@284f8fa0]),值类型为[org.springframework.boot.SpringBootExceptionHandler](值为[org.springframework.boot.SpringBootExceptionHandler@4a632f7c),但在停止web应用程序时未能将其删除。线程将随着时间的推移而更新,以尝试避免可能的内存泄漏 30-Jun-2025 10:41:29.194 严重 [http-nio-8080-exec-3] org.apache.catalina.loader.WebappClassLoaderBase.checkThreadLocalMapForLeaks web应用程序[csp]创建了一个ThreadLocal,其键类型为[java.lang.ThreadLocal](值为[java.lang.ThreadLocal@40ba36e7]),值类型为[io.netty.util.internal.InternalThreadLocalMap](值为[io.netty.util.internal.InternalThreadLocalMap@6ad179a0),但在停止web应用程序时未能将其删除。线程将随着时间的推移而更新,以尝试避免可能的内存泄漏 30-Jun-2025 10:41:29.995 信息 [mysql-cj-abandoned-connection-cleanup] org.apache.catalina.loader.WebappClassLoaderBase.checkStateForResourceLoading 非法访问:此Web应用程序实例已停止。无法加载[]。为了调试以及终止导致非法访问的线程,将抛出以下堆栈跟踪。 java.lang.IllegalStateException: 非法访问:此Web应用程序实例已停止。无法加载[]。为了调试以及终止导致非法访问的线程,将抛出以下堆栈跟踪。 at org.apache.catalina.loader.WebappClassLoaderBase.checkStateForResourceLoading(WebappClassLoaderBase.java:1374) at org.apache.catalina.loader.WebappClassLoaderBase.getResource(WebappClassLoaderBase.java:997) at com.mysql.cj.jdbc.AbandonedConnectionCleanupThread.checkThreadContextClassLoader(AbandonedConnectionCleanupThread.java:123) at com.mysql.cj.jdbc.AbandonedConnectionCleanupThread.run(AbandonedConnectionCleanupThread.java:90) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745) 30-Jun-2025 10:41:32.509 信息 [http-nio-8080-exec-3] org.apache.jasper.servlet.TldScanner.scanJars 至少有一个JAR被扫描用于TLD但尚未包含TLD。 为此记录器启用调试日志记录,以获取已扫描但未在其中找到TLD的完整JAR列表。 在扫描期间跳过不需要的JAR可以缩短启动时间和JSP编译时间。
07-01
<think>我们正在处理一个关于“Session is closed异常的问题。根据引用内容,这个异常通常发生在尝试使用一个已经被关闭的Hibernate Session时。下面我将详细解释原因并提供解决方案。 ### 异常原因分析 1. **手动关闭后重复使用**:在DAO层代码中,如果我们在第一次使用Session后调用了`close()`方法,然后再次尝试使用同一个Session,就会抛出此异常[^1][^3]。 2. **自动关闭机制**:某些配置或框架可能会自动关闭Session,例如当使用`getCurrentSession()`时,事务提交后Session会自动关闭[^3][^4]。 3. **连接泄露**:未正确关闭Session可能导致连接耗尽,但过早关闭则会导致此异常[^3]。 4. **客户端关闭连接**:在分布式系统中(如Zookeeper),客户端可能提前关闭了连接,导致服务端尝试读取数据时失败[^5]。 ### 解决方案 #### 方法1:检查Session获取方式 - 使用`openSession()`代替`getCurrentSession()`(如果当前环境不支持自动Session管理)[^4]: ```java Session session = sessionFactory.openSession(); Transaction tx = session.beginTransaction(); // 业务操作 tx.commit(); session.close(); // 需要显式关闭 ``` #### 方法2:确保作用域内Session有效 - 避免在方法内部提前关闭Session,确保在整个业务操作完成前Session处于打开状态。例如: ```java public void updateUser(User user) { Session session = sessionFactory.getCurrentSession(); // 假设由Spring管理 // 不要在此方法内调用session.close(),除非是手动打开的Session session.update(user); } ``` #### 方法3:正确释放资源 - 如果手动打开Session,必须确保在finally块中关闭: ```java Session session = sessionFactory.openSession(); try { Transaction tx = session.beginTransaction(); // 业务操作 tx.commit(); } catch (Exception e) { if (tx != null) tx.rollback(); throw e; } finally { if (session != null && session.isOpen()) { session.close(); // 确保关闭 } } ``` #### 方法4:检查框架配置 - 如果使用Spring,确保配置了`OpenSessionInViewFilter`(Web应用)或`OpenSessionInViewInterceptor`(非Web应用)来延长Session生命周期[^1]。 - 配置示例(web.xml): ```xml <filter> <filter-name>OpenSessionInViewFilter</filter-name> <filter-class>org.springframework.orm.hibernate5.support.OpenSessionInViewFilter</filter-class> </filter> <filter-mapping> <filter-name>OpenSessionInViewFilter</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> ``` #### 方法5:处理分布式会话超时 - 对于类似Zookeeper的“Session closed”问题,需检查客户端超时设置和服务端会话超时配置[^5]: - 增加`session.timeout.ms`参数(Kafka/Zookeeper客户端) - 确保网络稳定,避免客户端提前断开连接 ### 最佳实践总结 | 场景 | 推荐做法 | |------|----------| | Web应用 | 使用`OpenSessionInViewFilter`扩展Session生命周期至请求结束 | | 非Web应用 | 通过AOP管理Session(如Spring的`@Transactional`) | | 手动管理 | 严格遵循`openSession()→操作→commit()/rollback()→close()`流程 | | 分布式系统 | 调整客户端和服务端的会话超时参数 | ### 常见问题排查步骤 1. 检查Session获取方式(`openSession` vs `getCurrentSession`) 2. 确认Session关闭位置(避免多次关闭) 3. 使用日志跟踪Session生命周期 4. 验证框架配置(如Spring事务管理) 5. 检查网络和超时设置(分布式环境) 通过以上方法,可有效解决“Session is closed异常。关键在于理解Session的生命周期管理并确保资源释放的时机正确。 --- ### 相关问题 1. **如何配置Hibernate的`OpenSessionInViewFilter`?** - 在Spring Boot中可通过添加`@Bean`配置,传统Web应用需在web.xml中注册过滤器[^1] 2. **`getCurrentSession()`和`openSession()`有什么区别?** - `getCurrentSession()`绑定当前线程事务,事务结束自动关闭;`openSession()`需手动关闭且不关联线程[^4] 3. **分布式系统中如何避免客户端会话提前关闭?** - 调整心跳间隔和超时阈值(如Zookeeper的`tickTime`和`minSessionTimeout`)[^5] 4. **Spring框架下如何自动管理Hibernate Session?** - 使用`@Transactional`注解,由Spring统一管理事务和Session生命周期[^3] 5. **Hibernate Session关闭后如何延迟加载数据?** - 必须通过`OpenSessionInView`模式或DTO投影解决,否则会触发`LazyInitializationException` [^1]: 第一次使用后关闭导致第二次使用时报错 [^2]: Session内部closed标志被置为TRUE [^3]: 未手动关闭会导致内存泄露,但过早关闭会导致Session不可用 [^4]: 使用openSession()替代getCurrentSession() [^5]: 客户端关闭连接导致服务端读取失败</think>### Session is Closed 异常原因及解决方法 #### 一、异常原因分析 1. **会话提前关闭** - 在第一次使用 Session 后调用了 `close()` 方法,导致后续操作访问已关闭的会话[^1][^3] - 典型场景:DAO 层方法中手动关闭了 Session,但后续业务逻辑仍需使用该会话 2. **事务管理不当** - 事务提交后 Session 被自动关闭(使用 `getCurrentSession()` 时常见)[^4] - 跨方法调用时未正确处理会话生命周期 3. **资源释放机制触发** - Session 内部的 `closed` 标志被设置为 `TRUE`(类似析构机制)[^2] - 连接池回收或超时机制强制关闭会话 4. **客户端主动断开** - 在分布式系统中(如 Zookeeper),客户端提前关闭连接导致服务端会话失效[^5] #### 二、解决方案 ##### 方法 1:正确获取会话 ```java // 使用 openSession() 替代 getCurrentSession() Session session = this.getSessionFactory().openSession(); Transaction tx = session.beginTransaction(); try { // 业务操作 session.save(entity); tx.commit(); } catch (Exception e) { if (tx != null) tx.rollback(); throw e; } finally { if (session != null && session.isOpen()) { session.close(); // 显式关闭 } } ``` > ✅ 适用场景:需要精确控制会话生命周期的场景[^4] ##### 方法 2:延长会话生命周期 ```xml <!-- 配置 OpenSessionInViewFilter (web.xml) --> <filter> <filter-name>OpenSessionInViewFilter</filter-name> <filter-class>org.springframework.orm.hibernate5.support.OpenSessionInViewFilter</filter-class> </filter> <filter-mapping> <filter-name>OpenSessionInViewFilter</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> ``` > ✅ 作用:保持 Session 在整个 HTTP 请求周期内打开[^1] ##### 方法 3:会话状态验证 ```java if (session == null || !session.isOpen()) { session = sessionFactory.openSession(); // 重建会话 } ``` > ⚠️ 注意:需结合业务场景谨慎使用,避免连接泄露 ##### 方法 4:分布式会话处理 ```properties # Zookeeper 客户端配置(防提前断开) zookeeper.session.timeout=30000 zookeeper.connection.timeout=5000 ``` > ✅ 解决客户端主动关闭导致的 "likely client has closed socket" 问题[^5] #### 三、最佳实践 1. **会话管理原则** $$ \text{Session 生命周期} = \text{业务操作周期} + \Delta t_{\text{安全缓冲}} $$ 2. **连接池配置建议** | 参数 | 推荐值 | 作用 | |---|---|----| | `hibernate.c3p0.max_size` | 100 | 最大连接数 | | `hibernate.c3p0.timeout` | 300 | 空闲超时() | | `hibernate.c3p0.idle_test_period` | 150 | 空闲检测间隔 | 3. **事务边界控制** ```mermaid graph LR A[开始事务] --> B[业务操作] B --> C{成功?} C -->|是| D[提交事务] C -->|否| E[回滚事务] D & E --> F[释放资源] ``` #### 四、常见错误场景 1. **延迟加载陷阱** ```java // 错误示例 User user = session.get(User.class, 1L); session.close(); // 提前关闭 System.out.println(user.getOrders()); // 触发LazyInitializationException ``` 2. **跨方法传递会话** ```java // 错误示例 public void methodA() { Session session = openSession(); methodB(session); session.close(); // 方法B中可能仍需使用 } ``` --- ### 相关问题 1. **Hibernate 中 `getCurrentSession()` 和 `openSession()` 有何区别?** > `getCurrentSession()` 绑定当前线程上下文,事务结束自动关闭;`openSession()` 需手动管理生命周期[^4] 2. **如何避免延迟加载导致的 `LazyInitializationException`?** > 使用 `OpenSessionInView` 模式或通过 `JOIN FETCH` 提前加载关联数据 3. **分布式系统中如何设计会话超时机制?** > 需满足:$t_{\text{client\_timeout}} \geq 2 \times t_{\text{server\_timeout}}$ 防止客户端提前断开[^5] 4. **Spring 框架下如何自动管理 Hibernate Session?** > 通过 `@Transactional` 注解声明事务边界,Spring 自动处理会话打开/关闭 5. **连接池耗尽时会产生哪些异常?如何排查?** > 典型异常:`TimeoutException: Pool empty`,可通过监控连接使用率定位泄露点
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值