【问题标题】:spring boot starting application errorspring boot启动应用程序错误
【发布时间】:2018-08-30 12:09:34
【问题描述】:

这是错误:

. ____ _ __ _ _ /\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \ ( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \ \\/ ___)| |_)| | | | | || (_||))))) ' |____| .__|_| |_|_| |_\__, | / / / / =========|_|===============|___/=/_/_/_/ :: Spring Boot :: (v1.4.2.RELEASE) 2018-03-21 11:52:43.445 信息 5100 --- [主要] com.projetPfe.imagpart.ProjetPfe : 在 damha-PC 上启动 ProjetPfe PID 5100 (C:\Users\damha\Documents\workspace-sts\course- 由 damha 在 C:\Users\damha\Documents\workspace 中启动的 api\target\classes- sts\课程-api) 2018-03-21 11:52:43.463 信息 5100 --- [主要] com.projetPfe.imagpart.ProjetPfe :没有活动配置文件集,下降 返回默认配置文件:默认 2018-03-21 11:52:43.576 INFO 5100 --- [main] ationConfigEmbeddedWebApplicationContext:刷新 org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@7ed7259e:启动日期 [2018 年 3 月 21 日星期三 11:52:43 CET];上下文层次的根 2018-03-21 11:52:44.627 WARN 5100 --- [main] ationConfigEmbeddedWebApplicationContext:在上下文初始化期间遇到异常-取消刷新尝试:org.springframework.beans.factory.BeanDefinitionStoreException:无法处理配置类的导入候选 [com .projetPfe.imagpart.ProjetPfe];嵌套异常是 java.lang.IllegalStateException: 由于找不到 org/springframework/dao/DataAccessException,无法评估 org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration$EmbeddedDatabaseConfiguration 的条件。确保您自己的配置不依赖于该类。如果您正在 @ComponentScanning 一个 springframework 包,也会发生这种情况(例如,如果您错误地将 @ComponentScan 放入默认包中) 2018-03-21 11:52:44.657 错误 5100 --- [main] o.s.b.f.s.DefaultListableBeanFactory:在名为“org.springframework.boot.autoconfigure.internalCachingMetadataReaderFactory”的 bean 上销毁方法引发异常 java.lang.IllegalStateException:ApplicationEventMulticaster 未初始化 - 在通过上下文多播事件之前调用“刷新”:org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@7ed7259e:启动日期 [2018 年 3 月 21 日星期三 11:52:43 CET];上下文层次的根 在 org.springframework.context.support.AbstractApplicationContext.getApplicationEventMulticaster(AbstractApplicationContext.java:404) [spring-context-4.3.4.RELEASE.jar:4.3.4.RELEASE] 在 org.springframework.context.support.ApplicationListenerDetector.postProcessBeforeDestruction(ApplicationListenerDetector.java:97) ~[spring-context-4.3.4.RELEASE.jar:4.3.4.RELEASE] 在 org.springframework.beans.factory.support.DisposableBeanAdapter.destroy(DisposableBeanAdapter.java:253) ~[spring-beans-4.3.4.RELEASE.jar:4.3.4.RELEASE] 在 org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroyBean(DefaultSingletonBeanRegistry.java:578) [spring-beans-4.3.4.RELEASE.jar:4.3.4.RELEASE] 在 org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroySingleton(DefaultSingletonBeanRegistry.java:554) [spring-beans-4.3.4.RELEASE.jar:4.3.4.RELEASE] 在 org.springframework.beans.factory.support.DefaultListableBeanFactory.destroySingleton(DefaultListableBeanFactory.java:954) [spring-beans-4.3.4.RELEASE.jar:4.3.4.RELEASE] 在 org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroySingletons(DefaultSingletonBeanRegistry.java:523) [spring-beans-4.3.4.RELEASE.jar:4.3.4.RELEASE] 在 org.springframework.beans.factory.support.DefaultListableBeanFactory.destroySingletons(DefaultListableBeanFactory.java:961) [spring-beans-4.3.4.RELEASE.jar:4.3.4.RELEASE] 在 org.springframework.context.support.AbstractApplicationContext.destroyBeans(AbstractApplicationContext.java:1033) [spring-context-4.3.4.RELEASE.jar:4.3.4.RELEASE] 在 org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:555) [spring-context-4.3.4.RELEASE.jar:4.3.4.RELEASE] 在 org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122) [spring-boot-1.4.2.RELEASE.jar:1.4.2.RELEASE] 在 org.springframework.boot.SpringApplication.refresh(SpringApplication.java:761) [spring-boot-1.4.2.RELEASE.jar:1.4.2.RELEASE] 在 org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:371) [spring-boot-1.4.2.RELEASE.jar:1.4.2.RELEASE] 在 org.springframework.boot.SpringApplication.run(SpringApplication.java:315) [spring-boot-1.4.2.RELEASE.jar:1.4.2.RELEASE] 在 org.springframework.boot.SpringApplication.run(SpringApplication.java:1186) [spring-boot-1.4.2.RELEASE.jar:1.4.2.RELEASE] 在 org.springframework.boot.SpringApplication.run(SpringApplication.java:1175) [spring-boot-1.4.2.RELEASE.jar:1.4.2.RELEASE] 在 com.projetPfe.imagpart.ProjetPfe.main(ProjetPfe.java:10) [classes/:na] 2018-03-21 11:52:44.797 错误 5100 --- [main] os.boot.SpringApplication:应用程序启动失败 org.springframework.beans.factory.BeanDefinitionStoreException:无法处理配置类 [com.projetPfe.imagpart.ProjetPfe] 的导入候选;嵌套异常是 java.lang.IllegalStateException: 由于找不到 org/springframework/dao/DataAccessException,无法评估 org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration$EmbeddedDatabaseConfiguration 的条件。确保您自己的配置不依赖于该类。如果您正在 @ComponentScanning 一个 springframework 包,也会发生这种情况(例如,如果您错误地将 @ComponentScan 放入默认包中) 在 org.springframework.context.annotation.ConfigurationClassParser.processImports(ConfigurationClassParser.java:541) ~[spring-context-4.3.4.RELEASE.jar:4.3.4.RELEASE] 在 org.springframework.context.annotation.ConfigurationClassParser.processDeferredImportSelectors(ConfigurationClassParser.java:475) ~[spring-context-4.3.4.RELEASE.jar:4.3.4.RELEASE] 在 org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:184) ~[spring-context-4.3.4.RELEASE.jar:4.3.4.RELEASE] 在 org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:324) ~[spring-context-4.3.4.RELEASE.jar:4.3.4.RELEASE] 在 org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:246) ~[spring-context-4.3.4.RELEASE.jar:4.3.4.RELEASE] 在 org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProcessors(PostProcessorRegistrationDelegate.java:270) ~[spring-context-4.3.4.RELEASE.jar:4.3.4.RELEASE] 在 org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:93) ~[spring-context-4.3.4.RELEASE.jar:4.3.4.RELEASE] 在 org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:686) ~[spring-context-4.3.4.RELEASE.jar:4.3.4.RELEASE] 在 org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:524) ~[spring-context-4.3.4.RELEASE.jar:4.3.4.RELEASE] 在 org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122) ~[spring-boot-1.4.2.RELEASE.jar:1.4.2.RELEASE] 在 org.springframework.boot.SpringApplication.refresh(SpringApplication.java:761) [spring-boot-1.4.2.RELEASE.jar:1.4.2.RELEASE] 在 org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:371) [spring-boot-1.4.2.RELEASE.jar:1.4.2.RELEASE] 在 org.springframework.boot.SpringApplication.run(SpringApplication.java:315) [spring-boot-1.4.2.RELEASE.jar:1.4.2.RELEASE] 在 org.springframework.boot.SpringApplication.run(SpringApplication.java:1186) [spring-boot-1.4.2.RELEASE.jar:1.4.2.RELEASE] 在 org.springframework.boot.SpringApplication.run(SpringApplication.java:1175) [spring-boot-1.4.2.RELEASE.jar:1.4.2.RELEASE] 在 com.projetPfe.imagpart.ProjetPfe.main(ProjetPfe.java:10) [classes/:na] 原因:java.lang.IllegalStateException:由于找不到 org/springframework/dao/DataAccessException,无法评估 org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration$EmbeddedDatabaseConfiguration 的条件。确保您自己的配置不依赖于该类。如果您正在 @ComponentScanning 一个 springframework 包,也会发生这种情况(例如,如果您错误地将 @ComponentScan 放入默认包中) 在 org.springframework.boot.autoconfigure.condition.SpringBootCondition.matches(SpringBootCondition.java:55) ~[spring-boot-autoconfigure-1.4.2.RELEASE.jar:1.4.2.RELEASE] 在 org.springframework.context.annotation.ConditionEvaluator.shouldSkip(ConditionEvaluator.java:102) ~[spring-context-4.3.4.RELEASE.jar:4.3.4.RELEASE] 在 org.springframework.context.annotation.ConfigurationClassParser.processConfigurationClass(ConfigurationClassParser.java:202) ~[spring-context-4.3.4.RELEASE.jar:4.3.4.RELEASE] 在 org.springframework.context.annotation.ConfigurationClassParser.processMemberClasses(ConfigurationClassParser.java:329) ~[spring-context-4.3.4.RELEASE.jar:4.3.4.RELEASE] 在 org.springframework.context.annotation.ConfigurationClassParser.doProcessConfigurationClass(ConfigurationClassParser.java:247) ~[spring-context-4.3.4.RELEASE.jar:4.3.4.RELEASE] 在 org.springframework.context.annotation.ConfigurationClassParser.processConfigurationClass(ConfigurationClassParser.java:230) ~[spring-context-4.3.4.RELEASE.jar:4.3.4.RELEASE] 在 org.springframework.context.annotation.ConfigurationClassParser.processImports(ConfigurationClassParser.java:532) ~[spring-context-4.3.4.RELEASE.jar:4.3.4.RELEASE] ...省略了15个常用框架 引起:java.lang.NoClassDefFoundError: org/springframework/dao/DataAccessException 在 org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration$EmbeddedDatabaseCondition.getMatchOutcome(DataSourceAutoConfiguration.java:202) ~[spring-boot-autoconfigure-1.4.2.RELEASE.jar:1.4.2.RELEASE] 在 org.springframework.boot.autoconfigure.condition.SpringBootCondition.matches(SpringBootCondition.java:47) ~[spring-boot-autoconfigure-1.4.2.RELEASE.jar:1.4.2.RELEASE] ...省略了21个常用框架 引起:java.lang.ClassNotFoundException: org.springframework.dao.DataAccessException 在 java.net.URLClassLoader.findClass(Unknown Source) ~[na:1.8.0_131] 在 java.lang.ClassLoader.loadClass(Unknown Source) ~[na:1.8.0_131] 在 sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) ~ [na:1.8.0_131] 在 java.lang.ClassLoader.loadClass(Unknown Source) ~[na:1.8.0_131] ...省略了23个常用框架

