0
通过异常(数据库连接失败等)打印出的堆栈,可以看出创建bean的关键函数
"D:\Program Files\Java\jdk1.8.0_144\bin\java.exe" -agentlib:jdwp=transport=dt_socket,address=127.0.0.1:53093,suspend=y,server=n -javaagent:C:\Users\shen\AppData\Local\Temp\captureAgent59628jars\debugger-agent.jar -Dfile.encoding=UTF-8 -classpath "D:\Program Files\Java\jdk1.8.0_144\jre\lib\charsets.jar;D:\Program Files\Java\jdk1.8.0_144\jre\lib\deploy.jar;D:\Program Files\Java\jdk1.8.0_144\jre\lib\ext\access-bridge-64.jar;D:\Program Files\Java\jdk1.8.0_144\jre\lib\ext\cldrdata.jar;D:\Program Files\Java\jdk1.8.0_144\jre\lib\ext\dnsns.jar;D:\Program Files\Java\jdk1.8.0_144\jre\lib\ext\jaccess.jar;D:\Program Files\Java\jdk1.8.0_144\jre\lib\ext\jfxrt.jar;D:\Program Files\Java\jdk1.8.0_144\jre\lib\ext\localedata.jar;D:\Program Files\Java\jdk1.8.0_144\jre\lib\ext\nashorn.jar;D:\Program Files\Java\jdk1.8.0_144\jre\lib\ext\sunec.jar;D:\Program Files\Java\jdk1.8.0_144\jre\lib\ext\sunjce_provider.jar;D:\Program Files\Java\jdk1.8.0_144\jre\lib\ext\sunmscapi.jar;D:\Program Files\Java\jdk1.8.0_144\jre\lib\ext\sunpkcs11.jar;D:\Program Files\Java\jdk1.8.0_144\jre\lib\ext\zipfs.jar;D:\Program Files\Java\jdk1.8.0_144\jre\lib\javaws.jar;D:\Program Files\Java\jdk1.8.0_144\jre\lib\jce.jar;D:\Program Files\Java\jdk1.8.0_144\jre\lib\jfr.jar;D:\Program Files\Java\jdk1.8.0_144\jre\lib\jfxswt.jar;D:\Program Files\Java\jdk1.8.0_144\jre\lib\jsse.jar;D:\Program Files\Java\jdk1.8.0_144\jre\lib\management-agent.jar;D:\Program Files\Java\jdk1.8.0_144\jre\lib\plugin.jar;D:\Program Files\Java\jdk1.8.0_144\jre\lib\resources.jar;D:\Program Files\Java\jdk1.8.0_144\jre\lib\rt.jar;D:\shen\java\webdevelop\spring\log2\target\classes;D:\shen\java\.m2\repos\org\flywaydb\flyway-core\6.2.3\flyway-core-6.2.3.jar;D:\shen\java\.m2\repos\org\springframework\boot\spring-boot-starter-validation\2.3.0.M2\spring-boot-starter-validation-2.3.0.M2.jar;D:\shen\java\.m2\repos\org\springframework\boot\spring-boot-starter\2.3.0.M2\spring-boot-starter-2.3.0.M2.jar;D:\shen\java\.m2\repos\org\springframework\boot\spring-boot\2.3.0.M2\spring-boot-2.3.0.M2.jar;D:\shen\java\.m2\repos\org\springframework\boot\spring-boot-starter-logging\2.3.0.M2\spring-boot-starter-logging-2.3.0.M2.jar;D:\shen\java\.m2\repos\ch\qos\logback\logback-classic\1.2.3\logback-classic-1.2.3.jar;D:\shen\java\.m2\repos\ch\qos\logback\logback-core\1.2.3\logback-core-1.2.3.jar;D:\shen\java\.m2\repos\org\apache\logging\log4j\log4j-to-slf4j\2.13.0\log4j-to-slf4j-2.13.0.jar;D:\shen\java\.m2\repos\org\apache\logging\log4j\log4j-api\2.13.0\log4j-api-2.13.0.jar;D:\shen\java\.m2\repos\org\slf4j\jul-to-slf4j\1.7.30\jul-to-slf4j-1.7.30.jar;D:\shen\java\.m2\repos\jakarta\annotation\jakarta.annotation-api\1.3.5\jakarta.annotation-api-1.3.5.jar;D:\shen\java\.m2\repos\org\yaml\snakeyaml\1.25\snakeyaml-1.25.jar;D:\shen\java\.m2\repos\org\glassfish\jakarta.el\3.0.3\jakarta.el-3.0.3.jar;D:\shen\java\.m2\repos\org\hibernate\validator\hibernate-validator\6.1.2.Final\hibernate-validator-6.1.2.Final.jar;D:\shen\java\.m2\repos\jakarta\validation\jakarta.validation-api\2.0.2\jakarta.validation-api-2.0.2.jar;D:\shen\java\.m2\repos\org\jboss\logging\jboss-logging\3.4.1.Final\jboss-logging-3.4.1.Final.jar;D:\shen\java\.m2\repos\com\fasterxml\classmate\1.5.1\classmate-1.5.1.jar;D:\shen\java\.m2\repos\org\springframework\boot\spring-boot-starter-data-jpa\2.3.0.M2\spring-boot-starter-data-jpa-2.3.0.M2.jar;D:\shen\java\.m2\repos\org\springframework\boot\spring-boot-starter-aop\2.3.0.M2\spring-boot-starter-aop-2.3.0.M2.jar;D:\shen\java\.m2\repos\org\springframework\spring-aop\5.2.3.RELEASE\spring-aop-5.2.3.RELEASE.jar;D:\shen\java\.m2\repos\org\aspectj\aspectjweaver\1.9.5\aspectjweaver-1.9.5.jar;D:\shen\java\.m2\repos\jakarta\transaction\jakarta.transaction-api\1.3.3\jakarta.transaction-api-1.3.3.jar;D:\shen\java\.m2\repos\jakarta\persistence\jakarta.persistence-api\2.2.3\jakarta.persistence-api-2.2.3.jar;D:\shen\java\.m2\repos\org\hibernate\hibernate-core\5.4.11.Final\hibernate-core-5.4.11.Final.jar;D:\shen\java\.m2\repos\org\javassist\javassist\3.24.0-GA\javassist-3.24.0-GA.jar;D:\shen\java\.m2\repos\net\bytebuddy\byte-buddy\1.10.7\byte-buddy-1.10.7.jar;D:\shen\java\.m2\repos\antlr\antlr\2.7.7\antlr-2.7.7.jar;D:\shen\java\.m2\repos\org\jboss\jandex\2.1.1.Final\jandex-2.1.1.Final.jar;D:\shen\java\.m2\repos\org\dom4j\dom4j\2.1.1\dom4j-2.1.1.jar;D:\shen\java\.m2\repos\org\hibernate\common\hibernate-commons-annotations\5.1.0.Final\hibernate-commons-annotations-5.1.0.Final.jar;D:\shen\java\.m2\repos\org\glassfish\jaxb\jaxb-runtime\2.3.2\jaxb-runtime-2.3.2.jar;D:\shen\java\.m2\repos\org\glassfish\jaxb\txw2\2.3.2\txw2-2.3.2.jar;D:\shen\java\.m2\repos\com\sun\istack\istack-commons-runtime\3.0.8\istack-commons-runtime-3.0.8.jar;D:\shen\java\.m2\repos\org\jvnet\staxex\stax-ex\1.8.1\stax-ex-1.8.1.jar;D:\shen\java\.m2\repos\com\sun\xml\fastinfoset\FastInfoset\1.2.16\FastInfoset-1.2.16.jar;D:\shen\java\.m2\repos\org\springframework\data\spring-data-jpa\2.3.0.M3\spring-data-jpa-2.3.0.M3.jar;D:\shen\java\.m2\repos\org\springframework\data\spring-data-commons\2.3.0.M3\spring-data-commons-2.3.0.M3.jar;D:\shen\java\.m2\repos\org\springframework\spring-orm\5.2.3.RELEASE\spring-orm-5.2.3.RELEASE.jar;D:\shen\java\.m2\repos\org\springframework\spring-context\5.2.3.RELEASE\spring-context-5.2.3.RELEASE.jar;D:\shen\java\.m2\repos\org\springframework\spring-tx\5.2.3.RELEASE\spring-tx-5.2.3.RELEASE.jar;D:\shen\java\.m2\repos\org\springframework\spring-beans\5.2.3.RELEASE\spring-beans-5.2.3.RELEASE.jar;D:\shen\java\.m2\repos\org\slf4j\slf4j-api\1.7.30\slf4j-api-1.7.30.jar;D:\shen\java\.m2\repos\org\springframework\spring-aspects\5.2.3.RELEASE\spring-aspects-5.2.3.RELEASE.jar;D:\shen\java\.m2\repos\com\baomidou\mybatis-plus-boot-starter\3.3.1\mybatis-plus-boot-starter-3.3.1.jar;D:\shen\java\.m2\repos\com\baomidou\mybatis-plus\3.3.1\mybatis-plus-3.3.1.jar;D:\shen\java\.m2\repos\com\baomidou\mybatis-plus-extension\3.3.1\mybatis-plus-extension-3.3.1.jar;D:\shen\java\.m2\repos\com\baomidou\mybatis-plus-core\3.3.1\mybatis-plus-core-3.3.1.jar;D:\shen\java\.m2\repos\com\baomidou\mybatis-plus-annotation\3.3.1\mybatis-plus-annotation-3.3.1.jar;D:\shen\java\.m2\repos\com\github\jsqlparser\jsqlparser\3.1\jsqlparser-3.1.jar;D:\shen\java\.m2\repos\org\mybatis\mybatis\3.5.3\mybatis-3.5.3.jar;D:\shen\java\.m2\repos\org\mybatis\mybatis-spring\2.0.3\mybatis-spring-2.0.3.jar;D:\shen\java\.m2\repos\org\springframework\boot\spring-boot-autoconfigure\2.3.0.M2\spring-boot-autoconfigure-2.3.0.M2.jar;D:\shen\java\.m2\repos\org\projectlombok\lombok\1.18.12\lombok-1.18.12.jar;D:\shen\java\.m2\repos\mysql\mysql-connector-java\8.0.19\mysql-connector-java-8.0.19.jar;D:\shen\java\.m2\repos\org\springframework\boot\spring-boot-starter-jdbc\2.3.0.M2\spring-boot-starter-jdbc-2.3.0.M2.jar;D:\shen\java\.m2\repos\com\zaxxer\HikariCP\3.4.2\HikariCP-3.4.2.jar;D:\shen\java\.m2\repos\org\springframework\spring-jdbc\5.2.3.RELEASE\spring-jdbc-5.2.3.RELEASE.jar;D:\shen\java\.m2\repos\org\apache\commons\commons-dbcp2\2.7.0\commons-dbcp2-2.7.0.jar;D:\shen\java\.m2\repos\org\apache\commons\commons-pool2\2.8.0\commons-pool2-2.8.0.jar;D:\shen\java\.m2\repos\org\springframework\boot\spring-boot-starter-actuator\2.3.0.M2\spring-boot-starter-actuator-2.3.0.M2.jar;D:\shen\java\.m2\repos\org\springframework\boot\spring-boot-actuator-autoconfigure\2.3.0.M2\spring-boot-actuator-autoconfigure-2.3.0.M2.jar;D:\shen\java\.m2\repos\org\springframework\boot\spring-boot-actuator\2.3.0.M2\spring-boot-actuator-2.3.0.M2.jar;D:\shen\java\.m2\repos\com\fasterxml\jackson\core\jackson-databind\2.10.1\jackson-databind-2.10.1.jar;D:\shen\java\.m2\repos\com\fasterxml\jackson\core\jackson-annotations\2.10.1\jackson-annotations-2.10.1.jar;D:\shen\java\.m2\repos\com\fasterxml\jackson\core\jackson-core\2.10.1\jackson-core-2.10.1.jar;D:\shen\java\.m2\repos\com\fasterxml\jackson\datatype\jackson-datatype-jsr310\2.10.1\jackson-datatype-jsr310-2.10.1.jar;D:\shen\java\.m2\repos\io\micrometer\micrometer-core\1.3.5\micrometer-core-1.3.5.jar;D:\shen\java\.m2\repos\org\hdrhistogram\HdrHistogram\2.1.11\HdrHistogram-2.1.11.jar;D:\shen\java\.m2\repos\org\latencyutils\LatencyUtils\2.0.3\LatencyUtils-2.0.3.jar;D:\shen\java\.m2\repos\org\springframework\boot\spring-boot-starter-web\2.3.0.M2\spring-boot-starter-web-2.3.0.M2.jar;D:\shen\java\.m2\repos\org\springframework\boot\spring-boot-starter-json\2.3.0.M2\spring-boot-starter-json-2.3.0.M2.jar;D:\shen\java\.m2\repos\com\fasterxml\jackson\datatype\jackson-datatype-jdk8\2.10.1\jackson-datatype-jdk8-2.10.1.jar;D:\shen\java\.m2\repos\com\fasterxml\jackson\module\jackson-module-parameter-names\2.10.1\jackson-module-parameter-names-2.10.1.jar;D:\shen\java\.m2\repos\org\springframework\boot\spring-boot-starter-tomcat\2.3.0.M2\spring-boot-starter-tomcat-2.3.0.M2.jar;D:\shen\java\.m2\repos\org\apache\tomcat\embed\tomcat-embed-core\9.0.31\tomcat-embed-core-9.0.31.jar;D:\shen\java\.m2\repos\org\apache\tomcat\embed\tomcat-embed-websocket\9.0.31\tomcat-embed-websocket-9.0.31.jar;D:\shen\java\.m2\repos\org\springframework\spring-web\5.2.3.RELEASE\spring-web-5.2.3.RELEASE.jar;D:\shen\java\.m2\repos\org\springframework\spring-webmvc\5.2.3.RELEASE\spring-webmvc-5.2.3.RELEASE.jar;D:\shen\java\.m2\repos\org\springframework\spring-expression\5.2.3.RELEASE\spring-expression-5.2.3.RELEASE.jar;D:\shen\java\.m2\repos\jakarta\xml\bind\jakarta.xml.bind-api\2.3.2\jakarta.xml.bind-api-2.3.2.jar;D:\shen\java\.m2\repos\jakarta\activation\jakarta.activation-api\1.2.1\jakarta.activation-api-1.2.1.jar;D:\shen\java\.m2\repos\org\springframework\spring-core\5.2.3.RELEASE\spring-core-5.2.3.RELEASE.jar;D:\shen\java\.m2\repos\org\springframework\spring-jcl\5.2.3.RELEASE\spring-jcl-5.2.3.RELEASE.jar;D:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2019.3.1\lib\idea_rt.jar" ik.starriver.log.LogApplication
Connected to the target VM, address: '127.0.0.1:53093', transport: 'socket'
:: StarRiver :: (v0.0.1)
:: Spring Boot :: (v2.3.0.M2)
2020-04-30 20:31:14.892 [ INFO] [main] ik.starriver.log.LogApplication:55 : Starting LogApplication on DESKTOP-NR5O5ND with PID 1452 (D:\shen\java\webdevelop\spring\log2\target\classes started by shen in D:\shen\java\webdevelop\spring\log2)
2020-04-30 20:31:14.898 [DEBUG] [main] ik.starriver.log.LogApplication:56 : Running with Spring Boot v2.3.0.M2, Spring v5.2.3.RELEASE
2020-04-30 20:31:14.900 [ INFO] [main] ik.starriver.log.LogApplication:651 : No active profile set, falling back to default profiles: default
2020-04-30 20:31:17.433 [ INFO] [main] org.springframework.data.repository.config.RepositoryConfigurationDelegate:127 : Bootstrapping Spring Data JPA repositories in DEFERRED mode.
2020-04-30 20:31:17.493 [ INFO] [main] org.springframework.data.repository.config.RepositoryConfigurationDelegate:187 : Finished Spring Data repository scanning in 41ms. Found 0 JPA repository interfaces.
2020-04-30 20:31:17.660 [ WARN] [main] org.mybatis.spring.mapper.ClassPathMapperScanner:44 : No MyBatis mapper was found in '[ik.starriver.log]' package. Please check your configuration.
2020-04-30 20:31:17.667 [ WARN] [main] org.mybatis.spring.mapper.ClassPathMapperScanner:44 : Skipping MapperFactoryBean with name 'eventMapper' and 'ik.starriver.log.mapper.EventMapper' mapperInterface. Bean already defined with the same name!
2020-04-30 20:31:17.668 [ WARN] [main] org.mybatis.spring.mapper.ClassPathMapperScanner:44 : No MyBatis mapper was found in '[ik.starriver.log.mapper*]' package. Please check your configuration.
2020-04-30 20:31:18.343 [ INFO] [main] org.springframework.context.support.PostProcessorRegistrationDelegate$BeanPostProcessorChecker:330 : Bean 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration' of type [org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2020-04-30 20:31:20.241 [ INFO] [main] org.springframework.boot.web.embedded.tomcat.TomcatWebServer:92 : Tomcat initialized with port(s): 9000 (http)
2020-04-30 20:31:20.261 [ INFO] [main] org.apache.coyote.http11.Http11NioProtocol:173 : Initializing ProtocolHandler ["http-nio-9000"]
2020-04-30 20:31:20.262 [ INFO] [main] org.apache.catalina.core.StandardService:173 : Starting service [Tomcat]
2020-04-30 20:31:20.262 [ INFO] [main] org.apache.catalina.core.StandardEngine:173 : Starting Servlet engine: [Apache Tomcat/9.0.31]
2020-04-30 20:31:20.545 [ INFO] [main] org.apache.catalina.core.ContainerBase.[Tomcat].[localhost].[/]:173 : Initializing Spring embedded WebApplicationContext
2020-04-30 20:31:20.546 [ INFO] [main] org.springframework.web.context.ContextLoader:284 : Root WebApplicationContext: initialization completed in 5455 ms
2020-04-30 20:31:21.390 [ INFO] [main] org.flywaydb.core.internal.license.VersionPrinter:49 : Flyway Community Edition 6.2.3 by Redgate
2020-04-30 20:31:42.603 [ WARN] [main] org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext:558 : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'flywayInitializer' defined in class path resource [org/springframework/boot/autoconfigure/flyway/FlywayAutoConfiguration$FlywayConfiguration.class]: Invocation of init method failed; nested exception is org.flywaydb.core.internal.exception.FlywaySqlException:
Unable to obtain connection from database (jdbc:mysql://10.1.252.23:3306/springtest?serverTimezone=UTC) for user 'root': Communications link failure
The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
SQL State : 08S01
Error Code : 0
Message : Communications link failure
The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
2020-04-30 20:31:42.619 [ INFO] [main] org.apache.catalina.core.StandardService:173 : Stopping service [Tomcat]
2020-04-30 20:31:42.638 [ INFO] [main] org.springframework.boot.autoconfigure.logging.ConditionEvaluationReportLoggingListener:136 :
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2020-04-30 20:31:42.645 [ERROR] [main] org.springframework.boot.SpringApplication:837 : Application run failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'flywayInitializer' defined in class path resource [org/springframework/boot/autoconfigure/flyway/FlywayAutoConfiguration$FlywayConfiguration.class]: Invocation of init method failed; nested exception is org.flywaydb.core.internal.exception.FlywaySqlException:
Unable to obtain connection from database (jdbc:mysql://10.1.252.23:3306/springtest?serverTimezone=UTC) for user 'root': Communications link failure
The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
SQL State : 08S01
Error Code : 0
Message : Communications link failure
The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
通过异常打印可以看到bean的初始化过程
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1796)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:595)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:517)
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:323)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:321)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:310)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)
at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1108)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:868)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:550)
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:141)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:758)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:750)
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:315)
at ik.starriver.log.LogApplication.main(LogApplication.java:30)
Caused by: org.flywaydb.core.internal.exception.FlywaySqlException:
Unable to obtain connection from database (jdbc:mysql://10.1.252.23:3306/springtest?serverTimezone=UTC) for user 'root': Communications link failure
The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
SQL State : 08S01
Error Code : 0
Message : Communications link failure
The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
at org.flywaydb.core.internal.jdbc.JdbcUtils.openConnection(JdbcUtils.java:60)
at org.flywaydb.core.internal.jdbc.JdbcConnectionFactory.(JdbcConnectionFactory.java:80)
at org.flywaydb.core.Flyway.execute(Flyway.java:447)
at org.flywaydb.core.Flyway.migrate(Flyway.java:153)
at org.springframework.boot.autoconfigure.flyway.FlywayMigrationInitializer.afterPropertiesSet(FlywayMigrationInitializer.java:65)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1855)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1792)
... 17 common frames omitted
Caused by: com.mysql.cj.jdbc.exceptions.CommunicationsException: Communications link failure
The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
at com.mysql.cj.jdbc.exceptions.SQLError.createCommunicationsException(SQLError.java:174)
at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:64)
at com.mysql.cj.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:836)
at com.mysql.cj.jdbc.ConnectionImpl.(ConnectionImpl.java:456)
at com.mysql.cj.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:246)
at com.mysql.cj.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:197)
at org.flywaydb.core.internal.jdbc.DriverDataSource.getConnectionFromDriver(DriverDataSource.java:456)
at org.flywaydb.core.internal.jdbc.DriverDataSource.getConnection(DriverDataSource.java:422)
at org.flywaydb.core.internal.jdbc.JdbcUtils.openConnection(JdbcUtils.java:56)
... 23 common frames omitted
Caused by: com.mysql.cj.exceptions.CJCommunicationsException: Communications link failure
The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:61)
at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:105)
at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:151)
at com.mysql.cj.exceptions.ExceptionFactory.createCommunicationsException(ExceptionFactory.java:167)
at com.mysql.cj.protocol.a.NativeSocketConnection.connect(NativeSocketConnection.java:91)
at com.mysql.cj.NativeSession.connect(NativeSession.java:144)
at com.mysql.cj.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:956)
at com.mysql.cj.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:826)
... 29 common frames omitted
Caused by: java.net.ConnectException: Connection timed out: connect
at java.net.DualStackPlainSocketImpl.connect0(Native Method)
at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:79)
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.net.Socket.connect(Socket.java:589)
at com.mysql.cj.protocol.StandardSocketFactory.connect(StandardSocketFactory.java:155)
at com.mysql.cj.protocol.a.NativeSocketConnection.connect(NativeSocketConnection.java:65)
... 32 common frames omitted
Disconnected from the target VM, address: '127.0.0.1:53093', transport: 'socket'
Process finished with exit code 1
分析重要的断点:
1 创建bean的位置:
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory#doCreateBean
2 参数beanName包括:
org.mybatis.spring.mapper.MapperScannerConfigurer
。。。
3 加载bean的属性
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory#invokeInitMethods
4
org.springframework.beans.BeanUtils#instantiateClass()
通过反射初始化bean