I have a web application (WAR file). When I deploy it through Eclipse 3.5 using the WTP tools, I am able to start the Tomcat server from within Eclipse and view all the pages of the application. However I don't see my WAR file inside the webapps folder of Tomcat home directory (or for that matter its exploded format). I was under the impression that Tomcat reads all web applications under its webapps folder. How does Tomcat read my application in this case? I am using Tomcat 5.5.17 as my application server.
2 Answers
I recently have to figure out more detail on this topic to troubleshoot application startup issues so I note it here.
Where is the application deployed?
It is determined by the server configuration. Double click on the server in the servers view to look at the server "Overview". In the "Server Locations" section, there are default value configured:
- Server Path:
.metadata/.plugins/org.eclipse.wst.server.core/tmp0
- Deploy Path:
wtpwebapps
Also the application "module" is defined in the "Modules" tab of the server configuration which specify the application path, document base and the module name. For example, you deploy your project myapp
to the path /MyApp
.
So if your workspace is /home/me/workspace/myapp
, the path to your application deployment directory is:
/home/me/workspace/myapp/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/myapp.
What application files are deployed?
The contents of deployment is determined by "Deployment Assembly" in the project properties. Each entry in the assembly defines what files are deployed to what path. Example:
/src/main/java -> WEB-INF/classes
/src/main/resources -> WEB-INF/classes
/src/main/webapp -> /
Maven Dependencies -> WEB-INF/lib
So if you have the file src/main/webapp/WEB-INF/web.xml
in your source tree, it will be deployed to:
/home/me/workspace/myapp/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/myapp/WEB-INF/web.xml
-
2+1. Very nice and to the point answer. Special thanks for explaining what is the purpose of the "Deployment Assembly" option. – informatik01 Aug 28 '13 at 14:13
It's just all definied in the context.xml
which Eclipse has given to Tomcat. If you want to configure this behaviour, then doubleclick the Tomcat instance in the servers view and check the Server locations section. To achieve what you initially want/expected, you need to select Use Tomcat installation and if necessary also specify the Deploy path.

- 1,082,665
- 372
- 3,610
- 3,555
-
1What do you mean by `context.xml which eclipse has given to tomcat`? Where is the context.xml located? – Thunderhashy Jan 22 '10 at 20:20
-
3
-
It's specified in *Server path* field of the *Server locations* section. You need to browse furher something like `tmp0\conf\Catalina\localhost` and there you'll find the `context.xml` (which is *actually* named `contextPathAsYouHaveSpecified.xml`). – BalusC Jan 22 '10 at 20:26
-
2It is disabled when the server is already published with modules. **Read** the leading text of the section :) – BalusC Jan 22 '10 at 20:26
-
ya I found it. But the context.xml contains only 1 line `
WEB-INF/web.xml ` What does that mean? I am curious to find out that how come tomcat loads it. – Thunderhashy Jan 22 '10 at 20:31 -
It's actually not the one you're asking for. The one you found is located in something like `tmp0\conf`, but you need to browse further something like `tmp0\conf\Catalina\localhost`. At any way, the `WatchedResource` setting is just to trigger the auto-deployer. Also see Tomcat docs: http://tomcat.apache.org/tomcat-6.0-doc/deployer-howto.html – BalusC Jan 22 '10 at 20:38
-
-
Then nothing has been published to Tomcat through Eclipse yet. Or you actually changed the *Server locations*. – BalusC Jan 22 '10 at 21:58
-
I think application has been published.Because if I change any jsp file, I can see the changes on the UI. Same applies for class changes as well. – Thunderhashy Jan 22 '10 at 22:23
-
1Oh, I already see, I configured my Tomcat to *Publish module contexts to separate XML files*. When it's disabled (as likely in your case) it's definied in `tmp0\conf\server.xml`. – BalusC Jan 22 '10 at 22:29
-
-
Ya I got it. Thanks a lot. You have been very patient and helpful. I will upvote your response as soon as I am able to, as currently SO says that my daily vote limit has reached. – Thunderhashy Jan 22 '10 at 22:48
-
@BalusC I kept the default settings, when I do Run on Server the following folder structure(all web app folders) is created, jars copied but not class files. How to fix this issue. workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/myapp/WEB-INF/classes/com/myapp/web – itsraja Jan 26 '16 at 06:44
-
@BalusC I end up with ClassNotFoundException with the missing class files. I used maven and war is created in 'target' by running 'clean install'. If I deploy the war manually in tomcat it works. But Run on Server fails with the above issue. – itsraja Jan 26 '16 at 06:48