Java Springboot+mybatis:运行的时候报错,求帮忙看一下啥问题

花浅言 · 2022年10月27日 · 最后由 49875183 回复于 2022年10月27日 · 5729 次阅读

运行报错

11:12:49,234 |-INFO in ch.qos.logback.classic.LoggerContext[sv-logback] - Could NOT find resource [logback-test.xml]
11:12:49,234 |-INFO in ch.qos.logback.classic.LoggerContext[sv-logback] - Could NOT find resource [logback.groovy]
11:12:49,234 |-INFO in ch.qos.logback.classic.LoggerContext[sv-logback] - Found resource [logback.xml] at [file:/D:/me/code/trading_system_interface/InterfaceOptimize/target/classes/logback.xml]
11:12:49,281 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - debug attribute not set
11:12:49,287 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - Will scan for changes in [file:/D:/me/code/trading_system_interface/InterfaceOptimize/target/classes/logback.xml] 
11:12:49,287 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - Setting ReconfigureOnChangeTask scanning period to 10 seconds
11:12:49,288 |-INFO in ch.qos.logback.classic.joran.action.ContextNameAction - Setting logger context name as [sv-logback]
11:12:49,290 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [ch.qos.logback.core.ConsoleAppender]
11:12:49,292 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [CONSOLE]
11:12:49,330 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [ch.qos.logback.core.rolling.RollingFileAppender]
11:12:49,331 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [INFO_FILE]
11:12:49,341 |-INFO in c.q.l.core.rolling.TimeBasedRollingPolicy@1273765644 - No compression will be used
11:12:49,342 |-INFO in c.q.l.core.rolling.TimeBasedRollingPolicy@1273765644 - Will use the pattern ../logs/sv/info/log-info-%d{yyyy-MM-dd}.%i.log for the active file
11:12:49,345 |-INFO in ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP@29ca901e - The date pattern is 'yyyy-MM-dd' from file name pattern '../logs/sv/info/log-info-%d{yyyy-MM-dd}.%i.log'.
11:12:49,345 |-INFO in ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP@29ca901e - Roll-over at midnight.
11:12:49,348 |-INFO in ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP@29ca901e - Setting initial period to Thu Oct 27 10:56:43 CST 2022
11:12:49,348 |-WARN in ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP@29ca901e - SizeAndTimeBasedFNATP is deprecated. Use SizeAndTimeBasedRollingPolicy instead
11:12:49,348 |-WARN in ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP@29ca901e - For more information see http://logback.qos.ch/manual/appenders.html#SizeAndTimeBasedRollingPolicy
11:12:49,354 |-INFO in ch.qos.logback.core.rolling.RollingFileAppender[INFO_FILE] - Active log file name: ../logs/sv/log_info.log
11:12:49,354 |-INFO in ch.qos.logback.core.rolling.RollingFileAppender[INFO_FILE] - File property is set to [../logs/sv/log_info.log]
11:12:49,355 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [ch.qos.logback.core.rolling.RollingFileAppender]
11:12:49,355 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [ERROR_FILE]
11:12:49,357 |-INFO in c.q.l.core.rolling.TimeBasedRollingPolicy@1447689627 - No compression will be used
11:12:49,357 |-INFO in c.q.l.core.rolling.TimeBasedRollingPolicy@1447689627 - Will use the pattern ../logs/sv/error/log-error-%d{yyyy-MM-dd}.%i.log for the active file
11:12:49,357 |-INFO in ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP@6adede5 - The date pattern is 'yyyy-MM-dd' from file name pattern '../logs/sv/error/log-error-%d{yyyy-MM-dd}.%i.log'.
11:12:49,357 |-INFO in ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP@6adede5 - Roll-over at midnight.
11:12:49,358 |-INFO in ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP@6adede5 - Setting initial period to Thu Oct 27 10:56:45 CST 2022
11:12:49,358 |-WARN in ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP@6adede5 - SizeAndTimeBasedFNATP is deprecated. Use SizeAndTimeBasedRollingPolicy instead
11:12:49,358 |-WARN in ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP@6adede5 - For more information see http://logback.qos.ch/manual/appenders.html#SizeAndTimeBasedRollingPolicy
11:12:49,359 |-INFO in ch.qos.logback.core.rolling.RollingFileAppender[ERROR_FILE] - Active log file name: ../logs/sv/log_error.log
11:12:49,359 |-INFO in ch.qos.logback.core.rolling.RollingFileAppender[ERROR_FILE] - File property is set to [../logs/sv/log_error.log]
11:12:49,359 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting level of logger [org.hibernate.SQL] to DEBUG
11:12:49,360 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting additivity of logger [org.hibernate.SQL] to false
11:12:49,360 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [INFO_FILE] to Logger[org.hibernate.SQL]
11:12:49,360 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [CONSOLE] to Logger[org.hibernate.SQL]
11:12:49,360 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting level of logger [org.hibernate.type.descriptor.sql.BasicBinder] to TRACE
11:12:49,360 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting additivity of logger [org.hibernate.type.descriptor.sql.BasicBinder] to false
11:12:49,360 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [INFO_FILE] to Logger[org.hibernate.type.descriptor.sql.BasicBinder]
11:12:49,360 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [CONSOLE] to Logger[org.hibernate.type.descriptor.sql.BasicBinder]
11:12:49,360 |-INFO in ch.qos.logback.classic.joran.action.RootLoggerAction - Setting level of ROOT logger to INFO
11:12:49,360 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [CONSOLE] to Logger[ROOT]
11:12:49,360 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [INFO_FILE] to Logger[ROOT]
11:12:49,360 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [ERROR_FILE] to Logger[ROOT]
11:12:49,360 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting level of logger [com.alibaba.nacos.client] to OFF
11:12:49,360 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - End of configuration.
11:12:49,361 |-INFO in ch.qos.logback.classic.joran.JoranConfigurator@2d928643 - Registering current configuration as safe fallback point


  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::                (v2.5.6)

