Mailing List
Home
Forum Home
Maven - Project building tool
Axis - Java SOAP implementation
Lucene - Full-featured text search engine APIs
Cocoon - MVC web framework based on XML/XSL
Fop - Create PDF, PCL, PS, SVG, XML driven by XSL formatting objects.
Log4J - A log library
POI - Java Excel, Word and other Microsoft Office files manipulating library
Oracle database error code ...
Subjects
log4j warning: No appenders could be found
java security AccessControlException: access denied (java io FilePermission clie
java lang InstantiationException: org apache tools ant Main
Apache Axis Tutorial
Subject: Struts <logic iterate >
log4j properties How to parse outpu to multiple files
configuring log4j with BEA Weblogic 8 1
How to use XSL FOP Java together
JSP precompile
Proposal: Adding jar manifest classpath in jar and war plugins
Servlet File Download dialog problem (IE6,Adobe 6 0)
java security AccessControlException: access denied (java io FilePermission
Unsupported major minor version 48 0 problem while running the an
   telope task
Subject: axis wsdl2java Ant Task usage
net sf hibernate MappingException: Error reading resource: test/User hbm xml
Building EAR ANT Script for websphere 5 0
CREATING WAR Files
Classpath problem
jsp data into Excel
Jboss 3 2 3+ vs Tomcat Axis Question
RE: How to include jars and add them into the MANIFEST MF/Class Path
attribute
Printing problem
Subject: InstantiationException
Couldn 't find trusted certificate
Please : How can one install ant 1 6 0 under Eclipse 2 1 ?
Excel: Too many different cell formats
Subject: AXIS: tomcat timeout ?
1 3 final: now giving me java io FileNotFoundException (Too many
open files)
XDoclet, Struts and Maven: Where to start? SOLUTION
Subject: Running junit tests fails
 
AxisFault, CustomException and code first approach

AxisFault, CustomException and code first approach

2007-12-03       - By P?r Malmqvist

 Back

Hello!

Thanks Martin, I tried a couple of configs, but unfortunately it doesn't seem
to work.

<parameter name="sendStacktraceDetailsWithFaults">true</parameter>    -->
getDetail() returns huge stacktrace
<parameter name="sendStacktraceDetailsWithFaults">false</parameter>   -->
getDetail() returns null

I have also tried:
<parameter name="DrillDownToRootCauseForFaultReason">false</parameter> and
<parameter name="DrillDownToRootCauseForFaultReason">true</parameter> but it
has no effect in this case.


So the question is still:
Could it be possible to change the fault handling code a little bit to throw an
AxisFault with a CustomException only in the details field? Like: The AxisFault
.getDetails() returns something like <CustomException>custom message... <
/CustomException>

/P?r






From: mgainty@(protected): axis-user@(protected): Re: AxisFault,
CustomException and code first approachDate: Thu, 30 Nov 2000 10:30:03 -0500



Hello Par
I would first try to attenuate the axis2.xml parameter  StackTrace e.g.
   <parameter name="sendStacktraceDetailsWithFaults">false</parameter>Martin--

-- -- Original Message -- --
From: P?r Malmqvist
To: axis-user@(protected)
Sent: Friday, November 30, 2007 9:49 AM
Subject: AxisFault, CustomException and code first approach
Hi!When creating a web service using existing business logic with "code first"
approach I dont think custom exceptions are handled the way it should. (Axis2 1
.3)The custom exception appears on the client side in the AxisFault details
field within <exception><exception> -tags together with a HUGE stack trace. I
have checked the source code for RPCMesssageReceiver and specially the section
that handles the AxisFault:} catch (InvocationTargetException e) {          
String msg = null;            Throwable cause = e.getCause();            if
(cause != null) {                msg = cause.getMessage();            }        
  if (msg == null) {                msg = "Exception occurred while trying to
invoke service method " +                        method.getName();            }
           if (cause instanceof AxisFault) {                log.debug(msg,
cause);                throw (AxisFault)cause;            }            log
.error(msg, e);            throw new AxisFault(msg, e);        } catch
(RuntimeException e) {            throw AxisFault.makeFault(e);        } catch
(Exception e) {            String msg = "Exception occurred while trying to
invoke service method " +                    method.getName();            log
.error(msg, e);            throw AxisFault.makeFault(e);        }}Could it be
possible to change this code a little bit to throw an AxisFault with a
CustomException only in the details field? Like: The AxisFault.getDetails()
returns something like <CustomException>custom message... </CustomException>It
would be much easier to handle the exception on the client side!What do you
gurus think? /P?r      

Invite your mail contacts to join your friends list with Windows Live Spaces.
It's easy! Try it!
__ ____ ____ ____ ____ ____ ____ ____ ____ ____ ____ ____ ____ __
Connect to the next generation of MSN Messenger?
http://imagine-msn.com/messenger/launch80/default.aspx?locale=en-us&source
=wlmailtagline
<html>
<head>
<style>
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
FONT-SIZE: 10pt;
FONT-FAMILY:Tahoma
}
</style>
</head>
<body class='hmmessage'>
Hello!<BR>
&nbsp;<BR>
Thanks Martin, I tried a couple of configs, but unfortunately it doesn't seem
to work.<BR>
&nbsp;<BR>
<FONT face=Arial>&lt;parameter name="sendStacktraceDetailsWithFaults"&gt;true
&lt;/parameter&gt;&nbsp;&nbsp;&nbsp; --&gt; getDetail() returns&nbsp;huge
stacktrace</FONT><BR>
<FONT face=Arial>&lt;parameter name="sendStacktraceDetailsWithFaults"&gt;false
&lt;/parameter&gt;&nbsp;&nbsp;&nbsp;--&gt; getDetail() returns null</FONT><BR>
<FONT face=Arial></FONT>&nbsp;<BR>
<FONT face=Arial>I have also tried: </FONT><BR>
<FONT face=Arial>&lt;parameter name="DrillDownToRootCauseForFaultReason"&gt
;false&lt;/parameter&gt; and</FONT><BR>
<FONT face=Arial>&lt;parameter name="DrillDownToRootCauseForFaultReason"&gt
;true&lt;/parameter&gt; but it has no effect in this case.</FONT><BR>
<FONT face=Arial></FONT>&nbsp;<BR>
&nbsp;<BR>
So the question is still:<BR>
Could it be possible to change the fault handling code a little bit to throw an
AxisFault with a CustomException only in the details field? <BR>Like: The
AxisFault.getDetails() returns something like&nbsp;&lt;CustomException&gt
;custom message... &lt;/CustomException&gt;<BR><BR>
&nbsp;<BR>
/P?r<BR><BR>
&nbsp;<BR>
&nbsp;<BR>
&nbsp;<BR>
<BR><BR>&nbsp;<BR>
<BLOCKQUOTE>
<HR>
From: mgainty@(protected)<BR>To: axis-user@(protected)<BR>Subject: Re:
AxisFault, CustomException and code first approach<BR>Date: Thu, 30 Nov 2000 10
:30:03 -0500<BR><BR>
<META content="Microsoft SafeHTML" name=Generator>
<STYLE>
.ExternalClass .EC_hmmessage P
{padding-right:0px;padding-left:0px;padding-bottom:0px;padding-top:0px;}
.ExternalClass EC_BODY.hmmessage
{font-size:10pt;font-family:Tahoma;}
</STYLE>

