8

I'm developing a web app (war packaging) using spring-boot, jsp and an embedded tomcat. The app runs fine and I can debug java files without any problems if I add a maven run configuration with the spring-boot:run goal.

But when I try to add a breakpoint in one of my jsp files IntelliJ shows this error: 'Breakpoint doesn't belong to any class'.

If I configure IntelliJ to use an external tomcat server then the jsp debugging works perfectly.

Is there a way of debugging jsp using the spring-boot maven goal? Is this a problem with spring-boot or with maven run configurations in IntelliJ?

I'd really like to be able to use the full spring boot capabilities from my dev environment.

Thank you.

asked Apr 25, 2014 at 23:59

1 Answer 1

8

The problem is that spring boot spawns another process for the app. You have to tell boot that you want to debug and not just run the command for maven or gradle in debug mode. :-( See:

Update: For my current project, I just provide a class to initialize spring boot in a war file. (See corresponding howtos to use spring boot for war files that are deployed in real webcontainers)

So during development of frontend stuff I use springboot:run to have quick reloads of resources etc. and for debugging of java code I deploy the stuff into a tomcat in debug mode. For a release I just have to decide which packaging type I want, as my app is capable of running as jar or war file.

BTW: If you want to use tomcat only stuff (special filters and so on) you can use an embedded tomcat for springboot:run as well, so your environments are more similar and you don't hunt ghost bugs ;-)

Update 2

According to https://github.com/spring-projects/spring-boot/issues/1138 you can just run the main method of your boot app to debug. I guess it helps to have used the maven target at least once so everything is compiled/copied etc. It works for me! :-)

Update 3 According to the spring boot team, they changed the way spring-boot:run works, so beginning with 1.2 you should be able to use the debug mode for the maven target as well, although their recommend way to start spring boot apps is always to start the main method.

Update 4 I can confirm that beginning with spring 1.2 you can directly run the maven targets in debug mode to be able to set breakpoints etc.

answered Jul 8, 2014 at 9:12
Sign up to request clarification or add additional context in comments.

1 Comment

Thank you, that's helpful. We have been using an external tomcat for jspx debugging and the maven goal or directly running the main() method for java debugging. It's a little bit annoying when you have to switch from one or the other but we can live with it.

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.