这是我的 pom.xml 文件:

   <project xmlns="http://maven.apache.org/POM/4.0.0" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.PfeProject</groupId>
<artifactId>projet_de_pfe</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>Projet PFE chez Imagine Partners</name>

<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
 <version>1.4.2.RELEASE</version>
</parent>


 <build>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
        </plugin>
    </plugins>
  </build>

 <dependencies>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-data-jpa</artifactId>
    </dependency>

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

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

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

    <dependency>

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

    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-jdbc</artifactId>
        <version>4.3.8.RELEASE</version> 
    </dependency> 

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-tomcat</artifactId>
        <scope>provided</scope>
    </dependency>

  </dependencies>

  <properties>
     <java.version>1.8</java.version>
       </properties>


   </project>

这是我的主要课程:

package com.projetPfe.imagpart;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

 @SpringBootApplication
 public class ProjetPfe {

public static void main(String[] args) {
    SpringApplication.run(ProjetPfe.class, args);


   }

}

【问题讨论】:

  • 如果您错误地将@ComponentScan 放入默认包中 是吗?另外,什么版本的 Java?
  • 添加显示您的 @SpringBootApplication 类和所有 @ComponentScan 用法的代码
  • j'ai pas utilisé @componentScan ! j'ai édité ma question et j'ai ajouté la class main java version = 1.8
  • 为什么你的pom.xml 中有spring-jdbc 的依赖?混合不兼容版本的 Spring jar 文件可能会导致您遇到的错误。
  • @Jesper 我删除了那个依赖,我仍然有同样的错误

标签: java spring hibernate spring-mvc spring-boot


【解决方案1】:

我通过清理 maven 存储库(m2 存储库)来修复它

【讨论】:

  • 你是怎么清理的?干净的 Maven 存储库是什么意思?你彻底删除了吗?
猜你喜欢
  • 2021-05-18
  • 2021-03-18
  • 1970-01-01
  • 1970-01-01
  • 2018-02-07
  • 2022-12-22
  • 2020-06-27
  • 2019-06-30
  • 2023-03-27
相关资源
最近更新 更多