camel-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Willem Jiang (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CAMEL-7722) from("mqtt:...") route can't load a file in the application bundle on karaf
Date Wed, 20 Aug 2014 06:30:27 GMT

    [ https://issues.apache.org/jira/browse/CAMEL-7722?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14103484#comment-14103484
] 

Willem Jiang commented on CAMEL-7722:
-------------------------------------

Hi Tomohisa,

You cannot assume that all the TCCL is set with the BundleDelegatingClassLoader, as there
are some thread which mqtt consumer is using is out of control of camel. It's not a issue
of camel-mqtt. 
To resolve this kind of issue, CamelContext provides a method getApplicationContextClassLoader
to find the classloader which is load the application. You can let MyBean to use that classloader
by lookup the camel context from the exchange.

Regards,
Willem

> 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)

Mime
View raw message