Question

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.

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top