This article mainly describes the process of releasing the implementation in Tomcat after the project has been completed.
Project situation: The whole project is composed of 3 sub engineering associations, Commond_expend, Score_system, Score_systemlogic.score_system Engineering relies on two other works. MySQL is used in the database. Part One: Associating the project, and then packaging the war file
Add the associated project under the Score_system Project build path (right mouse button-build path--confige Bulid path) on the project name
Click on the link source,
Click to browse, select the project project to associate in the directory structure, and give him name, this name is casual, mainly this is his own easy to look at
Then click Projects, click Add, tick the project that needs to be associated, and then OK.
Then configure the associated project path, deployment Assembly, and click Add.
Select Project, then next, select the associated project
After you add the success, as shown in the previous illustration.
Make the project a war package
Select the project right button, Export-war file, select Storage directory after confirmation, and then successfully played the war package Part Two: Publish the war package to Tomcat copy score_system.war files to Tomcat\wepapps directory Three XML files need to be changed in the Tomcat\config directory
server.xml: adding in
<context docbase= "D:\java\tomcat7\webapps\score_system.war" path= "/score_system" reloadable= "true"/>, If the path is wrong Tomcat will not be able to extract the Score_system.war package and the server cannot start
context.xml: Adding a MySQL database connection to a node
<resource id= "Db_fix" name= "Jdbc/fix_biz_base" auth= "Container"
type=
"Javax.sql.DataSource" Driverclassname= "Com.mysql.jdbc.Driver"
url= "Jdbc:mysql://localhost:3306/test?characterencoding=utf-8"
username= "root"
password= "0000"
maxactive= "
maxidle=" maxwait= "10000"
/>
Note: this id= "Db_fix", which is based on the actual situation of the project, sometimes do not need, sometimes have to, if the background code through the ID of this access to the database connection configuration information, and forgot to set, so I began to suspect the younger brother Tomcat itself. So, here I repeat: the copy of the code can be copied, not to knock on their own or change. My little brother. Because of the database connection content that was copied from the previous project, I got a good lap with less ID.
tomcat-users.xml: Adding Users and roles to nodes
<role rolename= "Tomcat"/> <role rolename= "role1"/> <user username=
"root" password= "123456 "roles=" Tomcat,role1 "/>
Username and password are consistent with database name, password finally start Tomcat