You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by frr0717 <fr...@gmail.com> on 2014/05/17 16:00:04 UTC

Using camel cxf proxy & MTOM got exception:Body is instance of java.io.InputStream

Hi, everyone :)
I followed the instructions on 
http://camel.apache.org/cxf-proxy-example.html
<http://camel.apache.org/cxf-proxy-example.html>   and 
http://cxf.apache.org/docs/mtom-attachments-with-jaxb.html
<http://cxf.apache.org/docs/mtom-attachments-with-jaxb.html>  , in order to
use camel cxf to proxy a webservice (using apache servicemix 5.0.0 as the
ESB).
If I seperate those two, everything worked fine. But when I want to enable
MTOM on the proxied webservice and the client, I got the following
exception:
16:14:28,076 | ERROR | qtp5339974-97    | DefaultErrorHandler              |
110 - org.apache.camel.camel-core - 2.12.3 | Failed delivery for (MessageId:
ID-BUPT-RongrongFu-57509-1400314391613-0-1 on ExchangeId:
ID-BUPT-RongrongFu-57509-1400314391613-0-2). Exhausted after delivery
attempt: 1 caught: org.apache.camel.CamelExecutionException: Exception
occurred during execution on the exchange: Exchange[Message: [Body is
instance of java.io.InputStream]]

Message History
---------------------------------------------------------------------------------------------------------------------------------------
RouteId              ProcessorId          Processor                                                                       
Elapsed (ms)
[route1            ] [route1            ]
[cxf://bean:SendMessageService?dataFormat=MESSAGE                             
] [       147]
[route1            ] [to1               ] [log:input                                                                    
] [         7]
[route1            ] [to2               ] [bean:enrichBean                                                              
] [       139]

