camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Markus Eisele <eisele.mar...@gmail.com>
Subject Re: com.sun.org.apache.xerces.internal.dom.TextImpl cannot be cast to java.lang.String
Date Fri, 24 Jul 2015 13:53:09 GMT
Hi,

here's the complete  Stacktrace.

@Claus: Agree. Sort of felt natural for me. Really surprise to see
this exception.

Cheers,
M


---------------------------------------------------------------------------------------------------------------------------------------:
java.lang.ClassCastException:
com.sun.org.apache.xerces.internal.dom.TextImpl cannot be cast to
java.lang.String
at net.eisele.camel.jpa.order.OrderService$$Lambda$2/347614965.accept(Unknown
Source)
at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1374)
[rt.jar:1.8.0_45]
at java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:580)
[rt.jar:1.8.0_45]
at net.eisele.camel.jpa.order.OrderService.handleOrder2(OrderService.java:80)
[classes:]
at net.eisele.camel.jpa.order.OrderService$Proxy$_$$_WeldSubclass.handleOrder2(Unknown
Source) [classes:]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.8.0_45]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
[rt.jar:1.8.0_45]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[rt.jar:1.8.0_45]
at java.lang.reflect.Method.invoke(Method.java:497) [rt.jar:1.8.0_45]
at org.jboss.weld.interceptor.proxy.SimpleInterceptionChain.interceptorChainCompleted(SimpleInterceptionChain.java:51)
[weld-core-impl-2.2.6.Final.jar:2014-10-03 10:05]
at org.jboss.weld.interceptor.chain.AbstractInterceptionChain.finish(AbstractInterceptionChain.java:148)
[weld-core-impl-2.2.6.Final.jar:2014-10-03 10:05]
at org.jboss.weld.interceptor.chain.AbstractInterceptionChain.invokeNextInterceptor(AbstractInterceptionChain.java:104)
[weld-core-impl-2.2.6.Final.jar:2014-10-03 10:05]
at org.jboss.weld.interceptor.proxy.InterceptorMethodHandler.executeInterception(InterceptorMethodHandler.java:43)
[weld-core-impl-2.2.6.Final.jar:2014-10-03 10:05]
at org.jboss.weld.interceptor.proxy.InterceptorMethodHandler.invoke(InterceptorMethodHandler.java:36)
[weld-core-impl-2.2.6.Final.jar:2014-10-03 10:05]
at org.jboss.weld.bean.proxy.CombinedInterceptorAndDecoratorStackMethodHandler.invoke(CombinedInterceptorAndDecoratorStackMethodHandler.java:51)
[weld-core-impl-2.2.6.Final.jar:2014-10-03 10:05]
at net.eisele.camel.jpa.order.OrderService$Proxy$_$$_WeldSubclass.handleOrder2(Unknown
Source) [classes:]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.8.0_45]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
[rt.jar:1.8.0_45]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[rt.jar:1.8.0_45]
at java.lang.reflect.Method.invoke(Method.java:497) [rt.jar:1.8.0_45]
at org.apache.camel.component.bean.MethodInfo.invoke(MethodInfo.java:408)
[camel-core-2.15.2.jar:2.15.2]
at org.apache.camel.component.bean.MethodInfo$1.doProceed(MethodInfo.java:279)
[camel-core-2.15.2.jar:2.15.2]
at org.apache.camel.component.bean.MethodInfo$1.proceed(MethodInfo.java:252)
[camel-core-2.15.2.jar:2.15.2]
at org.apache.camel.component.bean.BeanProcessor.process(BeanProcessor.java:171)
[camel-core-2.15.2.jar:2.15.2]
at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:77)
[camel-core-2.15.2.jar:2.15.2]
at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:448)
[camel-core-2.15.2.jar:2.15.2]
at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:191)
[camel-core-2.15.2.jar:2.15.2]
at org.apache.camel.processor.Pipeline.process(Pipeline.java:118)
[camel-core-2.15.2.jar:2.15.2]
at org.apache.camel.processor.Pipeline.process(Pipeline.java:80)
[camel-core-2.15.2.jar:2.15.2]
at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:191)
[camel-core-2.15.2.jar:2.15.2]
at org.apache.camel.component.direct.DirectProducer.process(DirectProducer.java:51)
[camel-core-2.15.2.jar:2.15.2]
at org.apache.camel.processor.SendProcessor.process(SendProcessor.java:129)
[camel-core-2.15.2.jar:2.15.2]
at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:77)
[camel-core-2.15.2.jar:2.15.2]
at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:448)
[camel-core-2.15.2.jar:2.15.2]
at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:191)
[camel-core-2.15.2.jar:2.15.2]
at org.apache.camel.processor.Pipeline.process(Pipeline.java:118)
[camel-core-2.15.2.jar:2.15.2]
at org.apache.camel.processor.Pipeline.process(Pipeline.java:80)
[camel-core-2.15.2.jar:2.15.2]
at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:191)
[camel-core-2.15.2.jar:2.15.2]
at org.apache.camel.component.direct.DirectProducer.process(DirectProducer.java:51)
[camel-core-2.15.2.jar:2.15.2]
at org.apache.camel.processor.SendProcessor.process(SendProcessor.java:129)
[camel-core-2.15.2.jar:2.15.2]
at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:77)
[camel-core-2.15.2.jar:2.15.2]
at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:448)
[camel-core-2.15.2.jar:2.15.2]
at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:191)
[camel-core-2.15.2.jar:2.15.2]
at org.apache.camel.processor.ChoiceProcessor.process(ChoiceProcessor.java:111)
[camel-core-2.15.2.jar:2.15.2]
at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:77)
[camel-core-2.15.2.jar:2.15.2]
at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:448)
[camel-core-2.15.2.jar:2.15.2]
at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:191)
[camel-core-2.15.2.jar:2.15.2]
at org.apache.camel.processor.Pipeline.process(Pipeline.java:118)
[camel-core-2.15.2.jar:2.15.2]
at org.apache.camel.processor.Pipeline.process(Pipeline.java:80)
[camel-core-2.15.2.jar:2.15.2]
at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:191)
[camel-core-2.15.2.jar:2.15.2]
at org.apache.camel.component.direct.DirectProducer.process(DirectProducer.java:51)
[camel-core-2.15.2.jar:2.15.2]
at org.apache.camel.processor.SendProcessor.process(SendProcessor.java:129)
[camel-core-2.15.2.jar:2.15.2]
at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:77)
[camel-core-2.15.2.jar:2.15.2]
at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:448)
[camel-core-2.15.2.jar:2.15.2]
at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:191)
[camel-core-2.15.2.jar:2.15.2]
at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:448)
[camel-core-2.15.2.jar:2.15.2]
at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:191)
[camel-core-2.15.2.jar:2.15.2]
at org.apache.camel.processor.MulticastProcessor.doProcessSequential(MulticastProcessor.java:652)
[camel-core-2.15.2.jar:2.15.2]
at org.apache.camel.processor.MulticastProcessor.doProcessSequential(MulticastProcessor.java:580)
[camel-core-2.15.2.jar:2.15.2]
at org.apache.camel.processor.MulticastProcessor.process(MulticastProcessor.java:227)
[camel-core-2.15.2.jar:2.15.2]
at org.apache.camel.processor.Splitter.process(Splitter.java:104)
[camel-core-2.15.2.jar:2.15.2]
at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:77)
[camel-core-2.15.2.jar:2.15.2]
at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:448)
[camel-core-2.15.2.jar:2.15.2]
at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:191)
[camel-core-2.15.2.jar:2.15.2]
at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:191)
[camel-core-2.15.2.jar:2.15.2]
at org.apache.camel.component.file.GenericFileConsumer.processExchange(GenericFileConsumer.java:435)
[camel-core-2.15.2.jar:2.15.2]
at org.apache.camel.component.file.GenericFileConsumer.processBatch(GenericFileConsumer.java:211)
[camel-core-2.15.2.jar:2.15.2]
at org.apache.camel.component.file.GenericFileConsumer.poll(GenericFileConsumer.java:175)
[camel-core-2.15.2.jar:2.15.2]
at org.apache.camel.impl.ScheduledPollConsumer.doRun(ScheduledPollConsumer.java:174)
[camel-core-2.15.2.jar:2.15.2]
at org.apache.camel.impl.ScheduledPollConsumer.run(ScheduledPollConsumer.java:101)
[camel-core-2.15.2.jar:2.15.2]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
[rt.jar:1.8.0_45]
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)
[rt.jar:1.8.0_45]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180)
[rt.jar:1.8.0_45]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)
[rt.jar:1.8.0_45]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
[rt.jar:1.8.0_45]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
[rt.jar:1.8.0_45]
at java.lang.Thread.run(Thread.java:745) [rt.jar:1.8.0_45]

