Getting Tomcat contexts to work in IntelliJ IDEA (and stop it starting Tomcat twice!)
If you run Tomcat within IDEA then you might have noticed a couple of things:
- Your application gets started, undeployed and then started again, increasing the start up time of Tomcat and reinitialising any
load-on-startupservlets for a second time. - Your carefully crafted
<context>stanzas don't work as IDEA hasn't picked then up from either server.xml or META-INF/context.xml.
conf/Catalina/.To get around this big mess and just use your Tomcat as if you ran it outside of IDEA you simply add a CATALINA_BASE environment variable to the configuration of Tomcat (within IDEA) pointing to your Tomcat directory:

Now when you start Tomcat within IDEA you should notice that your contexts are working correctly!
Technorati Tags: IntelliJ, IDEA, Tomcat, Context, Andrew Beacock



Buy Stuff From Amazon
6 Comments:
kthx.
Hi Andrew;
When I add the environment variable, my webapp wasn't loaded :).
I was missed something?
Thanks.
Juan Carlos,
I'm not sure what is happen on your system, could you please let me know what values the Tomcat log within IDEA prints out when you attempt to start Tomcat?
I'm specifically interested in:
Using CATALINA_BASE: ?
Using CATALINA_HOME: ?
Using CATALINA_TMPDIR: ?
Using JAVA_HOME: ?
JAVA_OPTS AGAIN = ?
The same problem. No "Using" in Tomcat log, just a strange parameter -Dcatalina.base=D:\Documents and Settings\username\.IntelliJIdea70\system\tomcat_Unnamed_projectname_some_crap_else
What does it say in the Tomcat window within IDEA? This is where I was getting my "Using CATALINA_" statements from.
Which version of IDEA are you using (I'm still on v5.1)
Thanks for putting this up, was stumped for a few mins.
jamie
Post a Comment