Exchange
---------------------------------------------------------------------------------------------------------------------------------------
Exchange[
	Id                  ID-BUPT-RongrongFu-57509-1400314391613-0-2
	ExchangePattern     InOut
	Headers             {Accept=*/*,
breadcrumbId=ID-BUPT-RongrongFu-57509-1400314391613-0-1,
Cache-Control=no-cache,
CamelCxfMessage={org.apache.cxf.message.Message.PROTOCOL_HEADERS={Accept=[*/*],
Cache-Control=[no-cache], connection=[keep-alive],
content-type=[multipart/related; type="application/xop+xml";
boundary="uuid:5b61359d-9ec9-4d1d-bc79-98c20c66419b";
start="<ro...@cxf.apache.org>"; start-info="text/xml"],
Host=[localhost:9080], Pragma=[no-cache], SOAPAction=[""],
transfer-encoding=[chunked], User-Agent=[Apache CXF 2.7.11]},
HTTP_CONTEXT_MATCH_STRATEGY=stem,
org.apache.cxf.request.url=http://localhost:9080/camel-proxy/webservices/SendMessageService,
org.apache.cxf.request.uri=/camel-proxy/webservices/SendMessageService,
HTTP.REQUEST=(POST /camel-proxy/webservices/SendMessageService)@494093255
org.eclipse.jetty.server.Request@1d7343c7, HTTP.CONFIG=null,
org.apache.cxf.transport.https.CertConstraints=null, Accept=*/*,
org.apache.cxf.message.Message.PATH_INFO=/camel-proxy/webservices/SendMessageService,
org.apache.cxf.message.Message.BASE_PATH=/camel-proxy/webservices/SendMessageService,
org.apache.cxf.continuations.ContinuationProvider=org.apache.cxf.transport.http_jetty.continuations.JettyContinuationProvider@7a66cceb,
org.apache.cxf.message.Message.IN_INTERCEPTORS=[org.apache.cxf.transport.https.CertConstraintsInterceptor@73179714],
org.apache.cxf.binding.soap.SoapVersion=org.apache.cxf.binding.soap.Soap11@11bfdd14,
org.apache.cxf.message.Message.ENCODING=ISO-8859-1,
org.apache.cxf.message.Message.QUERY_STRING=null, HTTP.RESPONSE=HTTP/1.1 200 

,
org.apache.cxf.security.SecurityContext=org.apache.cxf.transport.http.AbstractHTTPDestination$2@4b4b5526,
org.apache.cxf.request.method=POST,
org.apache.cxf.async.post.response.dispatch=true,
org.apache.cxf.configuration.security.AuthorizationPolicy=null,
org.apache.cxf.message.MessageFIXED_PARAMETER_ORDER=false,
org.apache.cxf.transport.Destination=org.apache.cxf.transport.http_jetty.JettyHTTPDestination@ae13409,
http.base.path=http://localhost:9080/camel-proxy/webservices,
Content-Type=multipart/related; type="application/xop+xml";
boundary="uuid:5b61359d-9ec9-4d1d-bc79-98c20c66419b";
start="<ro...@cxf.apache.org>"; start-info="text/xml",
HTTP.CONTEXT=ServletContext@o.e.j.s.h.ContextHandler{/camel-proxy/webservices,null}},
CamelRedelivered=false, CamelRedeliveryCounter=0, connection=keep-alive,
content-type=application/xop+xml, Host=localhost:9080, Pragma=no-cache,
transfer-encoding=chunked, User-Agent=Apache CXF 2.7.11}
	BodyType            null
	Body                [Body is instance of java.io.InputStream]
]

Stacktrace
---------------------------------------------------------------------------------------------------------------------------------------
org.apache.camel.CamelExecutionException: Exception occurred during
execution on the exchange: Exchange[Message: [Body is instance of
java.io.InputStream]]
	at
org.apache.camel.util.ObjectHelper.wrapCamelExecutionException(ObjectHelper.java:1379)[110:org.apache.camel.camel-core:2.12.3]
	at
org.apache.camel.builder.ExpressionBuilder$40.evaluate(ExpressionBuilder.java:989)[110:org.apache.camel.camel-core:2.12.3]
	at
org.apache.camel.support.ExpressionAdapter.evaluate(ExpressionAdapter.java:36)[110:org.apache.camel.camel-core:2.12.3]
	at
org.apache.camel.component.bean.MethodInfo$2.evaluateParameterBinding(MethodInfo.java:588)[110:org.apache.camel.camel-core:2.12.3]
	at
org.apache.camel.component.bean.MethodInfo$2.evaluate(MethodInfo.java:478)[110:org.apache.camel.camel-core:2.12.3]
	at
org.apache.camel.component.bean.MethodInfo.createMethodInvocation(MethodInfo.java:239)[110:org.apache.camel.camel-core:2.12.3]
	at
org.apache.camel.component.bean.BeanInfo.createInvocation(BeanInfo.java:278)[110:org.apache.camel.camel-core:2.12.3]
	at
org.apache.camel.component.bean.BeanInfo.createInvocation(BeanInfo.java:180)[110:org.apache.camel.camel-core:2.12.3]
	at
org.apache.camel.component.bean.BeanProcessor.process(BeanProcessor.java:148)[110:org.apache.camel.camel-core:2.12.3]
	at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:105)[110:org.apache.camel.camel-core:2.12.3]
	at
org.apache.camel.component.bean.BeanProcessor.process(BeanProcessor.java:67)[110:org.apache.camel.camel-core:2.12.3]
	at
org.apache.camel.impl.ProcessorEndpoint.onExchange(ProcessorEndpoint.java:103)[110:org.apache.camel.camel-core:2.12.3]
	at
org.apache.camel.impl.ProcessorEndpoint$1.process(ProcessorEndpoint.java:71)[110:org.apache.camel.camel-core:2.12.3]
	at
org.apache.camel.util.AsyncProcessorConverterHelper$ProcessorToAsyncProcessorBridge.process(AsyncProcessorConverterHelper.java:61)[110:org.apache.camel.camel-core:2.12.3]
	at
org.apache.camel.processor.SendProcessor.process(SendProcessor.java:110)[110:org.apache.camel.camel-core:2.12.3]
	at
org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:72)[110:org.apache.camel.camel-core:2.12.3]
	at
org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:398)[110:org.apache.camel.camel-core:2.12.3]
	at
org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:191)[110:org.apache.camel.camel-core:2.12.3]
	at
org.apache.camel.processor.Pipeline.process(Pipeline.java:118)[110:org.apache.camel.camel-core:2.12.3]
	at
org.apache.camel.processor.Pipeline.process(Pipeline.java:80)[110:org.apache.camel.camel-core:2.12.3]
	at
org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:191)[110:org.apache.camel.camel-core:2.12.3]
	at
org.apache.camel.component.cxf.CxfConsumer$1.asyncInvoke(CxfConsumer.java:92)[182:org.apache.camel.camel-cxf:2.12.3]
	at
org.apache.camel.component.cxf.CxfConsumer$1.invoke(CxfConsumer.java:72)[182:org.apache.camel.camel-cxf:2.12.3]
	at
org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:58)[130:org.apache.cxf.cxf-api:2.7.10]
	at
java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)[:1.6.0_31]
	at
java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)[:1.6.0_31]
	at java.util.concurrent.FutureTask.run(FutureTask.java:138)[:1.6.0_31]
	at
org.apache.cxf.workqueue.SynchronousExecutor.execute(SynchronousExecutor.java:37)[130:org.apache.cxf.cxf-api:2.7.10]
	at
org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:107)[130:org.apache.cxf.cxf-api:2.7.10]
	at
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:272)[130:org.apache.cxf.cxf-api:2.7.10]
	at
org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121)[130:org.apache.cxf.cxf-api:2.7.10]
	at
org.apache.cxf.transport.http_jetty.JettyHTTPDestination.serviceRequest(JettyHTTPDestination.java:355)[156:org.apache.cxf.cxf-rt-transports-http-jetty:2.7.10]
	at
org.apache.cxf.transport.http_jetty.JettyHTTPDestination.doService(JettyHTTPDestination.java:319)[156:org.apache.cxf.cxf-rt-transports-http-jetty:2.7.10]
	at
org.apache.cxf.transport.http_jetty.JettyHTTPHandler.handle(JettyHTTPHandler.java:72)[156:org.apache.cxf.cxf-rt-transports-http-jetty:2.7.10]
	at
org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1046)[59:org.eclipse.jetty.server:7.6.9.v20130131]
	at
org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:982)[59:org.eclipse.jetty.server:7.6.9.v20130131]
	at
org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:135)[59:org.eclipse.jetty.server:7.6.9.v20130131]
	at
org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:255)[59:org.eclipse.jetty.server:7.6.9.v20130131]
	at
org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116)[59:org.eclipse.jetty.server:7.6.9.v20130131]
	at
org.eclipse.jetty.server.Server.handle(Server.java:367)[59:org.eclipse.jetty.server:7.6.9.v20130131]
	at
org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:486)[59:org.eclipse.jetty.server:7.6.9.v20130131]
	at
org.eclipse.jetty.server.AbstractHttpConnection.content(AbstractHttpConnection.java:937)[59:org.eclipse.jetty.server:7.6.9.v20130131]
	at
org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.content(AbstractHttpConnection.java:998)[59:org.eclipse.jetty.server:7.6.9.v20130131]
	at
org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:953)[55:org.eclipse.jetty.http:7.6.9.v20130131]
	at
org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:240)[55:org.eclipse.jetty.http:7.6.9.v20130131]
	at
org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:82)[59:org.eclipse.jetty.server:7.6.9.v20130131]
	at
org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:628)[54:org.eclipse.jetty.io:7.6.9.v20130131]
	at
org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:52)[54:org.eclipse.jetty.io:7.6.9.v20130131]
	at
org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:608)[53:org.eclipse.jetty.util:7.6.9.v20130131]
	at
org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:543)[53:org.eclipse.jetty.util:7.6.9.v20130131]
	at java.lang.Thread.run(Thread.java:662)[:1.6.0_31]
Caused by: org.apache.camel.InvalidPayloadException: No body available of
type: org.w3c.dom.Document but has value:
org.apache.cxf.transport.http.AbstractHTTPDestination$1@991d67b of type:
null on: Message: [Body is instance of java.io.InputStream]. Caused by:
Error during type conversion from type: null to the required type:
org.w3c.dom.Document with value
org.apache.cxf.transport.http.AbstractHTTPDestination$1@991d67b due
org.xml.sax.SAXParseException: Content is not allowed in prolog..
Exchange[Message: [Body is instance of java.io.InputStream]]. Caused by:
[org.apache.camel.TypeConversionException - Error during type conversion
from type: null to the required type: org.w3c.dom.Document with value
org.apache.cxf.transport.http.AbstractHTTPDestination$1@991d67b due
org.xml.sax.SAXParseException: Content is not allowed in prolog.]
	at
org.apache.camel.impl.MessageSupport.getMandatoryBody(MessageSupport.java:101)[110:org.apache.camel.camel-core:2.12.3]
	at
org.apache.camel.builder.ExpressionBuilder$40.evaluate(ExpressionBuilder.java:987)[110:org.apache.camel.camel-core:2.12.3]
	... 49 more
Caused by: org.apache.camel.TypeConversionException: Error during type
conversion from type: null to the required type: org.w3c.dom.Document with
value org.apache.cxf.transport.http.AbstractHTTPDestination$1@991d67b due
org.xml.sax.SAXParseException: Content is not allowed in prolog.
	at
org.apache.camel.impl.converter.BaseTypeConverterRegistry.mandatoryConvertTo(BaseTypeConverterRegistry.java:173)[110:org.apache.camel.camel-core:2.12.3]
	at
org.apache.camel.core.osgi.OsgiTypeConverter.mandatoryConvertTo(OsgiTypeConverter.java:116)[118:org.apache.camel.camel-spring:2.12.3]
	at
org.apache.camel.impl.MessageSupport.getMandatoryBody(MessageSupport.java:99)[110:org.apache.camel.camel-core:2.12.3]
	... 50 more
Caused by: org.apache.camel.RuntimeCamelException:
org.xml.sax.SAXParseException: Content is not allowed in prolog.
	at
org.apache.camel.util.ObjectHelper.wrapRuntimeCamelException(ObjectHelper.java:1363)[110:org.apache.camel.camel-core:2.12.3]
	at
org.apache.camel.util.ObjectHelper.invokeMethod(ObjectHelper.java:1005)[110:org.apache.camel.camel-core:2.12.3]
	at
org.apache.camel.impl.converter.InstanceMethodTypeConverter.convertTo(InstanceMethodTypeConverter.java:78)[110:org.apache.camel.camel-core:2.12.3]
	at
org.apache.camel.impl.converter.BaseTypeConverterRegistry.doConvertTo(BaseTypeConverterRegistry.java:275)[110:org.apache.camel.camel-core:2.12.3]
	at
org.apache.camel.impl.converter.BaseTypeConverterRegistry.mandatoryConvertTo(BaseTypeConverterRegistry.java:164)[110:org.apache.camel.camel-core:2.12.3]
	... 52 more
Caused by: org.xml.sax.SAXParseException: Content is not allowed in prolog.
	at org.apache.xerces.parsers.DOMParser.parse(Unknown Source)[:]
	at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source)[:]
	at javax.xml.parsers.DocumentBuilder.parse(Unknown Source)[:2.4.0]
	at
org.apache.camel.converter.jaxp.XmlConverter.toDOMDocument(XmlConverter.java:762)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)[:1.6.0_31]
	at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)[:1.6.0_31]
	at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)[:1.6.0_31]
	at java.lang.reflect.Method.invoke(Method.java:597)[:1.6.0_31]
	at
org.apache.camel.util.ObjectHelper.invokeMethod(ObjectHelper.java:1001)[110:org.apache.camel.camel-core:2.12.3]
	... 55 more

I googled for a long time but failed to find what I need. I suspect if
there;s any solution, or any features I haven't install onto my servicemix
container?
 Thanks in advance. Any suggestion is appreciated:)




--
View this message in context: http://camel.465427.n5.nabble.com/Using-camel-cxf-proxy-MTOM-got-exception-Body-is-instance-of-java-io-InputStream-tp5751263.html
Sent from the Camel - Users mailing list archive at Nabble.com.