2022-10-27 11:12:49 [main] INFO  com.course.Application - (Starting Application using Java 1.8.0_202 on LAPTOP-52L2UDTT with PID 32564 (D:\me\code\trading_system_interface\InterfaceOptimize\target\classes started by DD in D:\me\code\trading_system_interface)
2022-10-27 11:12:49 [main] INFO  com.course.Application - (No active profile set, falling back to default profiles: default
2022-10-27 11:12:50 [main] WARN  o.m.s.mapper.ClassPathMapperScanner - (No MyBatis mapper was found in '[com.course]' package. Please check your configuration.
2022-10-27 11:12:50 [main] ERROR o.s.boot.SpringApplication - (Application run failed
java.lang.IllegalStateException: Error processing condition on org.springframework.boot.autoconfigure.web.client.RestTemplateAutoConfiguration.restTemplateBuilderConfigurer
    at org.springframework.boot.autoconfigure.condition.SpringBootCondition.matches(SpringBootCondition.java:60)
    at org.springframework.context.annotation.ConditionEvaluator.shouldSkip(ConditionEvaluator.java:108)
    at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitionsForBeanMethod(ConfigurationClassBeanDefinitionReader.java:193)
    at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitionsForConfigurationClass(ConfigurationClassBeanDefinitionReader.java:153)
    at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitions(ConfigurationClassBeanDefinitionReader.java:129)
    at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:343)
    at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:247)
    at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProcessors(PostProcessorRegistrationDelegate.java:311)
    at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:112)
    at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:746)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:564)
    at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:145)
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:754)
    at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:434)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:338)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1343)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1332)
    at com.course.Application.main(Application.java:24)
Caused by: java.lang.IllegalStateException: Failed to introspect Class [org.springframework.boot.autoconfigure.transaction.TransactionAutoConfiguration] from ClassLoader [sun.misc.Launcher$AppClassLoader@18b4aac2]
    at org.springframework.util.ReflectionUtils.getDeclaredMethods(ReflectionUtils.java:481)
    at org.springframework.util.ReflectionUtils.doWithMethods(ReflectionUtils.java:358)
    at org.springframework.util.ReflectionUtils.getUniqueDeclaredMethods(ReflectionUtils.java:414)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.lambda$getTypeForFactoryMethod$2(AbstractAutowireCapableBeanFactory.java:765)
    at java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1660)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.getTypeForFactoryMethod(AbstractAutowireCapableBeanFactory.java:764)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.determineTargetType(AbstractAutowireCapableBeanFactory.java:703)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.predictBeanType(AbstractAutowireCapableBeanFactory.java:674)
    at org.springframework.beans.factory.support.AbstractBeanFactory.isFactoryBean(AbstractBeanFactory.java:1670)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.doGetBeanNamesForType(DefaultListableBeanFactory.java:570)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanNamesForType(DefaultListableBeanFactory.java:542)
    at org.springframework.boot.autoconfigure.condition.OnBeanCondition.collectBeanNamesForType(OnBeanCondition.java:238)
    at org.springframework.boot.autoconfigure.condition.OnBeanCondition.getBeanNamesForType(OnBeanCondition.java:231)
    at org.springframework.boot.autoconfigure.condition.OnBeanCondition.getBeanNamesForType(OnBeanCondition.java:221)
    at org.springframework.boot.autoconfigure.condition.OnBeanCondition.getMatchingBeans(OnBeanCondition.java:169)
    at org.springframework.boot.autoconfigure.condition.OnBeanCondition.getMatchOutcome(OnBeanCondition.java:144)
    at org.springframework.boot.autoconfigure.condition.SpringBootCondition.matches(SpringBootCondition.java:47)
    ... 17 common frames omitted
