当前位置: 首页 > 知识库问答 >
问题:

eclipsespringbootstarter项目出现错误

闽涵蓄
2023-03-14

我试图查看Eclipse(版本Mars.2)中提供的springboot初学者项目,但遇到了错误。

这就是我所做的:

选择spring boot会给我两个新项目:

`

Exception in thread "main" java.lang.NoClassDefFoundError: ch/qos/logback/classic/turbo/TurboFilter
    at java.lang.Class.getDeclaredConstructors0(Native Method)
    at java.lang.Class.privateGetDeclaredConstructors(Class.java:2671)
    at java.lang.Class.getConstructor0(Class.java:3075)
    at java.lang.Class.getConstructor(Class.java:1825)
    at org.springframework.boot.logging.LoggingSystem.get(LoggingSystem.java:169)
    at org.springframework.boot.logging.LoggingSystem.get(LoggingSystem.java:160)
    at org.springframework.boot.logging.LoggingApplicationListener.onApplicationStartingEvent(LoggingApplicationListener.java:229)
    at org.springframework.boot.logging.LoggingApplicationListener.onApplicationEvent(LoggingApplicationListener.java:209)
    at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:167)
    at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:139)
    at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:122)
    at org.springframework.boot.context.event.EventPublishingRunListener.starting(EventPublishingRunListener.java:69)
    at org.springframework.boot.SpringApplicationRunListeners.starting(SpringApplicationRunListeners.java:48)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:292)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1118)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1107)
    at hello.Application.main(Application.java:15)
Caused by: java.lang.ClassNotFoundException: ch.qos.logback.classic.turbo.TurboFilter
    at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    ... 17 more

谷歌搜索此错误导致我进入maven存储库,所以我导入ch.qos.logback

再次运行(运行作为…-

```

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

2017-07-29 18:43:14.264  INFO 2292 --- [           main] hello.Application                        : Starting Application on m∆x with PID 2292 (/Users/mh/workspaceSpring/gs-spring-boot-complete/target/classes started by mh in /Users/mh/workspaceSpring/gs-spring-boot-complete)
2017-07-29 18:43:14.270  INFO 2292 --- [           main] hello.Application                        : No active profile set, falling back to default profiles: default
2017-07-29 18:43:14.405  INFO 2292 --- [           main] s.c.a.AnnotationConfigApplicationContext : Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext@709ba3fb: startup date [Sat Jul 29 18:43:14 BST 2017]; root of context hierarchy
2017-07-29 18:43:15.404  WARN 2292 --- [           main] s.c.a.AnnotationConfigApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'methodValidationPostProcessor' defined in class path resource [org/springframework/boot/autoconfigure/validation/ValidationAutoConfiguration.class]: Unsatisfied dependency expressed through method 'methodValidationPostProcessor' parameter 1; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'defaultValidator' defined in class path resource [org/springframework/boot/autoconfigure/validation/ValidationAutoConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.validation.beanvalidation.LocalValidatorFactoryBean]: Factory method 'defaultValidator' threw exception; nested exception is java.lang.NoClassDefFoundError: com/fasterxml/classmate/TypeResolver
2017-07-29 18:43:15.412 ERROR 2292 --- [           main] o.s.b.f.s.DefaultListableBeanFactory     : Destroy method on bean with name 'org.springframework.boot.context.properties.ConfigurationPropertiesBindingPostProcessor' threw an exception

