将Apache Camel与基于CXF的RESTful Web服务集成:需要建议

时间:2012-04-20 10:14:12

标签: java spring cxf apache-camel cxfrs

我正在尝试将我的CXF restful webservices与apache camel集成。要求是当有人点击我的网络服务时,我会接受请求参数并连接到谷歌或某些服务提供商,以使用请求参数搜索结果。 让我说我的web服务是foo:bar,我想在这个foo之后连接到google:bar被点击了。 这意味着我的骆驼路线会是这样的:

     <camelContext>
            <route>
             <to uri:"cxf://bean://foo:bar/>
             <from uri="http://www.google.com"/>
            </route>
           </camelContext>

    is this understanding correct.. 
    i am pasting a section of my config xml for review ..




<jaxrs:server id="restContainer" address="/" staticSubresourceResolution="true">
<jaxrs:serviceBeans>
<ref bean="FooBar" />
</jaxrs:serviceBeans>
<jaxrs:providers>
<bean class="org.apache.cxf.jaxrs.provider.JSONProvider">
<property name="dropRootElement" value="true" />
<property name="supportUnwrapped" value="true" />
</jaxrs:providers>
<camelcxf:rsServer id="rsServer"
// this is the rest uri which is mapped to my resource class address="http://localhost:port/MyApplication/rest/foobar serviceClass="com.camel.example.FooBar" />
<camel:camelContext id="camelContext-1">
<camel:route>
<camel:from uri="cxfrs:bean:rsServer" />
<camel:to uri="http://www.google.com" />
</camel:route>
</camel:camelContext>

除此之外,我在运行我的webservice时遇到以下异常:  java.lang.ClassNotFoundException:org.eclipse.jetty.util.component.Container $ Listener     在org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1666)     在org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1511)     at java.lang.ClassLoader.loadClassInternal(Unknown Source)     ......还有58个 我不明白为什么我得到这个,因为我使用tomcat进行部署。

1 个答案:

答案 0 :(得分:0)

解决了这个问题,在我的构建路径中添加了所有的Jetty jar。码头版本8.0

相关问题