On 24 July 2015 at 15:27, Claus Ibsen <claus.ibsen@gmail.com> wrote:
> On Fri, Jul 24, 2015 at 2:11 PM, Jakub Korab
> <jakub.korab.lists@gmail.com> wrote:
>> Try setting the return type from the xpath expression:
>>
>> .setHeader("isbns", xpath("/order//isbn/text()", List.class))
>>
>
> I wonder if a xpath with /text() works for a NodeList type, eg you
> will end up with a NodeList of 2 text values. Though it would feel
> natural to do so.
>
>
>
>> Jakub
>>
>>
>> On 24/07/15 13:05, Markus Eisele wrote:
>>>
>>> Hi,
>>>
>>> I was trying to convert a bunch of //text() Nodes selected via XPath
>>> into a List<String> and keep getting a ClassCastException.
>>>
>>> My input xml:
>>>
>>>    <isbn>9781617290450</isbn>
>>>   <isbn>9780132360280</isbn>
>>>
>>> The route
>>>
>>> .setHeader("isbns", xpath("/order//isbn/text()"))
>>> .bean(orderService, "handleOrder(${header[isbns]})")
>>>
>>> The Bean Method:
>>>
>>> public void handleOrder(List<String> orders) {
>>>
>>>          orders.stream().forEach((o) -> {
>>>              LOGGER.log(Level.INFO, "Order: {0}", o);
>>>          });
>>>
>>>
>>> Thanks for a hint.
>>>
>>> Cheers,
>>> Markus
>>
>>
>
>
>
> --
> Claus Ibsen
> -----------------
> http://davsclaus.com @davsclaus
> Camel in Action 2nd edition: http://www.manning.com/ibsen2

Mime
View raw message