Caused by: java.lang.NoClassDefFoundError: org/springframework/transaction/ReactiveTransactionManager
    at java.lang.Class.getDeclaredMethods0(Native Method)
    at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
    at java.lang.Class.getDeclaredMethods(Class.java:1975)
    at org.springframework.util.ReflectionUtils.getDeclaredMethods(ReflectionUtils.java:463)
    ... 33 common frames omitted
Caused by: java.lang.ClassNotFoundException: org.springframework.transaction.ReactiveTransactionManager
    at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    ... 37 common frames omitted
2022-10-27 11:12:50 [main] WARN  o.s.boot.SpringApplication - (Unable to close ApplicationContext
java.lang.IllegalStateException: Failed to introspect Class [org.springframework.boot.autoconfigure.transaction.TransactionAutoConfiguration] from ClassLoader [sun.misc.Launcher$AppClassLoader@18b4aac2]
    at org.springframework.util.ReflectionUtils.getDeclaredMethods(ReflectionUtils.java:481)
    at org.springframework.util.ReflectionUtils.doWithMethods(ReflectionUtils.java:358)
    at org.springframework.util.ReflectionUtils.getUniqueDeclaredMethods(ReflectionUtils.java:414)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.lambda$getTypeForFactoryMethod$2(AbstractAutowireCapableBeanFactory.java:765)
    at java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1660)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.getTypeForFactoryMethod(AbstractAutowireCapableBeanFactory.java:764)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.determineTargetType(AbstractAutowireCapableBeanFactory.java:703)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.predictBeanType(AbstractAutowireCapableBeanFactory.java:674)
    at org.springframework.beans.factory.support.AbstractBeanFactory.isFactoryBean(AbstractBeanFactory.java:1670)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.doGetBeanNamesForType(DefaultListableBeanFactory.java:570)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanNamesForType(DefaultListableBeanFactory.java:542)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeansOfType(DefaultListableBeanFactory.java:667)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeansOfType(DefaultListableBeanFactory.java:659)
    at org.springframework.context.support.AbstractApplicationContext.getBeansOfType(AbstractApplicationContext.java:1300)
    at org.springframework.boot.SpringApplication.getExitCodeFromMappedException(SpringApplication.java:886)
    at org.springframework.boot.SpringApplication.getExitCodeFromException(SpringApplication.java:874)
    at org.springframework.boot.SpringApplication.handleExitCode(SpringApplication.java:861)
    at org.springframework.boot.SpringApplication.handleRunFailure(SpringApplication.java:802)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:348)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1343)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1332)
    at com.course.Application.main(Application.java:24)
Caused by: java.lang.NoClassDefFoundError: org/springframework/transaction/ReactiveTransactionManager
    at java.lang.Class.getDeclaredMethods0(Native Method)
    at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
    at java.lang.Class.getDeclaredMethods(Class.java:1975)
    at org.springframework.util.ReflectionUtils.getDeclaredMethods(ReflectionUtils.java:463)
    ... 21 common frames omitted
Caused by: java.lang.ClassNotFoundException: org.springframework.transaction.ReactiveTransactionManager
    at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    ... 25 common frames omitted
共收到 6 条回复 时间 点赞

java.lang.ClassNotFoundException: org.springframework.transaction.ReactiveTransactionManager

添加 spring-boot-starter-jdbc 依赖

添加完后

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-jdbc</artifactId>
    <version>2.3.0.RELEASE</version>
</dependency>

还是报上面那个错误

mybatis-spring-boot-starter 这个有嘛?升下版本试试?

jar 包有冲突吧?排除下

<dependencies>

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.7.4</version>
        <type>pom</type>
    </dependency>

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
    </dependency>

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-jdbc</artifactId>
        <version>2.3.0.RELEASE</version>
    </dependency>

    <dependency>
        <groupId>io.springfox</groupId>
        <artifactId>springfox-swagger-ui</artifactId>
        <version>2.7.0</version>
    </dependency>

    <dependency>
        <groupId>io.springfox</groupId>
        <artifactId>springfox-swagger2</artifactId>
        <version>2.7.0</version>
    </dependency>

    <dependency>
        <groupId>org.projectlombok</groupId>
        <artifactId>lombok</artifactId>
        <version>1.18.22</version>
    </dependency>

    <dependency>
        <groupId>com.alibaba.fastjson2</groupId>
        <artifactId>fastjson2</artifactId>
        <version>2.0.15</version>
    </dependency>

    <dependency>
        <groupId>mysql</groupId>
        <artifactId>mysql-connector-java</artifactId>
    </dependency>

    <dependency>
        <groupId>org.mybatis.spring.boot</groupId>
        <artifactId>mybatis-spring-boot-starter</artifactId>
        <version>2.1.3</version>
    </dependency>

</dependencies>

这是我的依赖项,还专门处理过版本


看下依赖包关系试试?

花浅言 关闭了讨论 02月08日 16:29
需要 登录 后方可回复, 如果你还没有账号请点击这里 注册