Description
I encountered a problem that happens if you run a route like
from("servlet:///test").to("direct:cxfendpoint")
Behind the direct endpoint there is a cxf jax-rs endpoint that is secured by spring-security. If spring security denies access based on method annotations it throws an AccessDeniedException. As JAX-RS does not handle it the exception hits the CamelDestination. There it is only logged and swallowed. As the client then gets no error it tries to handle the reponse with jaxb which fails. (See below)
21.01.2011 11:19:51 org.apache.cxf.jaxrs.provider.AbstractJAXBProvider handleJAXBException
WARNUNG: javax.xml.bind.UnmarshalException
- with linked exception:
[com.ctc.wstx.exc.WstxEOFException: Unexpected EOF in prolog
at [row,col {unknown-source}]: [1,0]]
at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.handleStreamException(UnmarshallerImpl.java:426)
at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:362)
at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:332)
at org.apache.cxf.jaxrs.provider.JAXBElementProvider.unmarshalFromInputStream(JAXBElementProvider.java:229)
at org.apache.cxf.jaxrs.provider.JAXBElementProvider.doUnmarshal(JAXBElementProvider.java:195)
at org.apache.cxf.jaxrs.provider.JAXBElementProvider.readFrom(JAXBElementProvider.java:166)
at org.apache.cxf.jaxrs.client.AbstractClient.readBody(AbstractClient.java:445)
at org.apache.cxf.jaxrs.client.ClientProxyImpl.handleResponse(ClientProxyImpl.java:463)
at org.apache.cxf.jaxrs.client.ClientProxyImpl.doChainedInvocation(ClientProxyImpl.java:445)
at org.apache.cxf.jaxrs.client.ClientProxyImpl.invoke(ClientProxyImpl.java:177)
at $Proxy18.getUsers(Unknown Source)
at client.RESTClient.sayHelloAsUser(RESTClient.java:63)
at client.RESTClient.main(RESTClient.java:34)
Caused by: com.ctc.wstx.exc.WstxEOFException: Unexpected EOF in prolog
at [row,col {unknown-source}]: [1,0]
at com.ctc.wstx.sr.StreamScanner.throwUnexpectedEOF(StreamScanner.java:682)
at com.ctc.wstx.sr.BasicStreamReader.handleEOF(BasicStreamReader.java:2090)
at com.ctc.wstx.sr.BasicStreamReader.nextFromProlog(BasicStreamReader.java:1996)
at com.ctc.wstx.sr.BasicStreamReader.next(BasicStreamReader.java:1100)
at com.sun.xml.bind.v2.runtime.unmarshaller.StAXStreamConnector.bridge(StAXStreamConnector.java:160)
at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:360)
... 11 more