views:

64

answers:

2

I wonder how can I use similar to Eclipse's remote debugging technique to get the data from remote object (that reside on server)? I am already have the client code and just want to extend it to bind (if possible) to some port and get the data from the server.

Honestly I don't want to use anything specific on the server side (i.e. create an additional code on server) because server already allows remote debugging and I can see the data in Eclipse debugger view.

If you can point me to some sample code - that would be even better. Greatly appreciate in advance.

+1  A: 

I suspect you'll find what you need here:

http://www.j2ee.me/j2se/1.3/docs/guide/jpda/architecture.html

And that you need to implement what if referred to as the 'front end' which 'implements the high-level Java Debug Interface'.

Nick Holt
+1  A: 

Having read the @Romam's response to my comment, I think a better solution would be to add a simple server-side remote monitoring interface that responded to a client request, gathered the relevant object data, and returned it to the client. If the server side monitoring was compatible with JMX, you may not even need to implement any client code.

There are a number of problem with using JDPA for this, including:

  • Security: if the user can use your custom client to remote access your server, they can probably also use a regular remote debugger. That allows them to see any state they want to, and possibly remotely change state as well.
  • Complexity: driving the JDPA protocol from the client side is most likely not a simple thing to do.
  • Fragility: unless I'm very mistaken, your client will need to have hard-coded (e.g. in Strings) knowledge of class names, member names and member types for the server-side codebase. If you change implementation details of your server-side objects, your JDPA code may well break.
Stephen C