Spring 的报 HttpTraceRepository 没有创建实例报错的问题解决。

2019-05-08 09:48:34.567  INFO [udsp-etl] --- [localhost-startStop-1] o.s.w.c.ContextLoader                    : Root WebApplicationContext: initialization completed in 2461 ms
2019-05-08 09:48:35.415 ERROR [udsp-etl] --- [localhost-startStop-1] o.s.b.w.e.t.TomcatStarter                : Error starting Tomcat context. Exception: org.springframework.beans.factory.BeanCreationException. Message: Error creating bean with name 'servletEndpointRegistrar' defined in class path resource [org/springframework/boot/actuate/autoconfigure/endpoint/web/ServletEndpointManagementContextConfiguration$WebMvcServletEndpointManagementContextConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.boot.actuate.endpoint.web.ServletEndpointRegistrar]: Factory method 'servletEndpointRegistrar' threw exception; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'httpTraceEndpoint' defined in class path resource [org/springframework/boot/actuate/autoconfigure/trace/http/HttpTraceEndpointAutoConfiguration.class]: Unsatisfied dependency expressed through method 'httpTraceEndpoint' parameter 0; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'org.springframework.boot.actuate.trace.http.HttpTraceRepository' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {}
2019-05-08 09:48:35.443  INFO [udsp-etl] --- [main] o.a.c.c.StandardService                  : Stopping service [Tomcat]
2019-05-08 09:48:35.448  WARN [udsp-etl] --- [localhost-startStop-1] o.a.c.l.WebappClassLoaderBase            : The web application [ROOT] appears to have started a thread named [lettuce-eventExecutorLoop-1-1] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread:
 sun.misc.Unsafe.park(Native Method)
 java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:215)
 java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.awaitNanos(AbstractQueuedSynchronizer.java:2078)
 java.util.concurrent.LinkedBlockingQueue.poll(LinkedBlockingQueue.java:467)
 io.netty.util.concurrent.SingleThreadEventExecutor.takeTask(SingleThreadEventExecutor.java:251)
 io.netty.util.concurrent.DefaultEventExecutor.run(DefaultEventExecutor.java:64)
 io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:884)
 io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
 java.lang.Thread.run(Thread.java:748)
2019-05-08 09:48:35.450  WARN [udsp-etl] --- [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
2019-05-08 09:48:35.476  INFO [udsp-etl] --- [main] ConditionEvaluationReportLoggingListener : 

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2019-05-08 09:48:35.682 ERROR [udsp-etl] --- [main] o.s.b.d.LoggingFailureAnalysisReporter   : 

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

Description:

Parameter 0 of method httpTraceEndpoint in org.springframework.boot.actuate.autoconfigure.trace.http.HttpTraceEndpointAutoConfiguration required a bean of type 'org.springframework.boot.actuate.trace.http.HttpTraceRepository' that could not be found.


Action:

Consider defining a bean of type 'org.springframework.boot.actuate.trace.http.HttpTraceRepository' in your configuration.


Process finished with exit code 1
        <dependency>
            <groupId>org.redisson</groupId>
            <artifactId>redisson-spring-boot-starter</artifactId>
            <version>3.8.0</version>
        </dependency>

背景:  在spring中定义了一个traceRepository类。而之后又配置了redisson的引入包在pom文件中。
问题:会报如上的错误。
原因:因为redisson中 HttpTraceRepository 的和自定义的traceRepository发生了冲突。导致出现这个问题。

解决方案:

1、可以注释修改自定义的traceRepository名称来修复这个问题。

2、或者可以去掉redisson的引入包。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值