Presentation is loading. Please wait.

Presentation is loading. Please wait.

Tomcat Setup BCIS 3680 Enterprise Programming. Getting Web Apps to Work  Verify that Tomcat works.  Understand how context works.  Create folders/files.

Similar presentations


Presentation on theme: "Tomcat Setup BCIS 3680 Enterprise Programming. Getting Web Apps to Work  Verify that Tomcat works.  Understand how context works.  Create folders/files."— Presentation transcript:

1 Tomcat Setup BCIS 3680 Enterprise Programming

2 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. 2

3 Verification of Tomcat  Start a command prompt and run command: catalina run  Tomcat is up if you see “INFO: Server startup in #### ms” 3

4 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. 4

5 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. 5

6 Alias (Context) 6 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)

7 Deployment Folder 7 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.

8 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. 8

9 Making the Connection 9 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!

10 Setting Up a Context 10  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.

11 Start NotePad with Admin Rights 11 Again, open Notepad with administrator rights if you use Windows Vista or higher

12 Start NotePad with Admin Rights 12

13 Context for Web Applications  Unlike HTML, XML is case-sensitive!  Inside the “ Host ” element (tag), modify the “ Context ” element. For example:  Restart Tomcat. 13

14 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. 14

15 Testing localhost Site Under Win7/Vista 15 1 2 3


Download ppt "Tomcat Setup BCIS 3680 Enterprise Programming. Getting Web Apps to Work  Verify that Tomcat works.  Understand how context works.  Create folders/files."

Similar presentations


Ads by Google