请稍等 ...
×

采纳答案成功!

向帮助你的同学说点啥吧!感谢那些助人为乐的人

将eclipse的O2Oboot项目转到IDEA中,POM引入版本导致项目运行出现问题

根据老师视频学习引入的

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

2.0.1版本的在eclipse中并没有出现问题
而导入进IDEA后,就出现了Error:(5, 37) java: 程序包org.apache.ibatis.annotations不存在的问题。
将版本更换1.1.1后程序不再报错,而启动应用出现如下错误

麻烦老师同学们帮忙看看,谢谢了

2020-06-14 15:24:28.140 [main] INFO  com.xb.o2o.O2obootApplication - Starting O2obootApplication on DESKTOP-HNHSR91 with PID 16252 (B:JAVAdemo	argetclasses started by hasee in B:JAVAdemo)
2020-06-14 15:24:28.257 [main] DEBUG com.xb.o2o.O2obootApplication - Running with Spring Boot v2.1.6.RELEASE, Spring v5.1.8.RELEASE
2020-06-14 15:24:28.266 [main] INFO  com.xb.o2o.O2obootApplication - No active profile set, falling back to default profiles: default
2020-06-14 15:24:29.751 [main] WARN  o.s.b.w.s.c.AnnotationConfigServletWebServerApplicationContext - Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'persistenceExceptionTranslationPostProcessor' defined in class path resource [org/springframework/boot/autoconfigure/dao/PersistenceExceptionTranslationAutoConfiguration.class]: Initialization of bean failed; nested exception is java.lang.IllegalStateException: No persistence exception translators found in bean factory. Cannot perform exception translation.
2020-06-14 15:24:29.760 [main] INFO  o.s.b.a.l.ConditionEvaluationReportLoggingListener - 

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2020-06-14 15:24:29.771 [main] ERROR org.springframework.boot.SpringApplication - Application run failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'persistenceExceptionTranslationPostProcessor' defined in class path resource [org/springframework/boot/autoconfigure/dao/PersistenceExceptionTranslationAutoConfiguration.class]: Initialization of bean failed; nested exception is java.lang.IllegalStateException: No persistence exception translators found in bean factory. Cannot perform exception translation.
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:601)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:515)
	at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:320)
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318)
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:204)
	at org.springframework.context.support.PostProcessorRegistrationDelegate.registerBeanPostProcessors(PostProcessorRegistrationDelegate.java:228)
	at org.springframework.context.support.AbstractApplicationContext.registerBeanPostProcessors(AbstractApplicationContext.java:721)
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:534)
	at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:140)
	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:742)
	at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:389)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:311)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1213)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1202)
	at com.xb.o2o.O2obootApplication.main(O2obootApplication.java:10)
Caused by: java.lang.IllegalStateException: No persistence exception translators found in bean factory. Cannot perform exception translation.
	at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.detectPersistenceExceptionTranslators(PersistenceExceptionTranslationInterceptor.java:142)
	at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.<init>(PersistenceExceptionTranslationInterceptor.java:79)
	at org.springframework.dao.annotation.PersistenceExceptionTranslationAdvisor.<init>(PersistenceExceptionTranslationAdvisor.java:70)
	at org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor.setBeanFactory(PersistenceExceptionTranslationPostProcessor.java:103)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeAwareMethods(AbstractAutowireCapableBeanFactory.java:1800)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1765)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:593)
	... 15 common frames omitted

Process finished with exit code 1

正在回答 回答被采纳积分+3

1回答

翔仔 2020-06-15 02:33:43

同学好,由于我这边没有尝试过这样的操作,所以转成idea需要同学多担待,这里我只能凭经验判定是jar冲突,但是说由于异常翻译器有问题,所以导致持久化异常没有翻译成功,这里至于为什么eclipse可以而idea不行,可能是因为idea某些插件冲突的原因

0 回复 有任何疑惑可以回复我~
  • 提问者 熊大大大熊 #1
    再请问一下老师,现在用IDEA做springboot项目用什么版本的mybatis-spring-boot-starter 会比较稳定 企业用的比较多呢
    回复 有任何疑惑可以回复我~ 2020-06-15 18:45:49
  • 翔仔 回复 提问者 熊大大大熊 #2
    企业的版本使用后基本万年不变,目前还是用1.x的多,不过后续新开的项目也用的2.x
    回复 有任何疑惑可以回复我~ 2020-06-16 02:01:18
问题已解决,确定采纳
还有疑问,暂不采纳
意见反馈 帮助中心 APP下载
官方微信