尝试使此示例生效: https://github.com/apache/camel/tree/master/examples/camel-example-micrometer
当我转到指标端点时,例如curl http://0.0.0.0:8088/metrics我收到此错误:
Caused by: org.apache.camel.NoTypeConversionAvailableException: No type converter available to convert from type: org.apache.camel.component.netty4.http.NettyChannelBufferStreamCache to the required type: java.io.Writer with value org.apache.camel.component.netty4.http.NettyChannelBufferStreamCache@1030cc69
我想知道是否有一种方法可以注册新类型的转换器或对此错误进行其他解释。
org.apache.camel.CamelExecutionException: Exception occurred during execution on the exchange: Exchange[ID-charlie-1562961691767-0-4]
at org.apache.camel.CamelExecutionException.wrapCamelExecutionException(CamelExecutionException.java:47) ~[camel-api-3.0.0-20190712.122633-479.jar:3.0.0-SNAPSHOT]
at org.apache.camel.support.builder.ExpressionBuilder$34.evaluate(ExpressionBuilder.java:839) ~[camel-support-3.0.0-20190712.122719-414.jar:3.0.0-SNAPSHOT]
at org.apache.camel.support.ExpressionAdapter.evaluate(ExpressionAdapter.java:34) ~[camel-support-3.0.0-20190712.122719-414.jar:3.0.0-SNAPSHOT]
at org.apache.camel.component.bean.MethodInfo$ParameterExpression.evaluateParameterBinding(MethodInfo.java:762) ~[camel-bean-3.0.0-20190712.122827-171.jar:3.0.0-SNAPSHOT]
at org.apache.camel.component.bean.MethodInfo$ParameterExpression.evaluateParameterExpressions(MethodInfo.java:654) ~[camel-bean-3.0.0-20190712.122827-171.jar:3.0.0-SNAPSHOT]
at org.apache.camel.component.bean.MethodInfo$ParameterExpression.evaluate(MethodInfo.java:622) ~[camel-bean-3.0.0-20190712.122827-171.jar:3.0.0-SNAPSHOT]
at org.apache.camel.component.bean.MethodInfo.createMethodInvocation(MethodInfo.java:207) ~[camel-bean-3.0.0-20190712.122827-171.jar:3.0.0-SNAPSHOT]
at org.apache.camel.component.bean.BeanInfo.createInvocation(BeanInfo.java:294) ~[camel-bean-3.0.0-20190712.122827-171.jar:3.0.0-SNAPSHOT]
at org.apache.camel.component.bean.BeanInfo.createInvocation(BeanInfo.java:187) ~[camel-bean-3.0.0-20190712.122827-171.jar:3.0.0-SNAPSHOT]
at org.apache.camel.component.bean.AbstractBeanProcessor.process(AbstractBeanProcessor.java:128) ~[camel-bean-3.0.0-20190712.122827-171.jar:3.0.0-SNAPSHOT]
at org.apache.camel.impl.engine.DefaultAsyncProcessorAwaitManager.process(DefaultAsyncProcessorAwaitManager.java:77) ~[camel-base-3.0.0-20190712.122747-410.jar:3.0.0-SNAPSHOT]
at org.apache.camel.support.AsyncProcessorSupport.process(AsyncProcessorSupport.java:40) ~[camel-support-3.0.0-20190712.122719-414.jar:3.0.0-SNAPSHOT]
at org.apache.camel.language.bean.BeanExpression.invokeBean(BeanExpression.java:295) ~[camel-bean-3.0.0-20190712.122827-171.jar:3.0.0-SNAPSHOT]
at org.apache.camel.language.bean.BeanExpression.evaluate(BeanExpression.java:159) ~[camel-bean-3.0.0-20190712.122827-171.jar:3.0.0-SNAPSHOT]
at org.apache.camel.language.bean.BeanExpression.evaluate(BeanExpression.java:170) ~[camel-bean-3.0.0-20190712.122827-171.jar:3.0.0-SNAPSHOT]
at org.apache.camel.processor.TransformProcessor.process(TransformProcessor.java:44) ~[camel-base-3.0.0-20190712.122747-410.jar:3.0.0-SNAPSHOT]
at org.apache.camel.processor.errorhandler.RedeliveryErrorHandler$RedeliveryState.run(RedeliveryErrorHandler.java:480) [camel-base-3.0.0-20190712.122747-410.jar:3.0.0-SNAPSHOT]
at org.apache.camel.impl.engine.DefaultReactiveExecutor$Worker.schedule(DefaultReactiveExecutor.java:185) [camel-base-3.0.0-20190712.122747-410.jar:3.0.0-SNAPSHOT]
at org.apache.camel.impl.engine.DefaultReactiveExecutor.scheduleMain(DefaultReactiveExecutor.java:59) [camel-base-3.0.0-20190712.122747-410.jar:3.0.0-SNAPSHOT]
at org.apache.camel.processor.Pipeline.process(Pipeline.java:87) [camel-base-3.0.0-20190712.122747-410.jar:3.0.0-SNAPSHOT]
at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:222) [camel-base-3.0.0-20190712.122747-410.jar:3.0.0-SNAPSHOT]
at org.apache.camel.component.netty4.handlers.ServerChannelHandler.processAsynchronously(ServerChannelHandler.java:141) [camel-netty4-3.0.0-20190712.132550-469.jar:3.0.0-SNAPSHOT]
at org.apache.camel.component.netty4.handlers.ServerChannelHandler.channelRead0(ServerChannelHandler.java:112) [camel-netty4-3.0.0-20190712.132550-469.jar:3.0.0-SNAPSHOT]
at org.apache.camel.component.netty4.http.handlers.HttpServerChannelHandler.channelRead0(HttpServerChannelHandler.java:197) [camel-netty4-http-3.0.0-20190712.135212-462.jar:3.0.0-SNAPSHOT]
at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:105) [netty-all-4.1.37.Final.jar:4.1.37.Final]
at org.apache.camel.component.netty4.http.handlers.HttpServerMultiplexChannelHandler.channelRead0(HttpServerMultiplexChannelHandler.java:144) [camel-netty4-http-3.0.0-20190712.135212-462.jar:3.0.0-SNAPSHOT]
at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:105) [netty-all-4.1.37.Final.jar:4.1.37.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:374) [netty-all-4.1.37.Final.jar:4.1.37.Final]
at io.netty.channel.AbstractChannelHandlerContext.access$600(AbstractChannelHandlerContext.java:56) [netty-all-4.1.37.Final.jar:4.1.37.Final]
at io.netty.channel.AbstractChannelHandlerContext$7.run(AbstractChannelHandlerContext.java:365) [netty-all-4.1.37.Final.jar:4.1.37.Final]
at io.netty.util.concurrent.DefaultEventExecutor.run(DefaultEventExecutor.java:66) [netty-all-4.1.37.Final.jar:4.1.37.Final]
at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:918) [netty-all-4.1.37.Final.jar:4.1.37.Final]
at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74) [netty-all-4.1.37.Final.jar:4.1.37.Final]
at java.lang.Thread.run(Thread.java:834) [?:?]
Caused by: org.apache.camel.InvalidPayloadException: No body available of type: java.io.Writer but has value: org.apache.camel.component.netty4.http.NettyChannelBufferStreamCache@1030cc69 of type: org.apache.camel.component.netty4.http.NettyChannelBufferStreamCache on: Message[ID-charlie-1562961691767-0-5]. Caused by: No type converter available to convert from type: org.apache.camel.component.netty4.http.NettyChannelBufferStreamCache to the required type: java.io.Writer with value org.apache.camel.component.netty4.http.NettyChannelBufferStreamCache@1030cc69. Exchange[ID-charlie-1562961691767-0-4]. Caused by: [org.apache.camel.NoTypeConversionAvailableException - No type converter available to convert from type: org.apache.camel.component.netty4.http.NettyChannelBufferStreamCache to the required type: java.io.Writer with value org.apache.camel.component.netty4.http.NettyChannelBufferStreamCache@1030cc69]
at org.apache.camel.support.MessageSupport.getMandatoryBody(MessageSupport.java:115) ~[camel-support-3.0.0-20190712.122719-414.jar:3.0.0-SNAPSHOT]
at org.apache.camel.support.builder.ExpressionBuilder$34.evaluate(ExpressionBuilder.java:837) ~[camel-support-3.0.0-20190712.122719-414.jar:3.0.0-SNAPSHOT]
... 32 more
Caused by: org.apache.camel.NoTypeConversionAvailableException: No type converter available to convert from type: org.apache.camel.component.netty4.http.NettyChannelBufferStreamCache to the required type: java.io.Writer with value org.apache.camel.component.netty4.http.NettyChannelBufferStreamCache@1030cc69
at org.apache.camel.impl.converter.BaseTypeConverterRegistry.mandatoryConvertTo(BaseTypeConverterRegistry.java:138) ~[camel-base-3.0.0-20190712.122747-410.jar:3.0.0-SNAPSHOT]
at org.apache.camel.support.MessageSupport.getMandatoryBody(MessageSupport.java:113) ~[camel-support-3.0.0-20190712.122719-414.jar:3.0.0-SNAPSHOT]
at org.apache.camel.support.builder.ExpressionBuilder$34.evaluate(ExpressionBuilder.java:837) ~[camel-support-3.0.0-20190712.122719-414.jar:3.0.0-SNAPSHOT]
... 32 more
答案 0 :(得分:1)
我偶然发现了同一问题。问题出在ScrapeRouteBuilder
中。具体来说,这部分:
.transform().method(prometheusMeterRegistry, "scrape")
scrape
有两个实现:
public String scrape()
public void scrape(Writer writer) throws IOException
因此,您需要帮助Camel找出要调用的那个。例如:
.transform().method(prometheusMeterRegistry, "scrape()")
我对Camel master分支进行了修复。