Apache camel HttpOperationFailedException是否可用于apache的http4?

Apache camel HttpOperationFailedException是否可用于apache的http4?,apache-camel,httpexception,camel-http,Apache Camel,Httpexception,Camel Http,我正在为http服务器使用ApacheCamel http4。 JBoss Fuse-Karaf容器6.3.0.redhat-310 已捆绑骆驼芯2.17-2.17.0.redhat-630310 我正在尝试使用异常类 org.apache.camel.component.http.HttpOperationFailedException 捕获HTTP响应异常 但是,由于以下原因,关联的路由无法启动: 原因:java.lang.ClassNotFoundException:org.apache.

我正在为http服务器使用ApacheCamel http4。 JBoss Fuse-Karaf容器6.3.0.redhat-310 已捆绑骆驼芯2.17-2.17.0.redhat-630310

我正在尝试使用异常类 org.apache.camel.component.http.HttpOperationFailedException 捕获HTTP响应异常

但是,由于以下原因,关联的路由无法启动: 原因:java.lang.ClassNotFoundException:org.apache.camel.component.http.HttpOperationFailedException

我添加了依赖骆驼http,没有任何更改,仍然失败

这门课似乎不再包括在内了

问题:是由:java.lang.ClassNotFoundException:org.apache.camel.component.http.HttpOperationFailedException引起的,还是有人知道我做错了什么

    <when id="w2">
        <ognl>request.headers.TKNDB == true</ognl>
        <process id="a3" ref="assetUploadProcessor"/>
        <setHeader headerName="CamelHttpUri" id="h1">
            <simple>${header.UPLOADURL}</simple>
        </setHeader>
        <setHeader headerName="CamelHttpMethod" id="h2">
            <constant>GET</constant>
        </setHeader>
        <doTry id="_doTry1">
            <to id="http4-1" uri="http4://d1e53858-2903-4c21-86c0-95edc7a5cef2.predix-uaa.run.aws-usw02-pr.ice.predix.io:443/oauth/token?throwExceptionOnFailure=false"/>
            <doCatch id="_doCatch1">
                <exception>org.apache.camel.component.http.HttpOperationFailedException</exception>
                <onWhen>
                <simple>${header.HTTP_RESPONSE_CODE} range "400..600"</simple>
                </onWhen>
                <log id="_log2" loggingLevel="ERROR" message="HTTP FAILURE - HTTP Response Code: ${header.HTTP_RESPONSE_CODE}"/>
            </doCatch>
        </doTry>
        <log id="l1" loggingLevel="INFO" message="JSON Response: ${body}"/>
        <process id="jsonmapperassets" ref="jsonMapperAssets"/>
        <split id="as1"
YEILDS ... 因为org.apache.camel.component.http.HttpOperationFailedException 原因:java.lang.ClassNotFoundException:org.apache.camel.component.http.HttpOperationFailedException

我还尝试使用全局异常处理程序

但是,这里我得到一个错误异常,说继续不能有孩子


谢谢大家!

我只是用简单的语言来实现我所需要的。我只需要在http错误代码not OK或200后继续路由。这种方法是可行的,但我很想了解如何用我最初的问题来实现这一点

如果这些类不再是camel的http4组件的一部分,那么这可以通过camel的http4组件实现吗

另外,如果有人可以,我的OneException条款有什么问题

谢谢

这就是我所做的

<to id="http4-1" uri="http4://d1e53858-2903-4c21-86c0-95edc7a5cef2.predix-uaa.run.aws-usw02-pr.ice.predix.io:443/oauth/token?throwExceptionOnFailure=false"/>
<choice>
 <when>
  <simple>${header.CamelHttpResponseCode} == '200'</simple>
    <log id="l1" loggingLevel="INFO" message="JSON Response Body: ${body}"/>
    <process id="jsonmapperassets" ref="jsonMapperAssets"/>
  <split id="as1"
    strategyRef="tsAggregationStrategy" streaming="true">
    <simple>${body}</simple>
    <log id="al6" loggingLevel="INFO" message="Split line ${body}"/>
    <process id="p1" ref="getAssets"/>
  </split>
  <process id="getassetlisting" ref="getAssetListing"/>
  <split id="as2"
    strategyRef="tsAggregationStrategy" streaming="true">
    <simple>${body}</simple>
    <log id="sl2" loggingLevel="INFO" message="Split assets ${body}"/>
    <process id="gtags" ref="setTagURL"/>
    <to id="surl" ref="setURL"/>
  </split>
 </when>
 <otherwise>
   <log id="logError1" loggingLevel="ERROR" message="HTTP FAILURE - Response Code: ${header.CamelHttpResponseCode}"/>
   <log id="logError2" loggingLevel="ERROR" message="HTTP FAILURE - Response: ${header.CamelHttpResponseText}"/>
 </otherwise>
</choice>

我也面临同样的问题,正确的班级是

org.apache.camel.http.common.HttpOperationFailedException
它应该位于http4组件内部

org.apache.camel.http.common.HttpOperationFailedException