Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-7722

from("mqtt:...") route can't load a file in the application bundle on karaf

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Not A Problem
    • None
    • None
    • camel-mqtt
    • None
    • Unknown

    Description

      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.

      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]
      

      I'll attach a reproducer soon.

      Attachments

        1. camel-example-mqtt.tar.gz
          10 kB
          Tomohisa Igarashi

        Issue Links

          Activity

            People

              njiang Willem Jiang
              igarashitm Tomohisa Igarashi
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: