Tomcat The difference between deployment directory and run directory
Asked by: George Cook220 viewsITJune 13, 2018
What's the difference?
2 Answers
+3Votes
There are many ways to deploy services to tomcat, some directly copy the compiled application to the tomcat webapps directory, some are exported to .war files and copied to webapps. In this case, start tomcat will automatically generate a same name. The application folder will have tomcat decompressed application directory, and some do not have to copy to the webapps directory, through the tomcat server configuration to specify any folder for the web application release directory. Basically, the directory structure is like this. First, the root directory is the folder named after your project name. Below the root directory, there will be various foreground display related code files, such as jsp file, css file, js file, image file. Waiting for the front of the display related to the folder or file can be placed in the root directory below the root directory there is a WEB-INF folder, the folder is a number of application configuration files: web.xml, application library folder lib folder Under this folder are some third-party jar packages used by the application, application compiling folder: class, which is the compiled file directory of all java files or other configuration files under the src directory in your application development. The directory structure is consistent with your development src directory structure.
Raymond- June 13, 2018|
+2Votes
1. Copy the web project file directly to the webapps directory. Tomcat’s webapps directory is the Tomcat default application directory. When the server starts, it will load all the applications in this directory. So you can package the JSP program into a “war” package in the directory, the server will automatically unlock the war package, and generate a folder with the same name in this directory. A war package is a jar package in the form of a feature. It is the compression of all the contents of a web program. Specifically how to package, you can use a lot of development tools IDE environment, such as Eclipse. You can also use the cmd command:jar -cvf mywar.war myweb webapps. This default application directory can also be changed. Open the server.xml file in the Tomcat conf directory and find the following: <Host name="localhost" appBase="webapps"unpackWARs="true" autoDeploy="true"xmlValidation= "false" xmlNamespaceAware="false">Modify the appBase. 2. Specifying in server.xml In the Tomcat configuration file, a web application is a specific Context. You can deploy a JSP application in the new Context in server.xml. Open the server.xml file and create a Context in the Host tag. The content is as follows. In tomcat’s conf directory, in server.xml, in the node, add: <Context path="/hello" docBase="D:\ workspace \hello\WebRoot" debug="0" privileged="true"> </Context> or <Context path="/myapp" reloadable="true" docBase="D:\myapp" workDir="D:\myapp\work"/> or <Context path="/sms4" docBase="D:\workspace\ Sms4\WebRoot"/>Description: path is the virtual path; docBase is the physical path of the application; workDir is the working directory of this application, which stores files generated by the runtime and related to this application; debug is set Debug level, 0 means to provide a minimum of information, 9 means to provide the most information privileged is set to true before allowing the Tomcat web application to use the servlet reloadable in the container; if true, tomcat will automatically detect the application /WEB-INF/lib and /WEB-I Changes in the NF/classes directory, automatic loading of new applications, change of applications without restarting tomcat, and implementation of hot deployment antiResourceLocking and antiJARLocking hot deployment is a parameter to be configured, default is false to avoid updating a webapp , sometimes Tomcat can not completely delete the old webapp, usually leave a jar package under WEB-INF/lib, you must close Tomcat to delete, which leads to automatic deployment fails. Set to true, Tomcat will copy the corresponding source files and jar files to a temporary directory when running the corresponding webapp. 3. Create a Context file. In the conf directory, create a new Catalina\localhost directory. Create a new xml file in the directory. The name must not be taken at random. It must be the same as the path name. Follow the path below. Configuration, the name of the xml should be hello (hello.xml), the contents of the xml file: <Context path="/hello" docBase="E:\workspace\hello\WebRoot" ;debug="0" privileged="true"></Context>Tomcat comes with the following example: <Context docBase="${catalina.home}/server/webapps/host-manager" ;privileged="true" antiResourceLocking="false" antiJARLocking="false"></Context>This example comes with tomcat. The edited content is actually the same as the second one. The name of the xml file is the access path, which hides the real name of the application. 4, note: delete a Web application also delete the corresponding folder under webapps and the corresponding Context in server.xml, but also delete the corresponding xml file in Tomcat’s conf\catalina\localhost directory, otherwise Tomcat will still go Configure and load. . . Second, dynamic deployment landing tomcat management console: http://localhost:8080/, enter the user name and password to manage applications and dynamically released. Enter /yourwebname in context Path(option):, which represents your application’s access address. The XML Configration file URL specifies an xml file. For example, we create an hmcx.xml file under F:\ with the following content: <Context reloadable="false" /> where docBase Don’t write it, because it’s in the next text box. Or, even simpler, this text box does not contain anything. Type F:\hmcx in WAR or Directory URL:, then click the Deploy button. The web application is visible above and the name is Context Path (option): The name. If there is an easier way to deploy the .war file, there is also a Select WAR file uploae click to browse to select the .war file and then click Deploy.
+3Votes
There are many ways to deploy services to tomcat, some directly copy the compiled application to the tomcat webapps directory, some are exported to .war files and copied to webapps. In this case, start tomcat will automatically generate a same name. The application folder will have tomcat decompressed application directory, and some do not have to copy to the webapps directory, through the tomcat server configuration to specify any folder for the web application release directory. Basically, the directory structure is like this. First, the root directory is the folder named after your project name. Below the root directory, there will be various foreground display related code files, such as jsp file, css file, js file, image file. Waiting for the front of the display related to the folder or file can be placed in the root directory below the root directory there is a WEB-INF folder, the folder is a number of application configuration files: web.xml, application library folder lib folder Under this folder are some third-party jar packages used by the application, application compiling folder: class, which is the compiled file directory of all java files or other configuration files under the src directory in your application development. The directory structure is consistent with your development src directory structure.
+2Votes
1. Copy the web project file directly to the webapps directory. Tomcat’s webapps directory is the Tomcat default application directory. When the server starts, it will load all the applications in this directory. So you can package the JSP program into a “war” package in the directory, the server will automatically unlock the war package, and generate a folder with the same name in this directory. A war package is a jar package in the form of a feature. It is the compression of all the contents of a web program. Specifically how to package, you can use a lot of development tools IDE environment, such as Eclipse. You can also use the cmd command:jar -cvf mywar.war myweb webapps. This default application directory can also be changed. Open the server.xml file in the Tomcat conf directory and find the following: <Host name="localhost" appBase="webapps"unpackWARs="true" autoDeploy="true"xmlValidation= "false" xmlNamespaceAware="false">Modify the appBase. 2. Specifying in server.xml In the Tomcat configuration file, a web application is a specific Context. You can deploy a JSP application in the new Context in server.xml. Open the server.xml file and create a Context in the Host tag. The content is as follows. In tomcat’s conf directory, in server.xml, in the node, add: <Context path="/hello" docBase="D:\ workspace \hello\WebRoot" debug="0" privileged="true"> </Context> or <Context path="/myapp" reloadable="true" docBase="D:\myapp" workDir="D:\myapp\work"/> or <Context path="/sms4" docBase="D:\workspace\ Sms4\WebRoot"/>Description: path is the virtual path; docBase is the physical path of the application; workDir is the working directory of this application, which stores files generated by the runtime and related to this application; debug is set Debug level, 0 means to provide a minimum of information, 9 means to provide the most information privileged is set to true before allowing the Tomcat web application to use the servlet reloadable in the container; if true, tomcat will automatically detect the application /WEB-INF/lib and /WEB-I Changes in the NF/classes directory, automatic loading of new applications, change of applications without restarting tomcat, and implementation of hot deployment antiResourceLocking and antiJARLocking hot deployment is a parameter to be configured, default is false to avoid updating a webapp , sometimes Tomcat can not completely delete the old webapp, usually leave a jar package under WEB-INF/lib, you must close Tomcat to delete, which leads to automatic deployment fails. Set to true, Tomcat will copy the corresponding source files and jar files to a temporary directory when running the corresponding webapp. 3. Create a Context file. In the conf directory, create a new Catalina\localhost directory. Create a new xml file in the directory. The name must not be taken at random. It must be the same as the path name. Follow the path below. Configuration, the name of the xml should be hello (hello.xml), the contents of the xml file: <Context path="/hello" docBase="E:\workspace\hello\WebRoot" ;debug="0" privileged="true"></Context>Tomcat comes with the following example: <Context docBase="${catalina.home}/server/webapps/host-manager" ;privileged="true" antiResourceLocking="false" antiJARLocking="false"></Context>This example comes with tomcat. The edited content is actually the same as the second one. The name of the xml file is the access path, which hides the real name of the application. 4, note: delete a Web application also delete the corresponding folder under webapps and the corresponding Context in server.xml, but also delete the corresponding xml file in Tomcat’s conf\catalina\localhost directory, otherwise Tomcat will still go Configure and load. . . Second, dynamic deployment landing tomcat management console: http://localhost:8080/, enter the user name and password to manage applications and dynamically released. Enter /yourwebname in context Path(option):, which represents your application’s access address. The XML Configration file URL specifies an xml file. For example, we create an hmcx.xml file under F:\ with the following content: <Context reloadable="false" /> where docBase Don’t write it, because it’s in the next text box. Or, even simpler, this text box does not contain anything. Type F:\hmcx in WAR or Directory URL:, then click the Deploy button. The web application is visible above and the name is Context Path (option): The name. If there is an easier way to deploy the .war file, there is also a Select WAR file uploae click to browse to select the .war file and then click Deploy.