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 Jacques <be...@gmail.com> on 2010/09/08 16:03:23 UTC

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

Hi,

I previously had one instance of Axis2 installed in Tomcat. I configured
Tomcat to allow remote debugging, and I successfully remote-debugged a web
service from Eclipse.

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 ?

Thanks.

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

Posted by Glen Daniels <gl...@thoughtcraft.com>.
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


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

Posted by Stadelmann Josef <jo...@axa-winterthur.ch>.
Hi,

 

I try to answer this as well because I am itself interested in the
subject and did it many times. And well, are ready to learn things I
don't know or which can be done with less pain.

 

But first I have to ask you a few things: If you refer to an instance of
tomcat then you refer to the running instance of JVM up on which tomcat
is running?

Is this correct?

 

If yes: then running 3 instances of tomcat means having 3 JVM running?
Yes?

 

Remote debugging is to connect a debugger to a debuggee, that is to say;
connecting i.e. NetBeans Debugger via TCP-sockets to the debugger port
of the JVM-B up on which this Tomcat-B is running up on which Axi2-B is
running up on which your Service-B is running.

 

And that gives you the ability to debug, single step through code, be it
Tomcat, Axis2, or your service, it depends about your project, reach
ability of your sources and how well they are in sync with the byte code
executing on the JVM which is under debugger control.

 

In order to have multiple tomcats starting up, each on its own JVM, one
needs to configure Tomcat's server.xml to have unique ports. I configure
it server-A.xml, server-B.xml, server-C.xml, and through this make that
ports are unique for the various JVM's.

 

Let's say, the JVM-A of tomcat-A listens on port 8080 for normal
A-request, then listens for 8009 for A-admin-request, then  my tomcat-B
listens on 8180 for normal B-request, for 8109 for B-admin-request, and
I can start JVM-B for tomcat-B with an -X switch stating the
B-debugger-port to listen for B-debugger-requests.

 

This works for me with exception that I have sometimes code-sync
problems. 

 

Also Digging deep into JAVA JDK Code depends on how they are compiled,
if not with the -g switch as most JDK's are, then JDK code i.e. among
security managers etc. can't be debugged.  (this my learning's)

 

Now; as I am still a novice in configuring AXIS2's and TOMCAT's, can you
learn me how to do it your way? 

 

If I have axis2a deployed and axis2b, each leading to a set of
subdirectories, (is that a container) one being ./service and another
one ./lib etc. 

 

how can I then make that tomcat-A starts axis2-a only and tomcat-b
starts only axis2-b? in other word how can I tell tomcat what to start
and what not?

 

 

Josef

 

 

 

 

 

 

 

Von: Jacques [mailto:bercy46@gmail.com] 
Gesendet: Mittwoch, 8. September 2010 16:03
An: java-user@axis.apache.org
Betreff: Eclipse Remote Debugging with multiple instance of Axis2 in
same Tomcat container ?

 


Hi,

I previously had one instance of Axis2 installed in Tomcat. I configured
Tomcat to allow remote debugging, and I successfully remote-debugged a
web service from Eclipse.

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 ?

Thanks.