Ed LaFave
Ed LaFave

Reputation: 419

Debugger doesn't stop at break points (Arquillian, TomEE, OpenJPA Enhancer, Maven, JUnit, and IntelliJ)

I'm writing a web app that uses JAX-RS (Apache CXF) and JPA (Apache OpenJPA) and is deployed using TomEE+. I've started using Arquillian via the arquillian-tomee-embedded maven dependency to unit test my REST services.

When I use IntelliJ to launch the test phase of Maven's build lifecycle everything works great. It runs OpenJPA's enhancer on my JPA Entities, kicks off the unit tests, and I'm able to successfully call my web services and they're able to successfully access the database.

Unfortunately, if I launch the test phase in debug mode everything still works but none of my breakpoints hit. What must I do to correct this problem?

I've found a tedious workaround. I can right click each unit test and run in debug mode and the debugger will hit breakpoints...but I have to manually run the OpenJPA enhancer beforehand in order for the JPA code to work.

Upvotes: 1

Views: 604

Answers (3)

Gabe
Gabe

Reputation: 495

I've hit problems with IntelliJ debugging not hitting breakpoints before. You may have luck disabling the JUnit plugin and restarting IDEA.

Upvotes: 0

OhadR
OhadR

Reputation: 8839

When you "launch the test phase in debug mode ", it means that Maven runs in debug mode, not that it debugs your app. You cannot debug your app through maven. Maven runs the tests using surefire-plugin, and you cannot use breakpoints and debug.

Upvotes: 1

Aniruddha Kalburgi
Aniruddha Kalburgi

Reputation: 393

There can be two possibilities: 1) The code / break-point(s) are not reachable / not getting called with current context. 2) You are NOT running application in Debug mode.

Make sure that you are Debugging the application and not run it like "Run As..."

Considering that you are using Eclipse, Run -> Debug As -> <-Your Target Application->

Also make sure that where ever you have added breakpoints, those lines are reachable.

Upvotes: 0

Related Questions