You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Cristiano Costantini <cr...@gmail.com> on 2016/03/18 11:17:05 UTC

Problem with Exceptions thrown from a Service in Karaf/ServiceMix

Hello all,

I'm having problems on Services published on Karaf/ServiceMix which, in
case of faults, put many "<classContext>" tags in the body of the
exception's detail, while this does not happen outside of Karaf enviroment
(see the P.S.)

The only clue I've found up to know, is a message where Daniel Kulp discuss
about an issue where there he suspect something weave the exception class
by adding a getClassContext() property to the exception:
http://mail-archives.apache.org/mod_mbox/cxf-dev/201301.mbox/%3C399BF167-4CDD-4E5C-B9CE-7DBDFC012074@apache.org%3E

It seems that the same  problems is happening to me...
anyone has discovered who is weaving this property on the exceptions in
servicemix? Anyone has any idea how to get CXF avoid deserializing these
tags in the response?

This behavior is happening both on CXF 2.7.11 and on CXF 3.1.4, and tested
on Karaf 2.4.0 (SMX 5.3.0) and Karaf 4.0.4 (SMX 7.0.0.M1)

Thank you all,
Cristiano

P.S. Here is the SOAP Fault response of a test service, the first published
from a simple Java application and latter published from a Karaf bundle:

1. Fault from a simple java application:
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
   <soap:Body>
      <soap:Fault>
         <faultcode>soap:Server</faultcode>
         <faultstring>Msg OperationFault</faultstring>
         <detail>
            <ns1:operationFault xmlns:ns1="
http://net.cristcost/ns/service/fault">
               <faultType xsi:type="srvfault:OperationFaultType" xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance"
                  xmlns:srvfault="http://net.cristcost/ns/service/fault
">CONSUMER_ERROR</faultType>
            </ns1:operationFault>
         </detail>
      </soap:Fault>
   </soap:Body>
</soap:Envelope>


2. Fault from a bundle published on Karaf
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
   <soap:Body>
      <soap:Fault>
         <faultcode>soap:Server</faultcode>
         <faultstring>Msg OperationFault</faultstring>
         <detail>
            <ns1:operationFault xmlns:ns1="
http://net.cristcost/ns/service/fault">
               <faultType xsi:type="srvfault:OperationFaultType" xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance"
                  xmlns:srvfault="http://net.cristcost/ns/service/fault
">CONSUMER_ERROR</faultType>
               <classContext xmlns:srvfault="
http://net.cristcost/ns/service/fault
">net.cristcost.test.ExceptionTestService</classContext>
               <!-- ... many other classContext tags ...  -->
               <classContext xmlns:srvfault="
http://net.cristcost/ns/service/fault
">org.eclipse.jetty.util.thread.QueuedThreadPool</classContext>
               <classContext xmlns:srvfault="
http://net.cristcost/ns/service/fault">java.lang.Thread</classContext>
            </ns1:operationFault>
         </detail>
      </soap:Fault>
   </soap:Body>
</soap:Envelope>

Re: Problem with Exceptions thrown from a Service in Karaf/ServiceMix

Posted by Cristiano Costantini <cr...@gmail.com>.
Hello all,
I've detected the source of this problem, it is due to the endorsed
java.lang.Exception in Karaf:
https://github.com/apache/karaf/blob/master/exception/src/main/java/java/lang/Exception.java

I'm going to file an issue on Karaf and start a discussion on the Karaf
mailing list;

the property detected by Daniel is due to this class and its method public
Class[] getClassContext(),
I think that this method should not be public but it should be private or
protected in this case CXF (or JaxB) won't consider it for marshalling.

Thank you anyway,
Cristiano


Il giorno ven 18 mar 2016 alle ore 11:17 Cristiano Costantini <
cristiano.costantini@gmail.com> ha scritto:

> Hello all,
>
> I'm having problems on Services published on Karaf/ServiceMix which, in
> case of faults, put many "<classContext>" tags in the body of the
> exception's detail, while this does not happen outside of Karaf enviroment
> (see the P.S.)
>
> The only clue I've found up to know, is a message where Daniel Kulp
> discuss about an issue where there he suspect something weave the exception
> class by adding a getClassContext() property to the exception:
> http://mail-archives.apache.org/mod_mbox/cxf-dev/201301.mbox/%3C399BF167-4CDD-4E5C-B9CE-7DBDFC012074@apache.org%3E
>
> It seems that the same  problems is happening to me...
> anyone has discovered who is weaving this property on the exceptions in
> servicemix? Anyone has any idea how to get CXF avoid deserializing these
> tags in the response?
>
> This behavior is happening both on CXF 2.7.11 and on CXF 3.1.4, and tested
> on Karaf 2.4.0 (SMX 5.3.0) and Karaf 4.0.4 (SMX 7.0.0.M1)
>
> Thank you all,
> Cristiano
>
> P.S. Here is the SOAP Fault response of a test service, the first
> published from a simple Java application and latter published from a Karaf
> bundle:
>
> 1. Fault from a simple java application:
> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
>    <soap:Body>
>       <soap:Fault>
>          <faultcode>soap:Server</faultcode>
>          <faultstring>Msg OperationFault</faultstring>
>          <detail>
>             <ns1:operationFault xmlns:ns1="
> http://net.cristcost/ns/service/fault">
>                <faultType xsi:type="srvfault:OperationFaultType"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>                   xmlns:srvfault="http://net.cristcost/ns/service/fault
> ">CONSUMER_ERROR</faultType>
>             </ns1:operationFault>
>          </detail>
>       </soap:Fault>
>    </soap:Body>
> </soap:Envelope>
>
>
> 2. Fault from a bundle published on Karaf
> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
>    <soap:Body>
>       <soap:Fault>
>          <faultcode>soap:Server</faultcode>
>          <faultstring>Msg OperationFault</faultstring>
>          <detail>
>             <ns1:operationFault xmlns:ns1="
> http://net.cristcost/ns/service/fault">
>                <faultType xsi:type="srvfault:OperationFaultType"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>                   xmlns:srvfault="http://net.cristcost/ns/service/fault
> ">CONSUMER_ERROR</faultType>
>                <classContext xmlns:srvfault="
> http://net.cristcost/ns/service/fault
> ">net.cristcost.test.ExceptionTestService</classContext>
>                <!-- ... many other classContext tags ...  -->
>                <classContext xmlns:srvfault="
> http://net.cristcost/ns/service/fault
> ">org.eclipse.jetty.util.thread.QueuedThreadPool</classContext>
>                <classContext xmlns:srvfault="
> http://net.cristcost/ns/service/fault">java.lang.Thread</classContext>
>             </ns1:operationFault>
>          </detail>
>       </soap:Fault>
>    </soap:Body>
> </soap:Envelope>
>
>
>
>
>