I've been digging around trying to find a way to enable custom exceptions
to be thrown using the Simple Server and am pretty stumped.

I'm trying to enable ServiceExceptions to be thrown from one of my service
interfaces but when I call it I get an exception such as:

Caused by: javax.xml.bind.MarshalException
 - with linked exception:
[javax.xml.bind.JAXBException: a.b.c.services.ServiceException is not known
to this context]
        at
com.sun.xml.bind.v2.runtime.MarshallerImpl.write(MarshallerImpl.java:295)
        at
com.sun.xml.bind.v2.runtime.MarshallerImpl.marshal(MarshallerImpl.java:221)
        at
javax.xml.bind.helpers.AbstractMarshallerImpl.marshal(AbstractMarshallerImpl.java:91)
        at
org.apache.cxf.jaxb.JAXBEncoderDecoder.writeObject(JAXBEncoderDecoder.java:192)
        at
org.apache.cxf.jaxb.JAXBEncoderDecoder.marshall(JAXBEncoderDecoder.java:167)
        ... 44 more

I tried adding a WebFaultOutInterceptor to my interceptor chain but this
error occurs further up in the chain:

INFO: Interceptor has thrown exception, unwinding now
org.apache.cxf.interceptor.Fault: Threw exception
        at
org.apache.cxf.service.invoker.AbstractInvoker.createFault(AbstractInvoker.java:101)
        at
org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:90)
        at
org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:63)
        at
org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:56)
        at
org.apache.cxf.workqueue.SynchronousExecutor.execute(SynchronousExecutor.java:37)
        at
org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:92)
        at
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:207)
        at
org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:73)
        at
org.apache.cxf.transport.servlet.ServletDestination.doMessage(ServletDestination.java:79)
        at
org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:235)
        at
org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:140)
        at
org.apache.cxf.transport.servlet.CXFServlet.invoke(CXFServlet.java:278)
        at
org.apache.cxf.transport.servlet.CXFServlet.doPost(CXFServlet.java:256)
        ...

I found http://issues.apache.org/jira/browse/CXF-340 which suggests that
this error can be resolved for the JAX-WS web services but is there a way
to do it with the simple server?

The simple server is so nice in terms of configuration that I'd hate to
have to switch over to JAX-WS - especially since we will have so many
services! In addition, the simple server can keep our stuff completely
annotation free. These services are not only going to be used for the web
and having to include the libraries that accompany those annotations would
be an annoyance to the rest of our development team.

Please let me know if this is not enough information to provide
suggestions.Thanks!

Regards,
Kaleb

Reply via email to