Search code examples
javaspringcxfapache-camelcxfrs

Integrating Apache Camel with CXF based RESTful webservices : Need Advice


I am trying to integrate my CXF restful webservices with apache camel. the requirement is that when someone hits my webservice, i take the request parameters and connect to google or some service provider to search for results using the request parameters. lets say my webservice is foo:bar and i want to connect to google after this foo:bar gets hit. this means my camel route would be something like that :

     <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>

Also apart from this i am getting following exception when i run my webservice : java.lang.ClassNotFoundException: org.eclipse.jetty.util.component.Container$Listener at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1666) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1511) at java.lang.ClassLoader.loadClassInternal(Unknown Source) ... 58 more I dont understand why i get this, as i am using tomcat for deployment.


Solution

  • Resolved the issue , added all the jetty jars in my builpath. jetty version 8.0