2017-07-29 90 views
2

我試圖檢查在Eclipse(Mars.2版本)提供的春季啓動啓動項目,但我得到的錯誤。日食春季啓動啓動項目給出了錯誤

這是我做的:

  1. 導入新的春天入門內容: enter image description here

  2. 選擇春季啓動給了我兩個新項目:

enter image description here

  1. 運行GS-彈簧引導完整的給我這個錯誤

`

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.spring[email protected]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.spring[email protected]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] 
    

    感謝您的幫助!

    +0

    我看來像您遇到Maven的腐敗罐時的問題它下載它們。我會嘗試清除你的Maven緩存,以便它再次下載 –

    回答

    0

    您也需要明確指定一個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>