The route is defined in the tutorial but here is the code that I don't
change :

<?xml version="1.0" encoding="UTF-8"?>
<!--
    Licensed to the Apache Software Foundation (ASF) under one or more
    contributor license agreements.  See the NOTICE file distributed with
    this work for additional information regarding copyright ownership.
    The ASF licenses this file to You under the Apache License, Version 2.0
    (the "License"); you may not use this file except in compliance with
    the License.  You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.
-->
<beans xmlns="http://www.springframework.org/schema/beans";
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
    xmlns:context="http://www.springframework.org/schema/context";
    xmlns:osgi="http://www.springframework.org/schema/osgi";
    xmlns:osgix="http://www.springframework.org/schema/osgi-compendium";
    xmlns:camel="http://camel.apache.org/schema/spring";
    xmlns:cxf="http://camel.apache.org/schema/cxf";
    xsi:schemaLocation="
        http://www.springframework.org/schema/beans
        http://www.springframework.org/schema/beans/spring-beans.xsd
        http://www.springframework.org/schema/context
        http://www.springframework.org/schema/context/spring-context.xsd
        http://www.springframework.org/schema/osgi
        http://www.springframework.org/schema/osgi/spring-osgi.xsd
        http://camel.apache.org/schema/osgi
        http://camel.apache.org/schema/osgi/camel-osgi.xsd
        http://camel.apache.org/schema/spring
        http://camel.apache.org/schema/spring/camel-spring.xsd
        http://camel.apache.org/schema/cxf
        http://camel.apache.org/schema/cxf/camel-cxf.xsd
        http://www.springframework.org/schema/osgi-compendium

http://www.springframework.org/schema/osgi-compendium/spring-osgi-compendium.xsd
">


   <import resource="classpath:META-INF/cxf/cxf.xml" />
   <import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
   <import resource="classpath:META-INF/cxf/cxf-extension-http.xml" />
   <import resource="classpath:META-INF/cxf/osgi/cxf-extension-osgi.xml" />


   <context:property-placeholder properties-ref="camelProps"/>

   <!--
   <context:property-override properties-ref="camelProps"/>
    -->

    <bean id="bindyDataformat"
class="org.apache.camel.dataformat.bindy.csv.BindyCsvDataFormat">
        <constructor-arg
value="org.apache.camel.example.reportincident.model" />
    </bean>

    <bean id="incidentSaver"
class="org.apache.camel.example.reportincident.internal.IncidentSaver">
        <property name="incidentService">
            <osgi:reference
interface="org.apache.camel.example.reportincident.service.IncidentService"/>
        </property>
    </bean>

    <bean id="webservice"
class="org.apache.camel.example.reportincident.internal.WebService" />
    <bean id="feedback"
class="org.apache.camel.example.reportincident.internal.Feedback" />

    <!-- webservice endpoint -->
    <cxf:cxfEndpoint id="reportIncident"
        address="/camel-example/incident"

serviceClass="org.apache.camel.example.reportincident.ReportIncidentEndpoint"
        xmlns:s="http://reportincident.example.camel.apache.org";>
    </cxf:cxfEndpoint>

    <osgi:reference id="queuingservice"
interface="org.apache.camel.Component" />

    <camel:camelContext trace="true" xmlns="
http://camel.apache.org/schema/osgi";>

        <camel:route>
            <camel:from
uri="file://d:/temp/data/reportincident/?move=d:/temp/backup/${date:now:yyyyMMdd}/${file:name.noext}.bak"/>
            <camel:setHeader headerName="origin">
                <camel:constant>file</camel:constant>
            </camel:setHeader>
            <camel:unmarshal ref="bindyDataformat" />
            <camel:to uri="queuingservice:queue:in" />
            <!-- queuingservice:queue:in  -->
        </camel:route>

        <camel:route>
            <camel:from uri="queuingservice:queue:in" />
            <camel:to uri="bean:incidentSaver?method=process" />
        </camel:route>

        <camel:route>
            <camel:from uri="cxf:bean:reportIncident" />
            <camel:setHeader headerName="origin">
                <camel:constant>webservice</camel:constant>
            </camel:setHeader>
            <camel:convertBodyTo
type="org.apache.camel.example.reportincident.InputReportIncident" />
            <camel:to uri="bean:webservice" />
            <camel:inOnly uri="queuingservice:queue:in" />
            <camel:transform>
                <camel:method bean="feedback" method="setOk" />
            </camel:transform>

        </camel:route>
    </camel:camelContext>

    <osgix:cm-properties id="camelProps"
