camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sorin Silaghi <sorin7...@gmail.com>
Subject Re: can't get freemarker component to work with XML content.
Date Thu, 21 Apr 2011 08:56:53 GMT
Hi

    The version of Freemarker I'm using is 2.3.16 while the version in the
camel component seems to be 2.3.15. I thought this wasn't relevant but now
that you mention it I'll try to build my processor with 2.3.15 to see if I
can reproduce the error.

    Also here's the code to my processor: http://pastebin.com/LLGyux1J


Sorin.

On Thu, Apr 21, 2011 at 11:44 AM, Claus Ibsen <claus.ibsen@gmail.com> wrote:

> Hi
>
> You get a NPE in freemaker. Maybe there is a never release of
> freemarker you can try with? Also maybe consider reporting the NPE to
> freemarker so they can get that fixed.
>
> Caused by: java.lang.NullPointerException
>   at
> freemarker.template.utility.StringUtil.matchesName(StringUtil.java:1111)
>   at freemarker.ext.dom.ElementModel.matchesName(ElementModel.java:208)
>   at freemarker.ext.dom.DocumentModel.get(DocumentModel.java:87)
>   ... 52 more
>
>
> Can you also provide an unit test / sample code what you do inside the
> processor that works?
> Maybe we can use that to look into camel-freemarker. Maybe there is
> something there we can do to workaround the issue.
>
>
> On Wed, Apr 20, 2011 at 5:04 PM, Sorin Silaghi <sorin7486@gmail.com>
> wrote:
> > Hi all,
> >
> >
> >       I'm using camel inside servicemix to process some files and I can't
> > get the freemarker component to work propperly with XML content. Here's
> what
> > I did:
> >
> >       I created a processor to convert the body of the exchange message
> > from String to NodeModel. If I then use freemarker right in the processor
> to
> > apply the template it all works fine. But if I pass it along to the
> > camel-freemarker component the exception you can see below.
> >
> >       Is there an example somewhere of how to do this ? I expected this
> to
> > be a fairly comon usecase but I can't seem to find mutch about it.
> >
> > 17:55:20,559 | ERROR | 703e5f9-thread-4 | DefaultErrorHandler
>  |
> > 68 - org.apache.camel.camel-core - 2.6.0.fuse-01-09 | Failed delivery for
> > exchangeId: ID-moredevs5-34851-1303311211406-5-27. Exhausted after
> delivery
> > attempt: 1 caught: freemarker.template.TemplateModelException:
> > get(Warensendungen) failed on instance of
> freemarker.ext.dom.DocumentModel
> > freemarker.template.TemplateModelException: get(Warensendungen) failed on
> > instance of freemarker.ext.dom.DocumentModel
> >    at
> >
> freemarker.ext.beans.BeanModel.get(BeanModel.java:223)[306:org.apache.servicemix.bundles.freemarker:2.3.15.4]
> >    at
> >
> freemarker.core.DynamicKeyName.dealWithStringKey(DynamicKeyName.java:136)[306:org.apache.servicemix.bundles.freemarker:2.3.15.4]
> >    at
> >
> freemarker.core.DynamicKeyName._getAsTemplateModel(DynamicKeyName.java:94)[306:org.apache.servicemix.bundles.freemarker:2.3.15.4]
> >    at
> >
> freemarker.core.Expression.getAsTemplateModel(Expression.java:89)[306:org.apache.servicemix.bundles.freemarker:2.3.15.4]
> >    at
> >
> freemarker.core.NodeBuiltins$NodeBuiltIn._getAsTemplateModel(NodeBuiltins.java:69)[306:org.apache.servicemix.bundles.freemarker:2.3.15.4]
> >    at
> >
> freemarker.core.Expression.getAsTemplateModel(Expression.java:89)[306:org.apache.servicemix.bundles.freemarker:2.3.15.4]
> >    at
> >
> freemarker.core.IteratorBlock.accept(IteratorBlock.java:94)[306:org.apache.servicemix.bundles.freemarker:2.3.15.4]
> >    at
> >
> freemarker.core.Environment.visit(Environment.java:209)[306:org.apache.servicemix.bundles.freemarker:2.3.15.4]
> >    at
> >
> freemarker.core.MixedContent.accept(MixedContent.java:92)[306:org.apache.servicemix.bundles.freemarker:2.3.15.4]
> >    at
> >
> freemarker.core.Environment.visit(Environment.java:209)[306:org.apache.servicemix.bundles.freemarker:2.3.15.4]
> >    at
> >
> freemarker.core.Environment.process(Environment.java:189)[306:org.apache.servicemix.bundles.freemarker:2.3.15.4]
> >    at
> >
> freemarker.template.Template.process(Template.java:237)[306:org.apache.servicemix.bundles.freemarker:2.3.15.4]
> >    at
> >
> org.apache.camel.component.freemarker.FreemarkerEndpoint.onExchange(FreemarkerEndpoint.java:143)[307:org.apache.camel.camel-freemarker:2.6.0.fuse-01-09]
> >    at
> >
> org.apache.camel.impl.ProcessorEndpoint$1.process(ProcessorEndpoint.java:72)[68:org.apache.camel.camel-core:2.6.0.fuse-01-09]
> >    at
> >
> org.apache.camel.impl.converter.AsyncProcessorTypeConverter$ProcessorToAsyncProcessorBridge.process(AsyncProcessorTypeConverter.java:50)[68:org.apache.camel.camel-core:2.6.0.fuse-01-09]
> >    at
> >
> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:70)[68:org.apache.camel.camel-core:2.6.0.fuse-01-09]
> >    at
> >
> org.apache.camel.processor.SendProcessor$2.doInAsyncProducer(SendProcessor.java:104)[68:org.apache.camel.camel-core:2.6.0.fuse-01-09]
> >    at
> >
> org.apache.camel.impl.ProducerCache.doInAsyncProducer(ProducerCache.java:272)[68:org.apache.camel.camel-core:2.6.0.fuse-01-09]
> >    at
> >
> org.apache.camel.processor.SendProcessor.process(SendProcessor.java:98)[68:org.apache.camel.camel-core:2.6.0.fuse-01-09]
> >    at
> >
> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:70)[68:org.apache.camel.camel-core:2.6.0.fuse-01-09]
> >    at
> >
> org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:98)[68:org.apache.camel.camel-core:2.6.0.fuse-01-09]
> >    at
> >
> org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:89)[68:org.apache.camel.camel-core:2.6.0.fuse-01-09]
> >    at
> >
> org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:68)[68:org.apache.camel.camel-core:2.6.0.fuse-01-09]
> >    at
> >
> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:70)[68:org.apache.camel.camel-core:2.6.0.fuse-01-09]
> >    at
> >
> org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:98)[68:org.apache.camel.camel-core:2.6.0.fuse-01-09]
> >    at
> >
> org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:89)[68:org.apache.camel.camel-core:2.6.0.fuse-01-09]
> >    at
> >
> org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:174)[68:org.apache.camel.camel-core:2.6.0.fuse-01-09]
> >    at
> >
> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:70)[68:org.apache.camel.camel-core:2.6.0.fuse-01-09]
> >    at
> >
> org.apache.camel.processor.RedeliveryErrorHandler.processErrorHandler(RedeliveryErrorHandler.java:299)[68:org.apache.camel.camel-core:2.6.0.fuse-01-09]
> >    at
> >
> org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:208)[68:org.apache.camel.camel-core:2.6.0.fuse-01-09]
> >    at
> >
> org.apache.camel.processor.DefaultChannel.process(DefaultChannel.java:269)[68:org.apache.camel.camel-core:2.6.0.fuse-01-09]
> >    at
> >
> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:70)[68:org.apache.camel.camel-core:2.6.0.fuse-01-09]
> >    at
> >
> org.apache.camel.processor.Pipeline.process(Pipeline.java:125)[68:org.apache.camel.camel-core:2.6.0.fuse-01-09]
> >    at
> >
> org.apache.camel.processor.Pipeline.process(Pipeline.java:80)[68:org.apache.camel.camel-core:2.6.0.fuse-01-09]
> >    at
> >
> org.apache.camel.processor.UnitOfWorkProcessor.process(UnitOfWorkProcessor.java:102)[68:org.apache.camel.camel-core:2.6.0.fuse-01-09]
> >    at
> >
> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:70)[68:org.apache.camel.camel-core:2.6.0.fuse-01-09]
> >    at
> >
> org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:98)[68:org.apache.camel.camel-core:2.6.0.fuse-01-09]
> >    at
> >
> org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:89)[68:org.apache.camel.camel-core:2.6.0.fuse-01-09]
> >    at
> >
> org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:68)[68:org.apache.camel.camel-core:2.6.0.fuse-01-09]
> >    at
> >
> org.apache.servicemix.camel.nmr.ServiceMixConsumer.process(ServiceMixConsumer.java:78)[209:org.apache.servicemix.camel.component:4.3.1.fuse-01-09]
> >    at
> >
> org.apache.servicemix.nmr.core.InternalEndpointWrapper.process(InternalEndpointWrapper.java:86)[81:org.apache.servicemix.nmr.core:1.4.0.fuse-01-09]
> >    at
> >
> org.apache.servicemix.nmr.core.ChannelImpl.process(ChannelImpl.java:255)[81:org.apache.servicemix.nmr.core:1.4.0.fuse-01-09]
> >    at
> >
> org.apache.servicemix.nmr.core.ChannelImpl$1.run(ChannelImpl.java:215)[81:org.apache.servicemix.nmr.core:1.4.0.fuse-01-09]
> >    at
> >
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)[:1.6.0_20]
> >    at
> >
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)[:1.6.0_20]
> >    at java.lang.Thread.run(Thread.java:636)[:1.6.0_20]
> > Caused by: java.lang.reflect.InvocationTargetException
> >    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
> > Method)[:1.6.0_20]
> >    at
> >
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)[:1.6.0_20]
> >    at
> >
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)[:1.6.0_20]
> >    at java.lang.reflect.Method.invoke(Method.java:616)[:1.6.0_20]
> >    at
> >
> freemarker.ext.beans.BeansWrapper.invokeMethod(BeansWrapper.java:840)[306:org.apache.servicemix.bundles.freemarker:2.3.15.4]
> >    at
> >
> freemarker.ext.beans.BeanModel.invokeGenericGet(BeanModel.java:318)[306:org.apache.servicemix.bundles.freemarker:2.3.15.4]
> >    at
> >
> freemarker.ext.beans.BeanModel.get(BeanModel.java:185)[306:org.apache.servicemix.bundles.freemarker:2.3.15.4]
> >    ... 45 more
> > Caused by: java.lang.NullPointerException
> >    at
> > freemarker.template.utility.StringUtil.matchesName(StringUtil.java:1111)
> >    at freemarker.ext.dom.ElementModel.matchesName(ElementModel.java:208)
> >    at freemarker.ext.dom.DocumentModel.get(DocumentModel.java:87)
> >    ... 52 more
> >
>
>
>
> --
> Claus Ibsen
> -----------------
> FuseSource
> Email: cibsen@fusesource.com
> Web: http://fusesource.com
> CamelOne 2011: http://fusesource.com/camelone2011/
> Twitter: davsclaus
> Blog: http://davsclaus.blogspot.com/
> Author of Camel in Action: http://www.manning.com/ibsen/
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message