views:

610

answers:

5

I'm unable to inspect variables on eclipse when debugging remote Java application. What could be the reason.

EDITED: I'm not able to inspect any variables. Message shown in inspector mini window is 'variable name cannot be resolved'. I'm able to see the contents when I run it locally with test code.

A: 

All variables or just some? There could be several reasons for this:

  • There is no debugging info available for that class. You wouldn't see the variables either when debugging the same code locally.

  • Maybe there is a bug in Eclipse. Did you check the error console?

  • I'm not sure whether the version of the VM makes any difference. But you should try to use the same VM on both sides to make sure.

Aaron Digulla
If Java app exposes remote debugging capabilities it is not necessary for a class to implement *Serializable* interface.
Marcin Cylke
Hey Aaron, remote debugging will work with all classes Serializable or not.
Nick Holt
Fixed. Wasn't there an option to tell Java to forget the debug data in the class files? I check the docs but couldn't find it.
Aaron Digulla
+1  A: 

Check that you're connected to the remote app.

If your application has multiple threads, it might be that no thread is selected, in this case - select the thread that debugger stop in.

If debugger hasn't stopped - set a breakpoint.

Marcin Cylke
+1  A: 

Be absolutely certain that the classes deployed to the remote server has been compiled with debug information.

Thorbjørn Ravn Andersen
A: 

There are two views by which you can see values while debugging in Eclipse. First is the Expressions view. In the Expressions view you can see values for fields that you indicate you want to 'watch.' Second is the 'Values' view. In the Values view, you can see the values for fields in a method that you are stepping through, if the class was compiled with debug tokens, or the values of the arguments passed in if the class was not compiled with debug on.

If you are seeing something like 'Variable name cannot be resolved' it could be that you are using the Expressions view, not the Values view.

akf
A: 

In my case I was compiling the project through Maven with debug=false for the compiler-plugin. This was the problem!

Alessandro Dionisi