In my $TOMCAT_HOME/conf/server.xml I put this near the bottom:
...
<Context path="/staticdir" docBase="/filesystem/path/to/static/dir"/>
</Host>
</Engine>
</Service>
</Server>
I'm doing this because I have files on my filesystem that I want tomcat to serve up when you go to localhost:8080/staticdir
But when I start the application in Intellij-IDEA the tomcat log says this:
Using CATALINA_BASE: "C:\Users\me.IntelliJIdea11\system\tomcat\Unnamed_Product_2"
If I go into that directory on my filesystem and look at the conf/server.xml file, it doesn't have the Context
tag I put in there. Why is intellij modifying this and how can I prevent it?
I have a feeling I should have made this change to my $TOMCAT_HOME/conf/context.xml file instead, but I'm having trouble finding examples of how to make this change in there. If someone could show me an example of that, I'd consider it an answer, because I notice that intellij doesn't modify that file.
I have found a workaround.
But I really don't like this because when new users try to run the app for the first time, I can't imagine a way to detect they did this step incorrectly.
Here's a picture of my tomcat configuration:
In Tomcat, the Context Container represents a single web application running within a given instance of Tomcat. A web site is made up of one or more Contexts. For each explicitly configured web application, there should be one context element either in server. xml or in a separate context XML fragment file.
The context path refers to the location relative to the server's address which represents the name of the web application. By default, Tomcat derives it from the name of the deployed war-file. So if we deploy a file ExampleApp. war, it will be available at http://localhost:8080/ExampleApp.
Which version of IntelliJ are you using? FYI, you can run Jetty from within IntelliJ, then later deploy to Tomcat. For a preconfigured example, try a Vaadin starter web app, choosing the "Plain Java Servlet" flavor.
By default IntelliJ IDEA modifies CATALINA_BASE
environment so that Tomcat uses adjusted configuration files for deploying applications directly from the artifact output location, however it's possible to override this behavior and configure everything manually (either by changing the artifact output to go into webapps
or by changing the server configuration in the same way IDEA does so that deployment occurs from the standard artifact output).
I was need ROOT context in Tomcat/IntelliJ, so in server.xml in Host tag, add specific Context :
<Context path="" docBase="C:\intranet\app\tomcat\webapps\ROOT\" reloadable="true" />
In intelliJ 11.1.5, in Server tab panel check box "Deploy applications configured in Tomcat instance", IntelliJ will copy server.xml in folder deployment :
C:\Users\{Username}\.IntelliJIdea11\system\tomcat\Unnamed_Product_2\conf"
Now I can access to resources in Root domain, by example crossdomain.xml :
http://localhost:8080/crossdomain.xml
In Startup/Connection tab add the data as mentioned below in ' Pass environment variables ' section. Restart and that's it.
Name Value
------------ -----
CATLINA_BASE {Tomcat Installation directory}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With