SpringCloud 啟動(dòng)"No qualifying bean of type 'javax.servlet.Filter' available"問題

導(dǎo)入別人的springcloud 的eureka服務(wù)的時(shí)候,啟動(dòng)報(bào)錯(cuò),報(bào)錯(cuò)信息是:

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.

搜了一下只找到一個(gè)辦法,而且非常粗魯:

rm -r $HOME/.m2

也就是刪除本地maven倉(cāng)庫里面的所有東西,然后重新下載。沒找到好的辦法,只能這么干,掛機(jī)掛了很久才重新下載回來,結(jié)果還真的成功了。
參考的是https://github.com/spring-cloud/spring-cloud-netflix/issues/1491

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容