I have a Tomcat 7 Server in Eclipse with two webapps a and b and need to find out how to have application specific configuration files for tomcat that works with Eclipse.
Now I want for each webapp a custom config file, like described here: Apache Tomcat: multiple webapps. So I created a <TomcatDirectory>/conf/Catalina/localhost
folder and put the a.xml
and b.xml
there. This works fine when I run Tomcat from command line.
But where have I to put the application specific configuration files a.xml
and b.xml
when I run Tomcat from within eclipse?
I already tried to put the files in Eclipse in <EclipseWorkspace>\Servers\<ServerName>\conf\Catalina\localhost\
but WTP does not copy this files to <EclipseWorkspace>\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\conf\Catalina\localhost
In order to be able to deploy additional application on a different port, you will need to create an additional Service configuration. In order to do so, edit the server. xml file once again and additional configuration group. The new group, must have a different name, different ports, both for HTTP and AJP traffic.
You may host multiple domains and map them to particular web applications. First step is to map a domain or a directory under it to the Tomcat (this is done with mod_jk or mod_proxy_ajp using our JVMCP control panel), second step is to add virtual host in server. xml. See the below example.
Leave them in <TomcatDirectory>/conf/Catalina/localhost
Server > Open > Server Locations
Change from: Use workspace metadata To: Use Tomcat instalation
Now a.xml and b.xml from <TomcatDirectory>/conf/Catalina/localhost
will be used.
If it's for development's purpose, you can specify a folder into the "docBase" attribute of context file like this :
<?xml version="1.0" encoding="UTF-8"?>
<Context crossContext="true" docBase="C:/devel/MyApp/web/target/MyApp-web" path="/MyApp" reloadable="true">
<Resource
... />
</Context>
By adding these context files directly into /conf/Catalina/localhost, everything is configured and should work like you want but you'll have to stop the tomcat server every time you'll want to clean and build your project.
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