Search code examples
javaeclipsedebuggingbreakpointseclipse-jdt

How to resolve unresolvable class compilation error in a conditional breakpoint?


I'm attaching the eclipse oxygen debugger to a remote java application. The remote java application has class org.example.Foo on it's classpath. When creating a conditional breakpoint for code

org.example.Foo.log("some message");
return false;

I get an error window that says:

Conditional Breakpoint has compilation error(s).

Reason: org.example cannot be resolved

When I use reflection code in the conditional breakpoint to invoke the static method on class Foo it works.

I tried using different projects for the debug configuration when attaching it to the remote java application, but none I have tried works. I tried with the project containig org.example.Foo and I also tried with the project that contains the servlet that is being deployed and I want to set a conditional breakpoint into.

How am I able to use the class within the conditional breakpoint?

EDIT: What I noticed is that the code completion feature for the conditional breakpoint editor provides only some packages that exist on the buildpath in eclipse and the classpath in the running application and also doesn't provide any class in the displayed packages as code completion suggestions.


Solution

  • The problem here is how a conditional breakpoint is compiled and what the dependencies in the application between the eclipse projects are.

    The application consists of 3 projects. The project representing the runnable application A has dependencies on projects B and C, but the projects B and C do not have a dependency between each other. The conditional breakpoint is created for a class in project B. But the class that is used in the conditional expression is located in project C.

    This setup will lead to a compilation error for the breakpoint condition as this is compiled in the context of project B and therefore doesn't know about project C.

    The project that is chosen in the remote debug configuration hasn't got any influence on this. It's also not possible to use a different project via the properties of the conditional breakpoint.