<DIV><FONT face=Arial>Hello Par</FONT></DIV>
<DIV><FONT face=Arial><BR>I would first&nbsp;try to&nbsp;attenuate the axis2
.xml parameter&nbsp; StackTrace&nbsp;e.g.</FONT></DIV>
<DIV><FONT face=Arial>&nbsp;&nbsp;&nbsp; &lt;parameter name=
"sendStacktraceDetailsWithFaults"&gt;false&lt;/parameter&gt;<BR><BR>Martin--<
/FONT></DIV>
<BLOCKQUOTE style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px;
BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV style="FONT: 10pt arial">-- -- Original Message -- -- </DIV>
<DIV style="BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: black"><B>From:<
/B> <A title=par_malmqvist@(protected) href="mailto:par_malmqvist@(protected)">P
?r Malmqvist</A> </DIV>
<DIV style="FONT: 10pt arial"><B>To:</B> <A title=axis-user@(protected) href=
"mailto:axis-user@(protected)">axis-user@(protected)</A> </DIV>
<DIV style="FONT: 10pt arial"><B>Sent:</B> Friday, November 30, 2007 9:49 AM<
/DIV>
<DIV style="FONT: 10pt arial"><B>Subject:</B> AxisFault, CustomException and
code first approach</DIV>
<DIV><BR></DIV>Hi!<BR>When creating a web service using existing business logic
with "code first" approach I dont think custom exceptions are handled the way
it should. (Axis2 1.3)<BR>The custom exception appears on the client side in
the AxisFault details field within &lt;exception&gt;&lt;exception&gt; -tags
together with a&nbsp;HUGE stack trace.<BR>&nbsp;<BR>I have checked the source
code for RPCMesssageReceiver and specially the section that handles the
AxisFault:<BR>} catch (InvocationTargetException e) {<BR>&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; String msg = null;<BR>&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Throwable cause = e
.getCause();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp; if (cause != null) {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; msg = cause.getMessage();<BR>&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<BR>&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (msg == null) {<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp; msg = "Exception occurred while trying to invoke service method " +
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; method
.getName();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp
; }<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if
(cause instanceof AxisFault) {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; log.debug(msg, cause);<BR>&nbsp
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp; throw (AxisFault)cause;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp; }<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp; log.error(msg, e);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; throw new AxisFault(msg, e);<BR>&nbsp;&nbsp;&nbsp
;&nbsp;&nbsp;&nbsp;&nbsp; } catch(RuntimeException e) {<BR>&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; throw AxisFault.makeFault(e);
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; } catch (Exception e) {<BR>&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; String msg =
"Exception occurred while trying to invoke service method " +<BR>&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp; method.getName();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; log.error(msg, e);<BR>&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; throw AxisFault.makeFault(e);
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<BR>}<BR>Could it be possible to
change this code a little bit to throw an AxisFault with a CustomException only
in the details field? <BR>Like: The AxisFault.getDetails() returns something
like&nbsp;&lt;CustomException&gt;custom message... &lt;/CustomException&gt;<BR
>It would be much easier to handle the exception on the client side!<BR>What do
you gurus think?<BR>&nbsp;<BR>/P?r<BR>&nbsp;<BR>&nbsp;<BR>&nbsp;<BR>&nbsp;<BR>
&nbsp;<BR><BR>&nbsp;<BR><BR>
<HR>
Invite your mail contacts to join your friends list with Windows Live Spaces.
It's easy! <A href="http://spaces.live.com/spacesapi.aspx?wx_action=create&amp
;wx_url=/friends.aspx&amp;mkt=en-us" target=_blank>Try it!</A> </BLOCKQUOTE><
/BLOCKQUOTE><br /><hr />Connect to the next generation of MSN Messenger?  <a
href='http://imagine-msn.com/messenger/launch80/default.aspx?locale=en-us
&source=wlmailtagline' target='_new'>Get it now! </a></body>
</html>