You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Willem jiang <wi...@gmail.com> on 2013/08/01 03:13:37 UTC

Re: Validate Xml

It is strange that you get this warning message, can you double check if there are more then one the servlet api jar in you class path.

[ qtp1563200034-16] AbstractHttpConnection WARN
/myService/
java.lang.NoSuchMethodError:
javax.servlet.http.HttpServletRequest.getLocalAddr()Ljava/lang/String;


--  
Willem Jiang

Red Hat, Inc.
FuseSource is now part of Red Hat
Web: http://www.fusesource.com | http://www.redhat.com
Blog: http://willemjiang.blogspot.com (http://willemjiang.blogspot.com/) (English)
          http://jnn.iteye.com (http://jnn.javaeye.com/) (Chinese)
Twitter: willemjiang  
Weibo: 姜宁willem





On Wednesday, July 31, 2013 at 11:56 PM, bocamel wrote:

> Thanks Claus!
>  
> Using what you suggested, CXF threw an error with much better information
> about the actual error with the input XML PAYLOAD message. But there is a
> little problem - the response sent back to the client is a simple HTTP 500
> message without any explanation. In fact, in this case HTTP 500 is rather
> misleading - leading the client to think that the issue is a server issue
> when it is actually a client issue. A HTTP 400 would be more appropriate in
> my opinion.
>  
> So I tried to catch the exception before it is sent back to the client. But
> none of the onException in Camel route would be able to catch it - I guess
> the exception was caught by CXF already. Any suggestion on how to catch the
> error in Camel route so that I can control what is sent back to the client?
>  
> Here is what I saw on the console:
>  
> [ qtp1563200034-16] PhaseInterceptorChain WARN  
> Interceptor for
> {http://myService}myService#{http://cxf.component.camel.apache.org/}invoke
> has thrown exception, unwinding now
> org.apache.cxf.interceptor.Fault: Could not parse the XML stream caused by:
> com.ctc.wstx.exc.WstxParsingException: Unexpected close tag </soapenv:Body>;
> expected </com:test>.
> at [row,col {unknown-source}]: [8,17].
> at
> org.apache.cxf.databinding.source.XMLStreamDataReader.read(XMLStreamDataReader.java:253)
> at
> org.apache.cxf.databinding.source.XMLStreamDataReader.validate(XMLStreamDataReader.java:211)
> at
> org.apache.cxf.databinding.source.XMLStreamDataReader.read(XMLStreamDataReader.java:107)
> at
> org.apache.cxf.databinding.source.XMLStreamDataReader.read(XMLStreamDataReader.java:75)
> at
> org.apache.cxf.databinding.source.XMLStreamDataReader.read(XMLStreamDataReader.java:60)
> at
> org.apache.cxf.interceptor.DocLiteralInInterceptor.handleMessage(DocLiteralInInterceptor.java:189)
> at
> org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:271)
> at
> org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121)
> at
> org.apache.cxf.transport.http_jetty.JettyHTTPDestination.serviceRequest(JettyHTTPDestination.java:355)
> at
> org.apache.cxf.transport.http_jetty.JettyHTTPDestination.doService(JettyHTTPDestination.java:319)
> at
> org.apache.cxf.transport.http_jetty.JettyHTTPHandler.handle(JettyHTTPHandler.java:72)
> at
> org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1074)
> at
> org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1010)
> at
> org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:135)
> at
> org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:255)
> at
> org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116)
> at org.eclipse.jetty.server.Server.handle(Server.java:365)
> at
> org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:485)
> at
> org.eclipse.jetty.server.AbstractHttpConnection.content(AbstractHttpConnection.java:937)
> at
> org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.content(AbstractHttpConnection.java:998)
> at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:856)
> at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:240)
> at
> org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:82)
> at
> org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:627)
> at
> org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:51)
> at
> org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:608)
> at
> org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:543)
> at java.lang.Thread.run(Thread.java:722)
> Caused by: com.ctc.wstx.exc.WstxParsingException: Unexpected close tag
> </soapenv:Body>; expected </com:test>.
> at [row,col {unknown-source}]: [8,17]
> at
> com.ctc.wstx.sr.StreamScanner.constructWfcException(StreamScanner.java:606)
> at com.ctc.wstx.sr.StreamScanner.throwParseError(StreamScanner.java:479)
> at com.ctc.wstx.sr.StreamScanner.throwParseError(StreamScanner.java:464)
> at
> com.ctc.wstx.sr.BasicStreamReader.reportWrongEndPrefix(BasicStreamReader.java:3266)
> at
> com.ctc.wstx.sr.BasicStreamReader.readEndElem(BasicStreamReader.java:3183)
> at
> com.ctc.wstx.sr.BasicStreamReader.nextFromTree(BasicStreamReader.java:2829)
> at com.ctc.wstx.sr.BasicStreamReader.next(BasicStreamReader.java:1072)
> at
> org.apache.cxf.staxutils.DepthXMLStreamReader.next(DepthXMLStreamReader.java:220)
> at org.apache.cxf.staxutils.StaxUtils.readDocElements(StaxUtils.java:1248)
> at org.apache.cxf.staxutils.StaxUtils.readDocElements(StaxUtils.java:1142)
> at org.apache.cxf.staxutils.StaxUtils.read(StaxUtils.java:1069)
> at org.apache.cxf.staxutils.StaxUtils.read(StaxUtils.java:1058)
> at
> org.apache.cxf.databinding.source.XMLStreamDataReader.read(XMLStreamDataReader.java:245)
> ... 27 more
> [ qtp1563200034-16] AbstractHttpConnection WARN  
> /myService/
> java.lang.NoSuchMethodError:
> javax.servlet.http.HttpServletRequest.getLocalAddr()Ljava/lang/String;
> at
> org.apache.cxf.transport.http.HttpServletRequestSnapshot.<init>(HttpServletRequestSnapshot.java:80)
> at
> org.apache.cxf.transport.http.AbstractHTTPDestination$1.cacheInput(AbstractHTTPDestination.java:276)
> at
> org.apache.cxf.transport.http.AbstractHTTPDestination.cacheInput(AbstractHTTPDestination.java:527)
> at
> org.apache.cxf.transport.http.AbstractHTTPDestination.flushHeaders(AbstractHTTPDestination.java:539)
> at
> org.apache.cxf.transport.http_jetty.JettyHTTPDestination.flushHeaders(JettyHTTPDestination.java:380)
> at
> org.apache.cxf.transport.http.AbstractHTTPDestination.flushHeaders(AbstractHTTPDestination.java:532)
> at
> org.apache.cxf.transport.http.AbstractHTTPDestination$WrappedOutputStream.onFirstWrite(AbstractHTTPDestination.java:709)
> at
> org.apache.cxf.io.AbstractWrappedOutputStream.write(AbstractWrappedOutputStream.java:47)
> at com.ctc.wstx.io.UTF8Writer.flush(UTF8Writer.java:100)
> at com.ctc.wstx.sw.BufferingXmlWriter.flush(BufferingXmlWriter.java:225)
> at com.ctc.wstx.sw.BufferingXmlWriter.close(BufferingXmlWriter.java:198)
> at
> com.ctc.wstx.sw.BaseStreamWriter._finishDocument(BaseStreamWriter.java:1404)
> at
> com.ctc.wstx.sw.BaseStreamWriter.writeEndDocument(BaseStreamWriter.java:536)
> at
> org.apache.cxf.binding.soap.interceptor.SoapOutInterceptor$SoapOutEndingInterceptor.handleMessage(SoapOutInterceptor.java:283)
> at
> org.apache.cxf.binding.soap.interceptor.SoapOutInterceptor$SoapOutEndingInterceptor.handleMessage(SoapOutInterceptor.java:271)
> at
> org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:271)
> at
> org.apache.cxf.interceptor.AbstractFaultChainInitiatorObserver.onMessage(AbstractFaultChainInitiatorObserver.java:114)
> at
> org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:331)
> at
> org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121)
> at
> org.apache.cxf.transport.http_jetty.JettyHTTPDestination.serviceRequest(JettyHTTPDestination.java:355)
> at
> org.apache.cxf.transport.http_jetty.JettyHTTPDestination.doService(JettyHTTPDestination.java:319)
> at
> org.apache.cxf.transport.http_jetty.JettyHTTPHandler.handle(JettyHTTPHandler.java:72)
> at
> org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1074)
> at
> org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1010)
> at
> org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:135)
> at
> org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:255)
> at
> org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116)
> at org.eclipse.jetty.server.Server.handle(Server.java:365)
> at
> org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:485)
> at
> org.eclipse.jetty.server.AbstractHttpConnection.content(AbstractHttpConnection.java:937)
> at
> org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.content(AbstractHttpConnection.java:998)
> at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:856)
> at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:240)
> at
> org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:82)
> at
> org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:627)
> at
> org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:51)
> at
> org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:608)
> at
> org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:543)
> at java.lang.Thread.run(Thread.java:722)
>  
>  
>  
>  
> --
> View this message in context: http://camel.465427.n5.nabble.com/Validate-Xml-tp472122p5736587.html
> Sent from the Camel - Users mailing list archive at Nabble.com (http://Nabble.com).