AndreasT
AndreasT

Reputation: 9801

How to go about debugging big plugin-oriented Java projects e.g. ActiveMQ(non-Artemis) in Eclipse?

I usually got by with elaborate logging configurations. But now I want to debug parts of the ActiveMQ "Classic" 5.15.5 broker component in Eclipse (Photon). After downloading, building and running mvn eclipse:eclipse I now have a workspace full of component projects with no associated run configurations. For some reason mvn install generates an executable in activemq-assembly/src/release/bin but that seems to be limited and it is not obvious, what it is that I have to tell Eclipse to run.

I have had similar problems before. In general: Do I just guess a Main (there are a'plenty) and search with trial-and-error? Or is there a structured approach that you can take towards debugging such loosely coupled applications?

Upvotes: 0

Views: 112

Answers (1)

Justin Bertram
Justin Bertram

Reputation: 35162

I would suggest using remote debugging which can be used by any modern Java IDE (e.g. Eclipse, IDEA, etc.). Follow these steps:

  1. Grab the ActiveMQ source code which corresponds to the version of the broker you're running.
  2. Open the env file in the bin directory of your ActiveMQ instance and uncomment the line defining ACTIVEMQ_DEBUG_OPTS.
  3. Set a break-point with your IDE in the ActiveMQ code.
  4. Start the broker.
  5. Attach the debugger.
  6. Reproduce your problem and debug the code from the break-point you set.

Upvotes: 1

Related Questions