The differences between docBase and workDir in the tomcat custom Web deployment file are described

  • 2020-05-30 21:26:20
  • OfStack

This article focuses on the differences between docBase and workDir in the tomcat custom Web deployment file.

First look at the tomcat configuration file:

<Context path="/web" reloadable="false" docBase="D:\CAPRuntime\src\main\webapp" workDir="D:\CAPRuntime\src\main\webapp"/> 

What does docBase and workDir mean, respectively ?

Let's take a closer look:

Analytical workDir first:

jsp is converted to servlet at run time. tomcat generates 1 series folders and.class files from work in the tomcat installation directory.
I want to change the default work directory to something else, can I do that? For example, in the case of virtual directory, my jsp files are stored in d:\jsp. I want files and the.class files to be automatically stored in D:\jspclass. Is that ok?

The best answer

Change your site profile (server.xml or %tomcat_home%\conf\Catalina\localhost\ your site.xml) to the following

<Context docBase="f:/JSPBook" path="/JSPBook" workDir="F:\JSPBook\WEB-INF\work">

workDir is what you mean by work

And then the docBase:

In tomcat server. config

<host > 
 <Context path= " / "  docBase= " c:\mail "  />

Where, path bit virtual directory docBase is the actual directory, here, after each configuration, you need to restart, Tomcat in webApps under all the directories will be automatically mapped, is what you said the release project did. Under the conf folder, the Settings configured in the context.xml file will be Shared by the entire server


The above is the whole content of this article, I hope the content of this article to your study or work can bring 1 definite help, if you have questions you can leave a message to communicate.

Related articles: