Thanks, Anne. Here it is:

   https://issues.apache.org/jira/browse/AXIS2-2529

I attached a ZIP of a hacked version of samples/pojo that demonstrates
the problem.

On 4/15/07, Anne Thomas Manes <[EMAIL PROTECTED]> wrote:
Please file a JIRA.

On 4/14/07, John G. Norman <[EMAIL PROTECTED]> wrote:
> Martin,
>
> *** Throw an exception from the method that returns void.
>
> That's what my posting was about: If you throw an exception from a
> method that returns void, ** the client never gets the exception **.
> It will be logged on the server-side.
>
> If you change the method to return something like String (but, again,
> throw an exception from within the method), the client does get the
> exception.
>
> John
>
> On 4/14/07, Martin Gainty <[EMAIL PROTECTED]> wrote:
> > Good Afternoon John-
> >
> > I just deployed the Axis 2.1.1 original pojo sample of AddressBookService
> > without any errors
> >
> > pojo/build/classes/META-INF/services.xml displays
> > <service name="AddressBookService" scope="application">
> >     <description>
> >         POJO: AddressBook Service
> >     </description>
> >     <messageReceivers>
> >         <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-only";
> >                          
class="org.apache.axis2.rpc.receivers.RPCInOnlyMessageReceiver"/>
> >         <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-out";
> >                          
class="org.apache.axis2.rpc.receivers.RPCMessageReceiver"/>
> >     </messageReceivers>
> >     <parameter name="ServiceClass"
> > locked="false">sample.addressbook.service.AddressBookService</parameter>
> >
> > </service>
> >
> > here is the code for AddressBookService
> >
> > package sample.addressbook.service;
> > public class AddressBookService {
> >     private HashMap entries = new HashMap();
> >     /*** Add an Entry to the Address Book
> >          * @param entry */
> >     public void addEntry(Entry entry)
> >    {
> >         this.entries.put(entry.getName(), entry);
> >     }
> >
> >     /*** Search an address of a person
> >      * @param name the name of the person whose address needs to be found
> >      * @return return the address entry of the person.
> >      */
> >     public Entry findEntry(String name)
> >    {
> >         return (Entry) this.entries.get(name);
> >     }
> > }
> >
> > !--once the service is deployed I can access the service attributes via
> > !--http://localhost:8080/axis2-/axis2-admin/listService
> > !--which displays
> >
> > Service Description: AddressBookService
> > Service Status : Active
> > Engaged modules for the service
> >   a.. addressing-1.1 :: Disengage
> >
> >   Available operations
> >   b.. addEntry
> >   Engaged Modules for the Operation
> >     a.. addressing-1.1 :: Disengage
> >
> >   c.. findEntry
> >   Engaged Modules for the Operation
> >     a.. addressing-1.1 :: Disengage
> >
> >
> > I'm attempting to understand why you had to change the signatures when
> > services.xml already declares
> > org.apache.axis2.rpc.receivers.RPCInOnlyMessageReceiver (addEntry method)
> > org.apache.axis2.rpc.receivers.RPCMessageReceiver (findEntry method)
> >
> > ???
> > Martin
> >
> > This email message and any files transmitted with it contain confidential
> > information intended only for the person(s) to whom this email message is
> > addressed.  If you have received this email message in error, please notify
> > the sender immediately by telephone or email and destroy the original
> > message without making a copy.  Thank you.
> >
> > ----- Original Message -----
> > From: "John G. Norman" <[EMAIL PROTECTED]>
> > To: <axis-user@ws.apache.org>
> > Sent: Saturday, April 14, 2007 11:12 AM
> > Subject: Clients don't get exception thrown out of methods returning void
> > (was: Re: Web service error handling with POJO approach)
> >
> >
> > > After many hours, I finally traced my problem to an apparent bug.
> > >
> > > (Workaround for the bug at the end.)
> > >
> > > The bug looks a lot like 1277 in Jira, which was a blocker and
> > > resolved for 1.0 (http://issues.apache.org/jira/browse/AXIS2-1277).
> > >
> > > Before I add a bug report, I would appreciate it if someone out there
> > > could reproduce what's below as a sanity check. It's about 10 lines
> > > added to one of the samples.
> > >
> > > Here's the story:
> > >
> > > My POJO-style client wasn't getting exceptions from its POJO-style
> > > service. So I went back to the samples/pojo example, and threw an
> > > exception from a method. The client got it. Hmm. I just couldn't
> > > figure out what the difference was between my code and the sample.
> > > Then I realized that my methods return void.
> > >
> > > So I added this to AddressBookService.java in samples/pojo, a method
> > > returning void, then a second returning String:
> > >
> > >    public void test1(String s) throws Exception {
> > > throw new Exception("test1");
> > >    }
> > >
> > >    public String test2(String s) throws Exception {
> > > throw new Exception("test2");
> > >    }
> > >
> > > And this to AddressBookADBClient.java:
> > >
> > >            Test1 test1 = new Test1();
> > >            test1.setParam0("foo");
> > >            stub.test1(test1);
> > >
> > >            Test2 test2 = new Test2();
> > >            test2.setParam0("bar");
> > >            stub.test2(test2);
> > >
> > > Here's a snippet from the server-side log:
> > >
> > > Apr 14, 2007 10:55:28 AM
> > > org.apache.axis2.rpc.receivers.RPCInOnlyMessageReceiver
> > > invokeBusinessLogic
> > > SEVERE: test1
> > > java.lang.reflect.InvocationTargetException
> > > Caused by: java.lang.Exception: test1
> > >        at sample.addressbook.service.AddressBookService.test1(Unknown
> > > Source)
> > >        ... 35 more
> > > Apr 14, 2007 10:55:29 AM
> > > org.apache.axis2.rpc.receivers.RPCMessageReceiver invokeBusinessLogic
> > > SEVERE: test2
> > > java.lang.reflect.InvocationTargetException
> > > Caused by: java.lang.Exception: test2
> > >        at sample.addressbook.service.AddressBookService.test2(Unknown
> > > Source)
> > >        ... 35 more
> > >
> > > As you can see, both exceptions are thrown.
> > >
> > > Now here's the client (NOTICE: No evidence of an exception from the
> > > test1 method):
> > >
> > > adb.client.run:
> > >     [java] Name   :Abby Cadabby
> > >     [java] Street :Sesame Street
> > >     [java] City   :Sesame City
> > >     [java] State  :Sesame State
> > >     [java] Postal Code :11111
> > >     [java] org.apache.axis2.AxisFault: test2
> > >     [java]     at
> > > 
org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.jav
> > > a:271)
> > >     [java]     at
> > > 
org.apache.axis2.description.OutInAxisOperationClient.execute(OutInAxisOperation.
> > > java:202)
> > >     [java]     at
> > > sample.addressbook.stub.AddressBookServiceStub.test2(Unknown Source)
> > >
> > > So I guess that the workaround is that I'll have to have all of my
> > > methods return something: Perhaps a String, or maybe I'll create a
> > > JavaBean class called Nothing. Or maybe even Void with a capital V.
> > >
> > > This is a really awful bug.
> > >
> > > On 4/10/07, John G. Norman <[EMAIL PROTECTED]> wrote:
> > >> With a POJO Service:
> > >>
> > >> I have now tried the strategy here:
> > >>
> > >> 
http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/util/FaultThrowingService.java?view=markup
> > >>
> > >> Still not seeing the exception on the client that calls the service .
> > >> . . Still getting:
> > >>
> > >> > FaultReason; nested exception is:
> > >> >         java.lang.Exception: This is a test Exception
> > >> > java.lang.reflect.InvocationTargetException
> > >> >         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> > >> >         at
> > >> > 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> > >> >         at
> > >> > 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> > >> >         at java.lang.reflect.Method.invoke(Method.java:324)
> > >> > [much deleted]
> > >> >
> > >> > Caused by: org.apache.axis2.AxisFault: FaultReason; nested exception
> > >> > is:
> > >> >         java.lang.Exception: This is a test Exception
> > >> >         at com.myco.Service.test(Service.java:45)
> > >> >         ... 48 more
> > >> > Caused by: java.lang.Exception: This is a test Exception
> > >> >         ... 49 more
> > >> > DEBUG 16:24:37,843 org.apache.axis2.AxisFault: FaultReason; nested
> > >> > exception is:
> > >> >         java.lang.Exception: This is a test Exception
> > >> > DEBUG 16:24:37,843 isReplyRedirected: FaultTo is null. Returning
> > >> > isReplyRedirected
> > >> > DEBUG 16:24:37,843 isReplyRedirected: ReplyTo is null. Returning false
> > >> >
> > >>
> > >> On 4/9/07, John G. Norman <[EMAIL PROTECTED]> wrote:
> > >> > Hi all.
> > >> >
> > >> > This is a great topic -- how to manage exceptions for services built
> > >> > on POJOs. If it is as easy as the link Anne Manes provided
> > >> > (http://wso2.org/library/171) then throwing exceptions might well be
> > >> > included in the main Axis2 docs at
> > >> > http://ws.apache.org/axis2/1_1_1/pojoguide.html).
> > >> >
> > >> > But I just tried throwing an exception out of a POJO's method  (the
> > >> > basis for a service as described here:
> > >> > http://ws.apache.org/axis2/1_1_1/pojoguide.html), and the exception
> > >> > doesn't seem to make it back to the client.
> > >> >
> > >> > Does the QName need to match one of the faults defined in the client
> > >> > stub?
> > >> >
> > >> > In any case, the code looks like this:
> > >> >
> > >> >   public void test() throws AxisFault {
> > >> > throw      new AxisFault(new QName("http://test.org";, "FaultCode",
> > >> > "test"), "FaultReason", new Exception("This is a test Exception"));
> > >> >   }
> > >> >
> > >> > On the server, the trace looks like this:
> > >> >
> > >> > FaultReason; nested exception is:
> > >> >         java.lang.Exception: This is a test Exception
> > >> > java.lang.reflect.InvocationTargetException
> > >> >         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> > >> >         at
> > >> > 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> > >> >         at
> > >> > 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> > >> >         at java.lang.reflect.Method.invoke(Method.java:324)
> > >> > [much deleted]
> > >> >
> > >> > Caused by: org.apache.axis2.AxisFault: FaultReason; nested exception
> > >> > is:
> > >> >         java.lang.Exception: This is a test Exception
> > >> >         at com.myco.Service.test(Service.java:45)
> > >> >         ... 48 more
> > >> > Caused by: java.lang.Exception: This is a test Exception
> > >> >         ... 49 more
> > >> > DEBUG 16:24:37,843 org.apache.axis2.AxisFault: FaultReason; nested
> > >> > exception is:
> > >> >         java.lang.Exception: This is a test Exception
> > >> > DEBUG 16:24:37,843 isReplyRedirected: FaultTo is null. Returning
> > >> > isReplyRedirected
> > >> > DEBUG 16:24:37,843 isReplyRedirected: ReplyTo is null. Returning false
> > >> >
> > >> > On 4/3/07, Anne Thomas Manes <[EMAIL PROTECTED]> wrote:
> > >> > > See http://wso2.org/library/171.
> > >> > >
> > >> > > On 4/3/07, Chan, Herman <[EMAIL PROTECTED]> wrote:
> > >> > > >
> > >> > > >
> > >> > > >
> > >> > > >
> > >> > > > Hi all:
> > >> > > >
> > >> > > >
> > >> > > >
> > >> > > > I am relatively new to Axis 2 and web services in general, so
> > >> > > > please bear
> > >> > > > with me if I ask any stupid questions.
> > >> > > >
> > >> > > >
> > >> > > >
> > >> > > > I am writing a very simple web service that would return a list of
> > >> > > > directories on a server.  However, if certain directories does not
> > >> > > > exists,
> > >> > > > I'd like a throw an error back to the calling client.
> > >> > > >
> > >> > > >
> > >> > > >
> > >> > > > I am using the POJO approach to create web services using axis2, so
> > >> > > > is it
> > >> > > > good enough for me to throw a plain Exception or do I have to do
> > >> > > > more?  What
> > >> > > > is the best practice in doing error handling in web services?
> > >> > > >
> > >> > > >
> > >> > > >
> > >> > > > Thanks in advance.
> > >> > > >
> > >> > > >
> > >> > > >
> > >> > > > Herman Chan
> > >> > > >
> > >> > > >
> > >> > >
> > >> > > ---------------------------------------------------------------------
> > >> > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > >> > > For additional commands, e-mail: [EMAIL PROTECTED]
> > >> > >
> > >> > >
> > >> >
> > >>
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > For additional commands, e-mail: [EMAIL PROTECTED]
> > >
> > >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to