How to configure additional context information in Tomcat
In my tomcat 5.5.17 server.xml I have defined the following entries at the end of the Host section.
...
]]>
This works fine in Tomcat standalone. But running my application from within IntelliJ 5.1.2 with the same Tomcat and configured as Web application ends up with a server.xml that does not have the context information.
Under Web Module Settings I tried to edit the context.xml file referenced under Tomcat Context Descriptor, but that does not do the magic.
Looking at Using CATALINA_BASE: C:\Documents and Settings\aguther\.IntelliJIdea50\system\tomcat_Tomcat_5_5_17_244ef11 it looks like IntelliJ is copying the server.xml to the conf folder, but for some reasons does not inlcude the context settings.
How do I get IntelliJ to set-up Tomcat in that way the additional two context entries are available?
Thanks in advance for any help.
Andreas
请先登录再写评论。
The trick seems to be to not use the default server.xml generated by IntelliJ but rather point to the one that is used in your Tomcat installation.
To do this, you have to click on Run > Edit Configurations to open the Run/Debug Configurations Dialog. Then open the Tomcat Server tab. Next click on the Startup/Connection sub tab. Select the Run entry. For the Startup script entry unselect "use default". Now click on the Edit button next to the box you just unselected. This opens the Configure VM and Program Parameters dialog. For "Program Parameters" you hav per default the command run. Add -config ]]>, On my system the entry would be:
run -config C:/usr/local/tomcat/apache-tomcat-5.5.15/conf/server.xml
That made IntelliJ using the server.xml in the Tomcat installation which now give me the desired Context configuration.
This question has been answered.
This didn't work for me. I change the beginning of catalina.bat to include the following lines:
set CATALINA_BASE=C:/usr/local/tomcat/apache-tomcat-5.5.15
set CATALINA_HOME=C:/usr/local/tomcat/apache-tomcat-5.5.15
After that it works.
I figured out that it is actually not necessary to change the catalina.bat directly.
You can pass in all those settings of enfironmentvariable through IntelliJ on the same configuration page mentioned above.
I am passing in now JAVA_HOME for using a different JVM, TOMCAT_HOME for pointing to a different configuration folder that contains the servlet.xml. Setting those environment variable allows me to use the default run settings from IntelliJ.
In your case you could pass in the CATALINA_BASE and CATALINA_HOME as well.