没有找到方案的组件:码头

时间:2015-01-15 05:19:42

标签: apache jboss apache-camel fuseesb

所以我浏览了留言板,看到一些人遇到了这个问题,但通常是由于POM文件中缺少依赖性。

我的情况:

  1. 运行JBoss保险丝jboss-fuse-6.1.0.redhat-379
  2. Apache Camel 2.14.1
  3. Spring 3.2.8_RELEASE_1
  4. 在我的POM文件中有camel-jetty依赖
  5. 在Karaf中安装了此功能。已验证该功能 OSGI列表和功能列表。
  6. jetty / 8.1.14.v20131031
  7. 在日食中运行良好。

    所以我有一个具有以下休息配置的上下文:

    <camelContext id="FIRST-CAMEL-CONTEXT" xmlns="http://camel.apache.org/schema/spring" streamCache="true">
         <restConfiguration component="jetty" bindingMode="json" port="8881" host="0.0.0.0">
              <dataFormatProperty key="prettyPrint" value="true"/>
         </restConfiguration>
    
        <rest path="/search" consumes="application/json" produces="application/json">
          <description>Get Search Results</description>
           <!-- this is a rest GET to find all users -->
          <post uri="/SearchHotels" outType="HotelsEnvelope.Response" type="HotelsEnvelope.Request">
            <description>Hotels</description>
            <to uri="bean:searchRequest?method=ReturnHotels(Exchange,${body},${headers})"/>
          </post>
        </rest>
      .....
      </camelContext>
    

    上面定义的bean:

    <bean id="searchRequest" class="ICEPricelineSVC.SearchRequest" />
    

    在Bean中,我基本上创建了一个上下文,然后向第三方服务发送请求,如下所示:

    CamelContext context = new DefaultCamelContext();
    ProducerTemplate template = context.createProducerTemplate();
    
    .....
    
    String url = String.format("jetty:http://api.rezserver.com/api/hotel/getResultsWithCacheV2?function_type=get&format=xml&refid=%s&api_key=%s&currency=USD&latitude=%s&longitude=%s&radius=%s&check_in=%s&check_out=%s&adults=2&children=0&rooms=1&nearby=0&recent=0&promo=1&sort_by=most_popular&sort_order=ASC&limit=5000&offset=0&format=xml&function_type=get&poi_name=search&bridgeEndpoint=true&amp;amp;throwExceptionOnFailure=false",supplier.getCredentials().getRefid(),supplier.getCredentials().getKey(), request.getQryLocation().getLat().toString(), request.getQryLocation().getLng().toString(), request.getQryLocation().getRadius().toString(),formatter1.format(dateCheckIn), formatter1.format(dateCheckOut));
    
    
    Exchange exchange = template.send(url, new Processor() {
                                      public void process(Exchange exchange) throws Exception {
      exchange.setPattern(ExchangePattern.InOut);
      Message inMessage = exchange.getIn();
      Inits.setupDestinationURL(inMessage);
    
      // set the operation name 
    
      inMessage.setHeader(Exchange.HTTP_METHOD, org.apache.camel.component.http4.HttpMethods.GET);
    }
    });
    
    .....
    

    当生产者模板发送时,我得到了码头错误。

    我尝试过各种各样的事情。其中之一是在bean中注入ApplicationContext并获取FIRST_CAMEL_CONTEXT bean来检索上下文。在这种情况下,请求似乎已发送,但从处理器返回的交换为空。

    同样,这一切都在日蚀中起作用。我还注意到,当我部署捆绑包时,我看到它将依赖项添加到容器中。追逐这个有好方法吗?我现在已经使用了HTPClient,但我真的很想了解为什么在使用生产者时似乎存在类路径问题。

    感谢。

1 个答案:

答案 0 :(得分:1)

JBoss Fuse 6.1附带Apache Camel 2.12.x开箱即用。您必须使用该版本,因为它是经过认证和测试的版本。

JBoss Fuse 6.2是Apache Camel 2.14.x的下一个版本,该版本有新的rest-dsl。