How do I best integrate intelliJ with a Tomcat running as a service in a different process?

Answered

So far I have a basic integration set up as a "Remote tomcat" so I can attach a debugger and do basic debugging of our tomcat services.

I'd like a fuller integration, preferably with starting/stopping servers and active deployment while debugging.

Our setup is that we run 7 tomcats with one or more wars deployed to each.  All the wars are in the same project (Each war is a module).  Each tomcat must run as a service under a service account (in order to access network resources)

I do have scripts to start and stop the services and specify if I want debug mode or not.

So the integration I'd like is to have 7 servers where each can be started/stopped/debugged from the servers window.  Each module should support live deploy.  IntelliJ can't assume things about the tomcat like the batch/executable name or location since we've renamed all the start/stop scripts.

Is there a page describing how to set this up?  I can't find one.

My most recent problem is that IntelliJ seems to be reserving the debug port I specify before starting the tomcat (causing the tomcat start to fail.)  If I specify a different port the tomcat starts but I can't debug it.

 

Thank you.

0
3 comments

Did you consider using the Tomcat Local configuration with custom startup/shutdown scripts? IntelliJ IDEA allows to override the default scripts in the Run/Debug configurations.

0

I did--and that's about the closest I've gotten.  I can run/stop it but when I bring it up in debug mode I have a problem:

In the Server/Run configuration--startup/configuration debug configuration I specify "port 9007" which is the debug port our tomcat uses.  When I do so, intelliJ consumes that port before it starts the tomcat (which blocks my tomcat from starting). 

If I start the tomcat first and change the runner to not launch it, IntelliJ tells me port 9007 is already taken when I tell it to start the server.

I feel like IntelliJ is either starting it's own tomcat or trying to reverse-connect the debugger (which I don't see an option for)

0

Regarding the "port 9007" problem, what are the exact debug options to starts the related tomcat with? 

 

0

Please sign in to leave a comment.