cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kaleb Walton <kdwal...@us.ibm.com>
Subject Re: Custom Exceptions using Simple Server
Date Fri, 02 Nov 2007 20:00:30 GMT

GREAT! It serializes my ServiceException nicely and without any extra
configuration! I've been waiting quite some time for this. Previously all
of my methods have had to throw a plain ol' Exception which is not very
useful. Now I can throw a ServiceException that includes much more
information for my consumers.

So far this looks like a great solution. I'll let you know if I come across
any snags :)

Regards,
Kaleb


|------------>
| From:      |
|------------>
  >--------------------------------------------------------------------------------------------------------------------------------------------------|
  |Daniel Kulp <dkulp@apache.org>                                                  
                                                                 |
  >--------------------------------------------------------------------------------------------------------------------------------------------------|
|------------>
| To:        |
|------------>
  >--------------------------------------------------------------------------------------------------------------------------------------------------|
  |cxf-user@incubator.apache.org                                                         
                                                           |
  >--------------------------------------------------------------------------------------------------------------------------------------------------|
|------------>
| Cc:        |
|------------>
  >--------------------------------------------------------------------------------------------------------------------------------------------------|
  |Kaleb Walton/Southfield/IBM@IBMUS                                                     
                                                           |
  >--------------------------------------------------------------------------------------------------------------------------------------------------|
|------------>
| Date:      |
|------------>
  >--------------------------------------------------------------------------------------------------------------------------------------------------|
  |11/02/2007 03:30 PM                                                                   
                                                           |
  >--------------------------------------------------------------------------------------------------------------------------------------------------|
|------------>
| Subject:   |
|------------>
  >--------------------------------------------------------------------------------------------------------------------------------------------------|
  |Re: Custom Exceptions using Simple Server                                             
                                                           |
  >--------------------------------------------------------------------------------------------------------------------------------------------------|






Kaleb,

Can you download the latest 2.0.3 SNAPSHOT (built this morning) and try
that?   I did a bunch of work on custom exceptions with JAXB yesterday
that is in that build.

http://people.apache.org/repo/m2-snapshot-repository/org/apache/cxf/apache-cxf/2.0.3-incubator-SNAPSHOT/


If that doesn't work, could you send me the exception class?

Dan


On Friday 02 November 2007, Kaleb Walton wrote:
> 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:2
>95) at
> com.sun.xml.bind.v2.runtime.MarshallerImpl.marshal(MarshallerImpl.java
>:221) at
> javax.xml.bind.helpers.AbstractMarshallerImpl.marshal(AbstractMarshall
>erImpl.java:91) at
> org.apache.cxf.jaxb.JAXBEncoderDecoder.writeObject(JAXBEncoderDecoder.
>java:192) at
> org.apache.cxf.jaxb.JAXBEncoderDecoder.marshall(JAXBEncoderDecoder.jav
>a: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(AbstractInv
>oker.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(ServiceInvo
>kerInterceptor.java:56) at
> org.apache.cxf.workqueue.SynchronousExecutor.execute(SynchronousExecut
>or.java:37) at
> org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(Ser
>viceInvokerInterceptor.java:92) at
> org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseIntercepto
>rChain.java:207) at
> org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitia
>tionObserver.java:73) at
> org.apache.cxf.transport.servlet.ServletDestination.doMessage(ServletD
>estination.java:79) at
> org.apache.cxf.transport.servlet.ServletController.invokeDestination(S
>ervletController.java:235) at
> org.apache.cxf.transport.servlet.ServletController.invoke(ServletContr
>oller.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



--
J. Daniel Kulp
Principal Engineer
IONA
P: 781-902-8727    C: 508-380-7194
daniel.kulp@iona.com
http://www.dankulp.com/blog

Mime
  • Unnamed multipart/related (inline, None, 0 bytes)
View raw message