[ https://issues.apache.org/jira/browse/CAMEL-3572?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12984715#action_12984715 ]
Christian Schneider commented on CAMEL-3572: -------------------------------------------- The jaxrs server is configured like below. The exception is thrown by Spring Security when it intercepts the call the the implementation method <global-method-security jsr250-annotations="enabled" xmlns="http://www.springframework.org/schema/security"/> <jaxrs:server id="hello_rest" address="camel://direct:HelloWorldRestServerEndpoint"> <jaxrs:serviceBeans> <ref bean="hello-world-bean"/> </jaxrs:serviceBeans> <jaxrs:features> <bean class="org.apache.cxf.feature.LoggingFeature" /> </jaxrs:features> </jaxrs:server> <bean id="hello-world-bean" class="server.HelloWorldImpl"/> The impl class has this method: @RolesAllowed("ROLE_ADMIN") public Map<Integer, User> getUsers() Sergey already told me that I should use an interceptor to handle the exception from spring security and translate it. Still I think we should handle any exceptions in the CamelDestination that slip thorugh. > Camel transport for cxf does not forward exception to camel exchange > -------------------------------------------------------------------- > > Key: CAMEL-3572 > URL: https://issues.apache.org/jira/browse/CAMEL-3572 > Project: Camel > Issue Type: Bug > Components: camel-cxf > Reporter: Christian Schneider > Assignee: Christian Schneider > Fix For: 2.6.0 > > > 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 -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.