Hi

You cannot use the DefaultCamelContext, you have to use an OSGi one.
Also the package scan should be osgi aware.

Though its often easier to use a blueprint xml file to bootstrap Camel
in OSGi as it setup all the OSGi stuff for you.

Though in camel-core-osgi there is the osgi pieces you would need to
do this manually.


On Mon, Sep 30, 2013 at 12:10 PM, mabels <meno.ab...@adviser.com> wrote:
> Hello,
>
> what you mean how i run it, i have a small bundle which i start with
> osgi::install ...
> in karaf. In prepartion i loaded all needed camel features.
> The Activator looks like this:
>
>     final CamelContext camelContext = new DefaultCamelContext();
>     camelContext.disableJMX();
>     DefaultPackageScanClassResolver defaultPackageScanClassResolver = new
> DefaultPackageScanClassResolver();
>     camelContext.addComponent("filer", new FilerComponent());
>     try {
>       camelContext.addRoutes(new RouteBuilder() {
>         public void configure() {
>           DataFormat bindy = new ShopFeedProdukt();
>
>           from("file:///tmp/input")
>               .split(org.apache.camel.component.stax.StAXBuilder
>                   .stax(ShopFeedProdukt.class, false))
>               .streaming()
>               .marshal(bindy)
>               //.marshal().bindy(BindyType.Csv,
> "org.apache.camel.bindy.model")
>               //.marshal(new BindyCsvDataFormat(ShopFeedProdukt.class))
>               .to("filer:///tmp/output?suffix=.csv")
>               .end();
>
>         }
>       });
>       camelContext.start();
>
> Hopefully this helps
>
> meno
>
>
> On Mon, Sep 30, 2013 at 12:05 PM, Claus Ibsen-2 [via Camel] <
> ml-node+s465427n5740473...@n5.nabble.com> wrote:
>
>> Hi
>>
>> How do you run it in OSGi / Karaf?
>>
>> On Sun, Sep 29, 2013 at 10:38 PM, mabels <[hidden 
>> email]<http://user/SendEmail.jtp?type=node&node=5740473&i=0>>
>> wrote:
>>
>> > Hey,
>> >
>> > i have the following camel route:
>> >
>> > from("file:///tmp/input")
>> >         .split(StAXBuilder.stax(ShopFeedProdukt.class, false))
>> >         .streaming()
>> >         .marshal(new ShopFeedProdukt())
>> >         //.marshal().bindy(BindyType.Csv,
>> "org.apache.camel.bindy.model")
>> >         //.marshal(new BindyCsvDataFormat(ShopFeedProdukt.class))
>> >         .to("filer:///tmp/output?suffix=.csv")
>> >         .end();
>> >
>> > I tried the three marshal implementation. But i get on every
>> implementations
>> > the
>> > same error, if I run this route in a osgi runtime like karaf. If I run
>> it
>> > without
>> > osgi it runs without a problem.
>> >
>> > Here is the stacktrace it is the same for all marshal implementation i
>> > tried.
>> >
>> > java.lang.NullPointerException
>> >         at
>> >
>> org.apache.camel.dataformat.bindy.util.ConverterUtils.getByteReturn(ConverterUtils.java:41)[64:org.apache.camel.camel-bindy:2.12.1]
>>
>> >         at
>> >
>> org.apache.camel.dataformat.bindy.csv.BindyCsvDataFormat.marshal(BindyCsvDataFormat.java:67)[64:org.apache.camel.camel-bindy:2.12.1]
>>
>> >         at
>> >
>> org.apache.camel.processor.MarshalProcessor.process(MarshalProcessor.java:81)[61:org.apache.camel.camel-core:2.12.1]
>>
>> >         at
>> >
>> org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:398)[61:org.apache.camel.camel-core:2.12.1]
>>
>> >         at
>> >
>> org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:191)[61:org.apache.camel.camel-core:2.12.1]
>>
>> >         at
>> >
>> org.apache.camel.processor.Pipeline.process(Pipeline.java:118)[61:org.apache.camel.camel-core:2.12.1]
>>
>> >         at
>> >
>> org.apache.camel.processor.Pipeline.process(Pipeline.java:80)[61:org.apache.camel.camel-core:2.12.1]
>>
>> >         at
>> >
>> org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:398)[61:org.apache.camel.camel-core:2.12.1]
>>
>> >         at
>> >
>> org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:191)[61:org.apache.camel.camel-core:2.12.1]
>>
>> >         at
>> >
>> org.apache.camel.processor.MulticastProcessor.doProcessSequential(MulticastProcessor.java:573)[61:org.apache.camel.camel-core:2.12.1]
>>
>> >         at
>> >
>> org.apache.camel.processor.MulticastProcessor.doProcessSequential(MulticastProcessor.java:506)[61:org.apache.camel.camel-core:2.12.1]
>>
>> >         at
>> >
>> org.apache.camel.processor.MulticastProcessor.process(MulticastProcessor.java:215)[61:org.apache.camel.camel-core:2.12.1]
>>
>> >         at
>> >
>> org.apache.camel.processor.Splitter.process(Splitter.java:98)[61:org.apache.camel.camel-core:2.12.1]
>>
>> >         at
>> >
>> org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:398)[61:org.apache.camel.camel-core:2.12.1]
>>
>> >         at
>> >
>> org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:191)[61:org.apache.camel.camel-core:2.12.1]
>>
>> >         at
>> >
>> org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:191)[61:org.apache.camel.camel-core:2.12.1]
>>
>> >         at
>> >
>> org.apache.camel.component.file.GenericFileConsumer.processExchange(GenericFileConsumer.java:401)[61:org.apache.camel.camel-core:2.12.1]
>>
>> >         at
>> >
>> org.apache.camel.component.file.GenericFileConsumer.processBatch(GenericFileConsumer.java:201)[61:org.apache.camel.camel-core:2.12.1]
>>
>> >         at
>> >
>> org.apache.camel.component.file.GenericFileConsumer.poll(GenericFileConsumer.java:165)[61:org.apache.camel.camel-core:2.12.1]
>>
>> >         at
>> >
>> org.apache.camel.impl.ScheduledPollConsumer.doRun(ScheduledPollConsumer.java:187)[61:org.apache.camel.camel-core:2.12.1]
>>
>> >         at
>> >
>> org.apache.camel.impl.ScheduledPollConsumer.run(ScheduledPollConsumer.java:114)[61:org.apache.camel.camel-core:2.12.1]
>>
>> >         at
>> >
>> java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:439)[:1.6.0_51]
>>
>> >         at
>> >
>> java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:317)[:1.6.0_51]
>>
>> >         at
>> >
>> java.util.concurrent.FutureTask.runAndReset(FutureTask.java:150)[:1.6.0_51]
>> >         at
>> >
>> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(ScheduledThreadPoolExecutor.java:98)[:1.6.0_51]
>>
>> >         at
>> >
>> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodic(ScheduledThreadPoolExecutor.java:180)[:1.6.0_51]
>>
>> >         at
>> >
>> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:204)[:1.6.0_51]
>>
>> >         at
>> >
>> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)[:1.6.0_51]
>>
>> >         at
>> >
>> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)[:1.6.0_51]
>>
>> >         at java.lang.Thread.run(Thread.java:680)[:1.6.0_51]
>> >
>> > Does somebody has an idea what i can do to make it work?
>> >
>> > thx
>> >
>> > meno
>> >
>> >
>> >
>> >
>> >
>> > --
>> > View this message in context:
>> http://camel.465427.n5.nabble.com/OSGI-marshal-and-bindy-tp5740434.html
>> > Sent from the Camel - Users mailing list archive at Nabble.com.
>>
>>
>>
>> --
>> Claus Ibsen
>> -----------------
>> Red Hat, Inc.
>> Email: [hidden email]<http://user/SendEmail.jtp?type=node&node=5740473&i=1>
>> Twitter: davsclaus
>> Blog: http://davsclaus.com
>> Author of Camel in Action: http://www.manning.com/ibsen
>>
>>
>> ------------------------------
>>  If you reply to this email, your message will be added to the discussion
>> below:
>>
>> http://camel.465427.n5.nabble.com/OSGI-marshal-and-bindy-tp5740434p5740473.html
>>  To unsubscribe from OSGI marshal and bindy, click 
>> here<http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=5740434&code=bWVuby5hYmVsc0BhZHZpc2VyLmNvbXw1NzQwNDM0fC0yNDY4NTM4NDc=>
>> .
>> NAML<http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>>
>
>
>
>
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/OSGI-marshal-and-bindy-tp5740434p5740479.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cib...@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen

Reply via email to