Camel
  1. Camel
  2. CAMEL-4781

Improving NoTypeConversionAvailableException message with cause

    Details

    • Type: Improvement Improvement
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.7.5, 2.8.4, 2.9.0
    • Component/s: camel-core
    • Labels:
      None
    • Estimated Complexity:
      Unknown

      Description

      The NoTypeConversionAvailableException message is misleading when it is caused by other exception.
      It just eats up the cause message and let us think there is no converter which can turn an InputStream
      into a Dom from theThe below exception stack trace.

      org.apache.camel.InvalidPayloadException: No body available of type: org.w3c.dom.Document but has value: sun.net.www.protocol.http.HttpURLConnection$HttpInputStream@4c4571c5 of 
      type: sun.net.www.protocol.http.HttpURLConnection.HttpInputStream on: Message: [Body is instance of java.io.InputStream]. Caused by: No type converter available to convert from type: 
      sun.net.www.protocol.http.HttpURLConnection.HttpInputStream to the required type: org.w3c.dom.Document with value 
      sun.net.www.protocol.http.HttpURLConnection$HttpInputStream@4c4571c5. Exchange[Message: [Body is instance of java.io.InputStream]]. Caused by: 
      [org.apache.camel.NoTypeConversionAvailableException - No type converter available to convert from type: sun.net.www.protocol.http.HttpURLConnection.HttpInputStream to the required 
      type: org.w3c.dom.Document with value sun.net.www.protocol.http.HttpURLConnection$HttpInputStream@4c4571c5]
      	at org.apache.camel.impl.MessageSupport.getMandatoryBody(MessageSupport.java:102)[89:org.apache.camel.camel-core:2.8.0.fuse-01-13]
      	at org.apache.camel.processor.ConvertBodyProcessor.process(ConvertBodyProcessor.java:58)[89:org.apache.camel.camel-core:2.8.0.fuse-01-13]
      	at org.apache.camel.impl.converter.AsyncProcessorTypeConverter$ProcessorToAsyncProcessorBridge.process(AsyncProcessorTypeConverter.java:50)[89:org.apache.camel.camel-core:2.8.0.fuse-01-13]
      	at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:78)[89:org.apache.camel.camel-core:2.8.0.fuse-01-13]
      	at org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:98)[89:org.apache.camel.camel-core:2.8.0.fuse-01-13]
      	at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:89)[89:org.apache.camel.camel-core:2.8.0.fuse-01-13]
      	at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:69)[89:org.apache.camel.camel-core:2.8.0.fuse-01-13]
      	at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:78)[89:org.apache.camel.camel-core:2.8.0.fuse-01-13]
      	at org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:98)[89:org.apache.camel.camel-core:2.8.0.fuse-01-13]
      	at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:89)[89:org.apache.camel.camel-core:2.8.0.fuse-01-13]
      	at org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:171)[89:org.apache.camel.camel-core:2.8.0.fuse-01-13]
      	at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:78)[89:org.apache.camel.camel-core:2.8.0.fuse-01-13]
      	at org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:98)[89:org.apache.camel.camel-core:2.8.0.fuse-01-13]
      	at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:89)[89:org.apache.camel.camel-core:2.8.0.fuse-01-13]
      	at org.apache.camel.fabric.FabricTraceProcessor.process(FabricTraceProcessor.java:59)[89:org.apache.camel.camel-core:2.8.0.fuse-01-13]
      	at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:78)[89:org.apache.camel.camel-core:2.8.0.fuse-01-13]
      	at org.apache.camel.processor.RedeliveryErrorHandler.processErrorHandler(RedeliveryErrorHandler.java:318)[89:org.apache.camel.camel-core:2.8.0.fuse-01-13]
      	at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:209)[89:org.apache.camel.camel-core:2.8.0.fuse-01-13]
      	at org.apache.camel.processor.DefaultChannel.process(DefaultChannel.java:306)[89:org.apache.camel.camel-core:2.8.0.fuse-01-13]
      	at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:78)[89:org.apache.camel.camel-core:2.8.0.fuse-01-13]
      	at org.apache.camel.processor.Pipeline.process(Pipeline.java:116)[89:org.apache.camel.camel-core:2.8.0.fuse-01-13]
      	at org.apache.camel.processor.Pipeline.access$100(Pipeline.java:42)[89:org.apache.camel.camel-core:2.8.0.fuse-01-13]
      	at org.apache.camel.processor.Pipeline$1.done(Pipeline.java:134)[89:org.apache.camel.camel-core:2.8.0.fuse-01-13]
      	at org.apache.camel.processor.DefaultChannel$1.done(DefaultChannel.java:317)[89:org.apache.camel.camel-core:2.8.0.fuse-01-13]
      	at org.apache.camel.processor.RedeliveryErrorHandler$1.done(RedeliveryErrorHandler.java:330)[89:org.apache.camel.camel-core:2.8.0.fuse-01-13]
      	at org.apache.camel.processor.interceptor.TraceInterceptor$1.done(TraceInterceptor.java:188)[89:org.apache.camel.camel-core:2.8.0.fuse-01-13]
      	at org.apache.camel.management.InstrumentationProcessor$1.done(InstrumentationProcessor.java:78)[89:org.apache.camel.camel-core:2.8.0.fuse-01-13]
      	at org.apache.camel.impl.ProducerCache$1.done(ProducerCache.java:307)[89:org.apache.camel.camel-core:2.8.0.fuse-01-13]
      	at org.apache.camel.processor.SendProcessor$2$1.done(SendProcessor.java:119)[89:org.apache.camel.camel-core:2.8.0.fuse-01-13]
      	at org.apache.camel.component.cxf.CxfClientCallback.handleResponse(CxfClientCallback.java:62)[143:org.apache.camel.camel-cxf:2.8.0.fuse-01-13]
      	at org.apache.cxf.endpoint.ClientImpl.onMessage(ClientImpl.java:818)[133:org.apache.cxf.bundle:2.4.3.fuse-00-13]
      	at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponseInternal(HTTPConduit.java:1626)[133:org.apache.cxf.bundle:2.4.3.fuse-00-13]
      	at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream$1.run(HTTPConduit.java:1498)[133:org.apache.cxf.bundle:2.4.3.fuse-00-13]
      	at org.apache.cxf.workqueue.AutomaticWorkQueueImpl$2.run(AutomaticWorkQueueImpl.java:353)[133:org.apache.cxf.bundle:2.4.3.fuse-00-13]
      	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)[:1.6.0_23]
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)[:1.6.0_23]
      	at java.lang.Thread.run(Thread.java:662)[:1.6.0_23]
      Caused by: org.apache.camel.NoTypeConversionAvailableException: No type converter available to convert from type: sun.net.www.protocol.http.HttpURLConnection.HttpInputStream to the 
      required type: org.w3c.dom.Document with value sun.net.www.protocol.http.HttpURLConnection$HttpInputStream@4c4571c5
      	at org.apache.camel.impl.converter.BaseTypeConverterRegistry.mandatoryConvertTo(BaseTypeConverterRegistry.java:140)[89:org.apache.camel.camel-core:2.8.0.fuse-01-13]
      	at org.apache.camel.core.osgi.OsgiTypeConverter.mandatoryConvertTo(OsgiTypeConverter.java:110)[91:org.apache.camel.camel-spring:2.8.0.fuse-01-13]
      	at org.apache.camel.impl.MessageSupport.getMandatoryBody(MessageSupport.java:100)[89:org.apache.camel.camel-core:2.8.0.fuse-01-13]
      	... 36 more
      Caused by: org.apache.camel.RuntimeCamelException: org.xml.sax.SAXParseException: Premature end of file.
      	at org.apache.camel.util.ObjectHelper.invokeMethod(ObjectHelper.java:832)[89:org.apache.camel.camel-core:2.8.0.fuse-01-13]
      	at org.apache.camel.impl.converter.InstanceMethodTypeConverter.convertTo(InstanceMethodTypeConverter.java:69)[89:org.apache.camel.camel-core:2.8.0.fuse-01-13]
      	at org.apache.camel.impl.converter.BaseTypeConverterRegistry.doConvertTo(BaseTypeConverterRegistry.java:182)[89:org.apache.camel.camel-core:2.8.0.fuse-01-13]
      	at org.apache.camel.impl.converter.BaseTypeConverterRegistry.mandatoryConvertTo(BaseTypeConverterRegistry.java:138)[89:org.apache.camel.camel-core:2.8.0.fuse-01-13]
      	... 38 more
      Caused by: org.xml.sax.SAXParseException: Premature end of file.
      	at org.apache.xerces.parsers.DOMParser.parse(Unknown Source)[:]
      	at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source)[:]
      	at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:110)[:]
      	at org.apache.camel.converter.jaxp.XmlConverter.toDOMDocument(XmlConverter.java:733)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)[:1.6.0_23]
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)[:1.6.0_23]
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)[:1.6.0_23]
      	at java.lang.reflect.Method.invoke(Method.java:597)[:1.6.0_23]
      	at org.apache.camel.util.ObjectHelper.invokeMethod(ObjectHelper.java:828)[89:org.apache.camel.camel-core:2.8.0.fuse-01-13]
      	... 41 more
      

        Activity

        Hide
        Willem Jiang added a comment -

        Applied patch into trunk, camel-2.8.x and camel-2.7.x branch.

        Show
        Willem Jiang added a comment - Applied patch into trunk, camel-2.8.x and camel-2.7.x branch.

          People

          • Assignee:
            Willem Jiang
            Reporter:
            Willem Jiang
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development