[
https://issues.apache.org/jira/browse/CAMEL-7722?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14105003#comment-14105003
]
Willem Jiang commented on CAMEL-7722:
-------------------------------------
In camel EIP, split, multicast, threads could switch the calling thread in
camel route. With the help of the Camel interceptor, we can setup the TCCL
from the camel route.
After digging the stack trace of SWITCHYARD-2220, we could set up the TCCL
before the BaseResolver create the instance, to let the CdiInject work rightly.
In this way we don't need to setup the TCCL from the component consumer side.
So I created a new JIRA CAMEL-7728 to address the issue SWITCHYARD-2220.
> from("mqtt:...") route can't load a file in the application bundle on karaf
> ---------------------------------------------------------------------------
>
> Key: CAMEL-7722
> URL: https://issues.apache.org/jira/browse/CAMEL-7722
> Project: Camel
> Issue Type: Bug
> Components: camel-mqtt
> Reporter: Tomohisa Igarashi
> Assignee: Willem Jiang
> Attachments: camel-example-mqtt.tar.gz
>
>
> Loading a file in the application bundle through TCCL fails if the route
> starts from MQTT consumer while it succeeds if it starts from file consumer.
> Apparently MQTT consumer executing thread should be using
> BundleDelegatingClassLoader like file consumer, but it's using
> sun.misc.Launcher$AppClassLoader.
> {code}
> 2014-08-19 16:34:14,035 | INFO | tmp/myfileinput/ | MyBean
> | apache.camel.example.mqtt.MyBean 25 | 124 -
> org.apache.camel.camel-example-mqtt - 2.12.2 | ##### #####
> META-INF/myresource.txt>>>foobar ##### #####
> ClassLoader=BundleDelegatingClassLoader(org.apache.camel.camel-example-mqtt
> [124])
> 2014-08-19 16:34:14,075 | ERROR | spatch-DEFAULT-2 | DefaultErrorHandler
> | rg.apache.camel.util.CamelLogger 215 | 116 -
> org.apache.camel.camel-core - 2.12.2 | Failed delivery for (MessageId:
> ID-tomo-t530-47023-1408432602776-3-7 on ExchangeId:
> ID-tomo-t530-47023-1408432602776-3-8). Exhausted after delivery attempt: 1
> caught: java.io.FileNotFoundException: ##### ##### META-INF/myresource.txt
> not found ##### ##### ClassLoader=sun.misc.Launcher$AppClassLoader@29d22104
> Message History
> ---------------------------------------------------------------------------------------------------------------------------------------
> RouteId ProcessorId Processor
> Elapsed (ms)
> [route4 ] [route4 ]
> [mqtt://input?password=xxxxxx&subscribeTopicName=testTopicIn&userName=karaf
> ] [ 3]
> [route4 ] [removeProperty4 ]
> [removeProperty[MQTTTopicPropertyName]
> ] [ 0]
> [route4 ] [bean4 ] [bean[ref:myBean]
> ] [ 0]
> Exchange
> ---------------------------------------------------------------------------------------------------------------------------------------
> Exchange[
> Id ID-tomo-t530-47023-1408432602776-3-8
> ExchangePattern InOnly
> Headers {breadcrumbId=ID-tomo-t530-47023-1408432602776-3-7,
> CamelRedelivered=false, CamelRedeliveryCounter=0}
> BodyType byte[]
> Body test mqtt
> ]
> Stacktrace
> ---------------------------------------------------------------------------------------------------------------------------------------
> java.io.FileNotFoundException: ##### ##### META-INF/myresource.txt not found
> ##### ##### ClassLoader=sun.misc.Launcher$AppClassLoader@29d22104
> at org.apache.camel.example.mqtt.MyBean.process(MyBean.java:20)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
> Method)[:1.7.0_65]
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)[:1.7.0_65]
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)[:1.7.0_65]
> at java.lang.reflect.Method.invoke(Method.java:606)[:1.7.0_65]
> at
> org.apache.camel.component.bean.MethodInfo.invoke(MethodInfo.java:407)[116:org.apache.camel.camel-core:2.12.2]
> at
> org.apache.camel.component.bean.MethodInfo$1.doProceed(MethodInfo.java:278)[116:org.apache.camel.camel-core:2.12.2]
> at
> org.apache.camel.component.bean.MethodInfo$1.proceed(MethodInfo.java:251)[116:org.apache.camel.camel-core:2.12.2]
> at
> org.apache.camel.component.bean.BeanProcessor.process(BeanProcessor.java:166)[116:org.apache.camel.camel-core:2.12.2]
> at
> org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:72)[116:org.apache.camel.camel-core:2.12.2]
> at
> org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:398)[116:org.apache.camel.camel-core:2.12.2]
> at
> org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:191)[116:org.apache.camel.camel-core:2.12.2]
> at
> org.apache.camel.processor.Pipeline.process(Pipeline.java:118)[116:org.apache.camel.camel-core:2.12.2]
> at
> org.apache.camel.processor.Pipeline.process(Pipeline.java:80)[116:org.apache.camel.camel-core:2.12.2]
> at
> org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:191)[116:org.apache.camel.camel-core:2.12.2]
> at
> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:105)[116:org.apache.camel.camel-core:2.12.2]
> at
> org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:87)[116:org.apache.camel.camel-core:2.12.2]
> at
> org.apache.camel.component.mqtt.MQTTConsumer.processExchange(MQTTConsumer.java:46)[122:org.apache.camel.camel-mqtt:2.12.2]
> at
> org.apache.camel.component.mqtt.MQTTEndpoint$1.onPublish(MQTTEndpoint.java:90)[122:org.apache.camel.camel-mqtt:2.12.2]
> at
> org.fusesource.mqtt.client.CallbackConnection.toReceiver(CallbackConnection.java:815)[118:org.fusesource.mqtt-client.mqtt-client:1.6]
> at
> org.fusesource.mqtt.client.CallbackConnection.processFrame(CallbackConnection.java:732)[118:org.fusesource.mqtt-client.mqtt-client:1.6]
> at
> org.fusesource.mqtt.client.CallbackConnection.access$1500(CallbackConnection.java:51)[118:org.fusesource.mqtt-client.mqtt-client:1.6]
> at
> org.fusesource.mqtt.client.CallbackConnection$6.onTransportCommand(CallbackConnection.java:392)[118:org.fusesource.mqtt-client.mqtt-client:1.6]
> at
> org.fusesource.hawtdispatch.transport.TcpTransport.drainInbound(TcpTransport.java:664)[120:org.fusesource.hawtdispatch.hawtdispatch-transport:1.18.0]
> at
> org.fusesource.hawtdispatch.transport.TcpTransport$6.run(TcpTransport.java:543)[120:org.fusesource.hawtdispatch.hawtdispatch-transport:1.18.0]
> at
> org.fusesource.hawtdispatch.internal.NioDispatchSource$3.run(NioDispatchSource.java:209)[119:org.fusesource.hawtdispatch.hawtdispatch:1.18.0]
> at
> org.fusesource.hawtdispatch.internal.SerialDispatchQueue.run(SerialDispatchQueue.java:100)[119:org.fusesource.hawtdispatch.hawtdispatch:1.18.0]
> at
> org.fusesource.hawtdispatch.internal.pool.SimpleThread.run(SimpleThread.java:77)[119:org.fusesource.hawtdispatch.hawtdispatch:1.18.0]
> {code}
> I'll attach a reproducer soon.
--
This message was sent by Atlassian JIRA
(v6.2#6252)