IntelliJ IDEA – Run / debug web application on Tomcat

This article shows you how to run or debug a web application on Tomcat server, using IntelliJ IDEA.

Note
Unlike Eclipse IDE, there is always a ‘server view’ to configure the add server, IntelliJ do things differently, you need to add an “artifact (war file)” first, then only the “server view” will be displayed at the bottom.

1. Tomcat Plugin

1.1 File –>> Settings –>> Type Plugin –>> Make sure Tomcat and TomEE Integration is checked.

idea-run-debug-tomcat-example

2. Run/Debug Configuration

2.1 Run –>> Edit Configurations…

idea-run-debug-tomcat-example1

2.2 Clicks + icon, select Tomcat Server –>> Local

idea-run-debug-tomcat-example2

3. Tomcat Configuration

3.1 Clicks on the “Deployment” tab, + icon to select an artifact to deploy. For break point debugging, always choose the exploded war version.

idea-run-debug-tomcat-example4

3.2 Clicks on “Server” tab, select a Tomcat server, and update the on 'Update' action to “Update classes and resources” – for hot swap.

idea-run-debug-tomcat-example5

4. Application Servers

4.1 Now you can see an “Application Servers” view displayed at the bottom panel.

idea-run-debug-tomcat-example6

Start or debug your web application, done.

About the Author

author image
mkyong
Founder of Mkyong.com, love Java and open source stuff. Follow him on Twitter. If you like my tutorials, consider make a donation to these charities.

Comments

avatar
8 Comment threads
8 Thread replies
2 Followers
 
Most reacted comment
Hottest comment thread
13 Comment authors
Filip FiatJuanKRussell BranchLars LotsbergMilly Recent comment authors
newest oldest most voted
Guilherme Bahia
Guest
Guilherme Bahia

Thanks, better than Jetbrains docs.

IntelliJUser
Guest
IntelliJUser

Is this applicable for only Ultimate Edition only?

Russell Branch
Guest
Russell Branch

Thanks for the article, I was able to start tomcat. But when I open http://localhost:8080/ the browser redirects to https://localhost/login. Do you happen to know why this might happening? Thanks

Lars Lotsberg
Guest
Lars Lotsberg

I get this error message:
error running ‘Tomcat 8’:
port out of range:-1
Does anyone know what might be the problem?

JuanK
Guest
JuanK

I’ve the same problem on Ubuntu with Tomcat9 (installed by apt).
With Tomcat8 works well.
I would like know what is the origin of this problem.

Michael
Guest
Michael

Thank You very much mkyong.

baji shaik
Guest
baji shaik

Very clean and easy steps.

Great job

Alexander
Guest
Alexander

You are my spirit animal, thank you. Finally without any remote server involved – easy solution.

lixiang
Guest
lixiang

Can I have free version open source IDE ?