Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
528 views
in Technique[技术] by (71.8m points)

tomcat - Where does Eclipse deploy web applications using WTP?

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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

57.0k users

...