java.lang.IllegalStateException: ApplicationEventMulticaster not initialized - call 'refresh' before multicasting events via the context: org.springframework.context.annotation.AnnotationConfigApplicationContext@709ba3fb: startup date [Sat Jul 29 18:43:14 BST 2017]; root of context hierarchy
    at org.springframework.context.support.AbstractApplicationContext.getApplicationEventMulticaster(AbstractApplicationContext.java:414) [spring-context-4.3.10.RELEASE.jar:4.3.10.RELEASE]
    at org.springframework.context.support.ApplicationListenerDetector.postProcessBeforeDestruction(ApplicationListenerDetector.java:97) ~[spring-context-4.3.10.RELEASE.jar:4.3.10.RELEASE]
    at org.springframework.beans.factory.support.DisposableBeanAdapter.destroy(DisposableBeanAdapter.java:253) ~[spring-beans-4.3.10.RELEASE.jar:4.3.10.RELEASE]
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroyBean(DefaultSingletonBeanRegistry.java:578) [spring-beans-4.3.10.RELEASE.jar:4.3.10.RELEASE]
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroySingleton(DefaultSingletonBeanRegistry.java:554) [spring-beans-4.3.10.RELEASE.jar:4.3.10.RELEASE]
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.destroySingleton(DefaultListableBeanFactory.java:961) [spring-beans-4.3.10.RELEASE.jar:4.3.10.RELEASE]
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroySingletons(DefaultSingletonBeanRegistry.java:523) [spring-beans-4.3.10.RELEASE.jar:4.3.10.RELEASE]
    at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.destroySingletons(FactoryBeanRegistrySupport.java:230) [spring-beans-4.3.10.RELEASE.jar:4.3.10.RELEASE]
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.destroySingletons(DefaultListableBeanFactory.java:968) [spring-beans-4.3.10.RELEASE.jar:4.3.10.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.destroyBeans(AbstractApplicationContext.java:1030) [spring-context-4.3.10.RELEASE.jar:4.3.10.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:556) [spring-context-4.3.10.RELEASE.jar:4.3.10.RELEASE]
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:693) [spring-boot-1.5.6.RELEASE.jar:1.5.6.RELEASE]
    at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:360) [spring-boot-1.5.6.RELEASE.jar:1.5.6.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:303) [spring-boot-1.5.6.RELEASE.jar:1.5.6.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1118) [spring-boot-1.5.6.RELEASE.jar:1.5.6.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1107) [spring-boot-1.5.6.RELEASE.jar:1.5.6.RELEASE]
    at hello.Application.main(Application.java:15) [classes/:na]

谢谢你的帮助!

共有1个答案

葛雨华
2023-03-14

您需要显式指定一个 Bean 验证器:

@Bean
public Validator validator(){
   return new org.springframework.validation.beanvalidation.LocalValidatorFactoryBean();
} 

或者将其添加到您的pom.xml中:

<dependency>
    <groupId>com.fasterxml</groupId>
    <artifactId>classmate</artifactId>
    <version>0.8.0</version>
</dependency>
 类似资料:
  • 我正在学习Spring Boot,但我无法执行基本的“Hello World”程序。我已经使用https://start.spring.io/构建了基本项目,并按照以下代码片段更新了代码: Spring靴主类: 控制器类: POM. xml文件: 错误: 我知道这个问题已经被很多人问过了,但我已经仔细阅读了这些答案,并尝试了那些给出的答案,但没有成功。 使用的技术有Java 8、Tomcat 9、

  • 我正在使用eclipse、m2eclipse插件和maven创建一个新的maven项目,遵循以下步骤,http://o7planning.org/en/10101/install-maven-into-eclipse 但是,当创建一个新的maven项目时,没有JRE系统库,也没有maven库。只有如下所示的src、target和pom.xml。这正常吗?如果没有,我该如何避免呢?谢谢! 单击以获取

  • 我从repository获得了项目,按照设置说明,我尝试在eclipse中创建一个项目,并将该位置指向我从repository下载代码的地方。然后当我点击finish时,我得到了一个错误声明 “未满足一个或多个约束。无法安装project facet Java 1.6。此project facet的某些版本已安装。无法安装project facet动态Web模块3.0。此project facet

  • 问题内容: 我一直在努力使它起作用,我认为我可以使用一些帮助。我正在一个Java项目中,其中pom.xml具有一堆依赖关系,其中一些依赖关系本身间接依赖于此jar : 我需要在pom中使用这个特定的jar,因为我想使用jax-rs api:中的新功能 。问题是在构建项目时出现此错误: 我试图通过排除依赖项来解决此问题,这是通过检查依赖关系树来实现的。 现在项目构建良好,但是当我尝试运行它时,出现此

  • 我用无数次的谷歌搜索尝试了这么多次。但这行不通。它给出了一个BeanCreationException。 pom.xml```https://maven.apache.org/xsd/maven-4.0.0.xsd“>4.0.0 org.springframework.Boot spring-boot-starter-parent 2.2.6.release com.example Registe

  • 我正在 https://github.com/oracle/visualvm 构建这个项目。我的系统中有 JDK10。我将 build xml 中的源和目标选项从 1.5 更改为 1.8,因为有错误说 1.5 不再受支持。现在,我收到一个编译错误,指向common.xml它位于其他子文件夹中。 我不知道是怎么回事,因为错误日志也很模糊。此外,我第一次与Ant合作。 这是日志。 引发错误的通用部分.