SpringCloud 启动"No qualifying bean of type 'javax.servlet.Filter' available"问题

导入别人的springcloud 的eureka服务的时候,启动报错,报错信息是:

2018-06-25 16:02:10.731  INFO 16576 --- [           main] s.c.a.AnnotationConfigApplicationContext : Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext@43195e57: startup date [Mon Jun 25 16:02:10 CST 2018]; root of context hierarchy
2018-06-25 16:02:11.015  INFO 16576 --- [           main] f.a.AutowiredAnnotationBeanPostProcessor : JSR-330 'javax.inject.Inject' annotation found and supported for autowiring
2018-06-25 16:02:11.045  INFO 16576 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'configurationPropertiesRebinderAutoConfiguration' of type [org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration$$EnhancerBySpringCGLIB$$b43cc593] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)

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

2018-06-25 16:02:11.359  INFO 16576 --- [           main] com.test.spcloud.App                     : No active profile set, falling back to default profiles: default
2018-06-25 16:02:11.371  INFO 16576 --- [           main] ConfigServletWebServerApplicationContext : Refreshing org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext@1e8b7643: startup date [Mon Jun 25 16:02:11 CST 2018]; parent: org.springframework.context.annotation.AnnotationConfigApplicationContext@43195e57
2018-06-25 16:02:11.930  INFO 16576 --- [           main] o.s.cloud.context.scope.GenericScope     : BeanFactory id=a48d0e97-5259-3c0a-9bd8-ebfa13ae3f42
2018-06-25 16:02:11.942  INFO 16576 --- [           main] f.a.AutowiredAnnotationBeanPostProcessor : JSR-330 'javax.inject.Inject' annotation found and supported for autowiring
2018-06-25 16:02:12.027  INFO 16576 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration' of type [org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration$$EnhancerBySpringCGLIB$$b43cc593] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2018-06-25 16:02:12.415  INFO 16576 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port(s): 8080 (http)
2018-06-25 16:02:12.438  INFO 16576 --- [           main] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
2018-06-25 16:02:12.439  INFO 16576 --- [           main] org.apache.catalina.core.StandardEngine  : Starting Servlet Engine: Apache Tomcat/8.5.29
2018-06-25 16:02:12.447  INFO 16576 --- [ost-startStop-1] o.a.catalina.core.AprLifecycleListener   : Loaded APR based Apache Tomcat Native library [1.2.16] using APR version [1.6.3].
2018-06-25 16:02:12.448  INFO 16576 --- [ost-startStop-1] o.a.catalina.core.AprLifecycleListener   : APR capabilities: IPv6 [true], sendfile [true], accept filters [false], random [true].
2018-06-25 16:02:12.448  INFO 16576 --- [ost-startStop-1] o.a.catalina.core.AprLifecycleListener   : APR/OpenSSL configuration: useAprConnector [false], useOpenSSL [true]
2018-06-25 16:02:13.492  INFO 16576 --- [ost-startStop-1] o.a.catalina.core.AprLifecycleListener   : OpenSSL successfully initialized [OpenSSL 1.0.2m  2 Nov 2017]
2018-06-25 16:02:13.599  INFO 16576 --- [ost-startStop-1] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
2018-06-25 16:02:13.599  INFO 16576 --- [ost-startStop-1] o.s.web.context.ContextLoader            : Root WebApplicationContext: initialization completed in 2228 ms
2018-06-25 16:02:13.972 ERROR 16576 --- [ost-startStop-1] o.s.b.web.embedded.tomcat.TomcatStarter  : Error starting Tomcat context. Exception: org.springframework.beans.factory.UnsatisfiedDependencyException. Message: Error creating bean with name 'traceFilterRegistration' defined in class path resource [org/springframework/cloud/netflix/eureka/server/EurekaServerAutoConfiguration.class]: Unsatisfied dependency expressed through method 'traceFilterRegistration' parameter 0; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'javax.servlet.Filter' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Qualifier(value=httpTraceFilter)}
2018-06-25 16:02:13.997  INFO 16576 --- [           main] o.apache.catalina.core.StandardService   : Stopping service [Tomcat]
2018-06-25 16:02:14.001  WARN 16576 --- [           main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.context.ApplicationContextException: Unable to start web server; nested exception is org.springframework.boot.web.server.WebServerException: Unable to start embedded Tomcat
2018-06-25 16:02:14.006  INFO 16576 --- [           main] ConditionEvaluationReportLoggingListener : 

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2018-06-25 16:02:14.092 ERROR 16576 --- [           main] o.s.b.d.LoggingFailureAnalysisReporter   : 

***************************
APPLICATION FAILED TO START
***************************

Description:

Parameter 0 of method traceFilterRegistration in org.springframework.cloud.netflix.eureka.server.EurekaServerAutoConfiguration required a bean of type 'javax.servlet.Filter' that could not be found.
    - Bean method 'resourceUrlEncodingFilter' in 'FreeMarkerServletWebConfiguration' not loaded because @ConditionalOnEnabledResourceChain did not find class org.webjars.WebJarAssetLocator


Action:

Consider revisiting the conditions above or defining a bean of type 'javax.servlet.Filter' in your configuration.

搜了一下只找到一个办法,而且非常粗鲁:

rm -r $HOME/.m2

也就是删除本地maven仓库里面的所有东西,然后重新下载。没找到好的办法,只能这么干,挂机挂了很久才重新下载回来,结果还真的成功了。
参考的是https://github.com/spring-cloud/spring-cloud-netflix/issues/1491

你可能感兴趣的:(SpringCloud 启动"No qualifying bean of type 'javax.servlet.Filter' available"问题)