Download presentation
Presentation is loading. Please wait.
Published byCecil Douglas Modified over 9 years ago
1
Tomcat Setup BCIS 3680 Enterprise Programming
2
One-Click Tomcat Setup 2 This semester we’ll try to set up Tomcat with a PowerShell script. Preparation of your system: Make sure JDK is installed on your computer. Download the Tomcat zip file from the course website - http://www.cob.unt.edu/itds/faculty/wu/bcis3680/installers/apac he-tomcat-7.0.42-windows-x86.zip http://www.cob.unt.edu/itds/faculty/wu/bcis3680/installers/apac he-tomcat-7.0.42-windows-x86.zip To avoid compatibility issues, download this version only.
3
Unzipping Tomcat Files 3 Unzip Tomcat to C:\apache-tomcat-7.0.42- windows-x86\ To avoid compatibility issues, unzip to this exact location.
4
Unzipping Tomcat Files 4 Typical post-XP Windows security setup doesn’t allow creating files directly at the root of C:. Make sure you’re unzipping to a folder. Check this box if necessary
5
Running the Script 5 Download the setuptomcat.ps1 script from the course website - http://www.cob.unt.edu/itds/faculty/wu/bcis3680/installers /setuptomcat.ps1 http://www.cob.unt.edu/itds/faculty/wu/bcis3680/installers /setuptomcat.ps1 Right click the script and select “Run with PowerShell”.
6
Allow the Script to Run 6 When prompted, enter a and press Enter.
7
One-Click Tomcat Setup 7 After Tomcat is set up successfully, you should see this result (depending on your system, the second line may read wow ):
8
Viewing Environment Variables 8 Right-click the Windows start icon ; then select Run. In the “Open” textbox, enter sysdm.cpl Click “OK”. Click the “Advanced” tab. Click the “Environment Variables” button.
9
Verifying Setup 9 When Tomcat setup is done correctly, you should see the CATALINA_HOME, JAVA_HOME, and path variables in the user variables section.
10
Getting Web Apps to Work Verify that Tomcat works. Understand how context works. Create folders/files for easy deployment of your web app. Configure server.xml. Configure web.xml. Test your web app. 10
11
Starting Tomcat 11 Right-click the Windows start icon ; then select Command Prompt (Admin). In the “User Account Control” dialog box, click “Yes”.
12
Verification of Tomcat At the command prompt, run this command: catalina run Tomcat is up if you see “INFO: Server startup in #### ms” 12
13
Exiting Tomcat To exit Tomcat, get back to the command console. Press CTRL + C simultaneously. When asked whether to terminate batch job, type y and hit ENTER. You often need to stop and restart Tomcat after making changes to configurations or class files. 13
14
Clean-Up 14 Once you are sure Tomcat starts properly, you may safely delete the decompressed folder created in Slide #3 or #4.
15
Alias for Web App A web application consists of a collection of files that are required to support a particular feature or task you want to publish to the outside world. The set of files are stored in a folder, which is the “deployment folder” for the application. It can contain subfolders. When provide visitors with the URL to your web app, you don’t want to show them the physical path to the deployment folder. Instead, you create an “alias” (or “context” or “virtual directory”) for the folder. In the URL, it is appended to the server name. Append any file names and/or subfolder names to the alias when accessing files directly under the deployment folder or under one of its subfolders. 15
16
Alias (Context) 16 This is what you want your visitors to type and see. The application appears to be the \casej03 “subfolder” on the server (localhost in this case)
17
Deployment Folder 17 This is what your visitors DON’T see. This is where your web application files are actually located at. You don’t want visitors to know it.
18
Folders for Deployment Inside the deployment folder, create a subfolder called WEB-INF. For testing and assignments, download the web.xml file into this subfolder. 18
19
Making the Connection 19 You define what you want the user to see (alias) as the “path” attribute of the tag. Note the / in front of the alias. Set the value of the “docBase” attribute of the tag to your deployment folder location. For each alias, you need to add a new tag under the tag. XML is case- sensitive!
20
Setting Up a Context 20 One way to define an alias (context) is do it in the server.xml configuration file. server.xml is located in \ \conf\. In the course VM, it’s C:\Tomcat\conf. You may use any editor that is capable of editing XML files to open it. In the course VM, use Notepad++. If you use Windows Notepad, you will need to open it with administrator rights. Otherwise you won’t be able to save the changes you make.
21
Start NotePad with Admin Rights 21 Again, open Notepad with administrator rights if you use Windows Vista or higher
22
Start NotePad with Admin Rights 22
23
Context for Web Applications Unlike HTML, XML is case-sensitive! Inside the “ Host ” element (tag), modify the “ Context ” element. For example: Restart Tomcat. 23
24
Testing Web Site After you have complete all the previous steps, you can verify whether your web site is up and running by: First, start Tomcat server from command prompt. Second, open the browser and enter the following URL: http://localhost:8080/ /default.htm Replace the part with the alias you defined in the server.xml file. 24
25
Testing localhost Site Under Win7/Vista 25 1 2 3
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.