persistent-id="org.apache.camel.example.reportincident.routing" />

</beans>


All the bundles are strated in karaf

Kind regards,

Charles Moulliard
Senior Enterprise Architect
Apache Camel Committer

*****************************
blog : http://cmoulliard.blogspot.com
twitter : http://twitter.com/cmoulliard
Linkedlin : http://www.linkedin.com/in/charlesmoulliard

Apache Camel Group :
http://www.linkedin.com/groups?home=&gid=2447439&trk=anet_ug_hm


On Wed, Mar 31, 2010 at 3:50 PM, Willem Jiang <willem.ji...@gmail.com>wrote:

> Hi Charles,
>
> You are using the cxf osgi transport, can you check the karaf log to see if
> the camel-cxf endpoint start up rightly?
>
> BTW, can you show me the camel route and the camel-cxf endpoint
> configuration?
>
> Willem
>
>
> Charles Moulliard wrote:
>
>> Hi,
>>
>> I try to test the camel tutorial using camel 2.2.0 & cxf 2.2.6 on karaf
>> 1.4
>> and get this error :
>>
>>  <head>
>>      <meta http-equiv="Content-Type" content="text/html;
>> charset=ISO-8859-1"/>
>>      <title>Error 500 INTERNAL_SERVER_ERROR</title>
>>   </head>
>>   <body>
>>      <h2>HTTP ERROR 500</h2>
>>      <p>
>>         Problem accessing /cxf/camel-example/incident. Reason:
>>         <pre>INTERNAL_SERVER_ERROR</pre>
>>      </p>
>>      <h3>Caused by:</h3>
>>      <pre>java.lang.NullPointerException
>>    at
>>
>> org.apache.cxf.transport.http_osgi.OsgiDestination.doMessage(OsgiDestination.java:79)
>>    at
>>
>> org.apache.cxf.transport.http_osgi.OsgiServletController.invokeDestination(OsgiServletController.java:327)
>>    at
>>
>> org.apache.cxf.transport.http_osgi.OsgiServletController.invoke(OsgiServletController.java:151)
>>    at
>> org.apache.cxf.transport.http_osgi.OsgiServlet.invoke(OsgiServlet.java:53)
>>    at
>>
>> org.apache.cxf.transport.http_osgi.SpringOsgiServlet.invoke(SpringOsgiServlet.java:48)
>>    at
>>
>> org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:179)
>>    at
>>
>> org.apache.cxf.transport.servlet.AbstractHTTPServlet.doPost(AbstractHTTPServlet.java:103)
>>    at javax.servlet.http.HttpServlet.service(HttpServlet.java:713)
>>    at
>>
>> org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:159)
>>    at
>> org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:502)
>>    at
>> org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:389)
>>    at
>>
>> org.ops4j.pax.web.service.jetty.internal.HttpServiceServletHandler.handle(HttpServiceServletHandler.java:64)
>>    at
>> org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
>>    at
>> org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765)
>>    at
>>
>> org.ops4j.pax.web.service.jetty.internal.HttpServiceContext.handle(HttpServiceContext.java:111)
>>    at
>>
>> org.ops4j.pax.web.service.jetty.internal.JettyServerHandlerCollection.handle(JettyServerHandlerCollection.java:64)
>>    at
>> org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
>>    at org.mortbay.jetty.Server.handle(Server.java:326)
>>    at
>> org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:534)
>>    at
>>
>> org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:879)
>>    at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:747)
>>    at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:218)
>>    at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
>>    at
>>
>> org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:409)
>>    at
>>
>> org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:520)</pre>
>>      <hr/>
>>      <i>
>>         <small>Powered by Jetty://</small>
>>      </i>
>>
>>
>> Any idea is welcome ?
>>
>> Kind regards,
>>
>> Charles Moulliard
>> Senior Enterprise Architect
>> Apache Camel Committer
>>
>> *****************************
>> blog : http://cmoulliard.blogspot.com
>> twitter : http://twitter.com/cmoulliard
>> Linkedlin : http://www.linkedin.com/in/charlesmoulliard
>>
>> Apache Camel Group :
>> http://www.linkedin.com/groups?home=&gid=2447439&trk=anet_ug_hm
>>
>>
>

Reply via email to