You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Glen Daniels <gl...@thoughtcraft.com> on 2010/09/08 16:19:13 UTC

Re: Eclipse Remote Debugging with multiple instance of Axis2 in same Tomcat container ?

Hi Jacques,

On 9/8/2010 10:03 AM, Jacques wrote:
> I've since then installed multiple instances of Axis2 in Tomcat.  In other
> words, I've got the axis2 webapp, but I now also have axis2a, axis2b, axis2c.
> 
> Each of the Axis instances run the same web service.
> 
> Is there a way to configure remote-debugging so that one particular instance
> of the web service is used for debugging purposes ?

If you mean setting breakpoints that will only trigger for one particular
instance of the service code, the answer (as far as I know) is "no", although
there may be some Tomcat magic I'm not aware of to do this.

However, you can of course make this work with a little coding. :)

1. Set up the particular instance of the webapp with a marker property in the
axis2.xml (in WEB-INF/conf) or services.xml (in your AAR under WEB-INF/services):

    <parameter name="StopThisOne" value="true"/>

This property should only be set for the instance you want to debug.

2. Adjust your service code to check for the property:

    void myServiceMethod() {
        MessageContext mc = MessageContext.getCurrentMessageContext();
        if (mc.getProperty("StopThisOne") != null) {
            System.out.println("Here we are");
        }
        ... rest of service method ...
    }

3. Set a breakpoint on the System.out.println() line above - this will only
be executed in the instance of the service that you've configured to stop.

This works, but isn't very flexible, since you'll need to put in a clause
like the above each time you want to set a breakpoint.  Another approach that
might work is to use the "cascading breakpoints" feature of many modern IDEs
- this lets you set a breakpoint that will only execute if another breakpoint
has already been hit.  Then you could build a custom Handler which contains
code like the above, and use that as the "trigger" breakpoint for any other
arbitrary breakpoint.  However, there may be a race condition there - it may
be possible for the trigger breakpoint to be hit on one thread and then the
actual breakpoint on another.

Hope that helps some,
--Glen

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@axis.apache.org
For additional commands, e-mail: java-user-help@axis.apache.org