Deploying iTrust v8 in the EB2 3228 lab

This tutorial will help you set up iTrust in the lab.

Eclipse in the Lab

Start Eclipse. The shortcut to Eclipse should be in the Start menu. When Eclipse loads, you will be in the default workspace, similar to the workspace shown below.


Setting up Tomcat

After Eclipse has started and you are in the default workspace, you should see a project called “Servers” already in the package explorer. This means already has Tomcat set up for this workspace. If, for some reason, you need to set up Tomcat again, see the troubleshooting section at the bottom.

Check that Tomcat can start up by doing the following:

  • Go to Window > Show View > Other… Select Server > Servers…

  • In the Servers view, Click on the “Play” button to start the server

  • If you see the text Server startup in xxxxx ms in the Console view, and the Servers view shows that your status is “Synchronized”, then your server is properly configured. Also, check the Console view for exception stacktraces - there should not be any.
  • If the Console view isn't open, go to Window > Show View… > Console

Importing iTrust

  • If you are deploying the project for the first time, you will need to import from a zip.
  • If you have imported your project into Subversion, follow the instructions below to check out your current project into Eclipse.

Importing from a Zip

The source files will need to be imported as an Eclipse project, and deployed as a Tomcat application. To do this, follow these steps:

  • Download the source and save it to a location you can remember. Do not extract.
  • From within Eclipse, switch to the Java perspective. (use Window > Open Perspective…, or use the icons in the upper-right corner)
  • To import the project files, go to File → Import … and select Existing Projects Into Workspace. Click Next. Be sure to select “existing projects”!

  • In the Import window (shown below), check the radio button Select Archive File and select Browse.
  • Select the archive file for the source code within the browser that comes up.
  • Make sure that iTrust is checked in the projects selector and click Finish.

  • The files are now in your workspace. The Package Explorer should look like this:

Importing from Subversion

NOTE: The first time you use your repository, you will need to upload your project. (See: http://agile.csc.ncsu.edu/SEMaterials/tutorials/subclipse/)

To import a project from a Subversion repository:

  1. File → Import
  2. Select the SVN folder in the Import window.
  3. Choose the Checkout Projects fom SVN option, then click Next.
  4. If the repository information is listed in the Checkout from SVN window, then select your repository and click Next. Otherwise, you will need to select the Create a new repository location radio button, then click Next. Input the SVN URL provided by your TA, then click Next.
  5. Your repository directory structure should now be displayed, as shown in the example image below.
  6. Inside the Trunk folder, choose your iTrust project folder, then click Next.
  7. Select the Check out as a project in the workspace radio button, then click Finish.

For more information on using Subclipse, checkout the Subclipse tutorial: http://agile.csc.ncsu.edu/SEMaterials/tutorials/subclipse/

Deploying on Tomcat

  • Now you need to deploy the project to your Tomcat server. Switch to the Servers view along the bottom of the screen (if you don't see the Servers view, use Window > Show View… > Server > Servers), right-click on your Tomcat installation and select Add and Remove Projects
  • iTrust should show up on the list, move it over to the “Configured Projects” pane by selecting the iTrust project and clicking the Add button. Once iTrust is listed under the Configured column, click Finish

  • If you click on the plus sign in your server configuration, you should see “iTrust” deployed (published) there.
  • Now that iTrust is set up to be deployed on Tomcat, you need to set the database parameters. In the Package Explorer, Open up iTrust > WebRoot > META-INF > context.xml
  • If the file is opened in “Design” mode, switch to the “Source” mode at the bottom of the editor.
  • Follow the comments in the context.xml file to properly set up your database parameters. If you are using a local database (Fall 2009 CSC 326 lab is), your parameters are the following:
 username="root" 
 password="root"
 url="jdbc:mysql://localhost:3306/iTrust?createDatabaseIfNotExist=true"
  • Here's an example of how this portion of context.xml should look. Do NOT edit or remove the ?createDatabaseIfNotExist=true parameter:

  • To test your parameters, go to iTrust > unittests > edu.ncsu.csc.itrust. Right-click on DBBuilder.java, select Run as… > Java Application

(to view your packages easier, click on the triangle in the package explorer view, Package Presentation > “Hierarchical”)

  • The console view should show many lines beginning with Executing: , then end with Operation Completed
  • To populate your database with test data, go to unittests, and in the datagenerators package, run the TestDataGenerator.java program. You should also get a lot of Executing: , followed by an Operation Completed
  • Note: You MUST run DBBuilder and TestDataGenerator before running iTrust in Tomcat

Running the Application

  • Start the Tomcat Server in the “Servers” view as before.
  • Open your internet browser and surf to http://localhost:8080/iTrust/. You should be able to log in and use the application as normal.
  • If you receive the iTrust is Down error page, your database connection may not be configured correctly. Double-check your context.xml file, and also try the steps in the Setting up MySQL section below to manually create your database.

Troubleshooting

Setting up Tomcat

Tomcat is already unzipped into the c:\tomcat directory on the lab machines, so you will need to set up Eclipse to deploy projects to Tomcat. To do this, complete the following steps:

  • Go to Window > Show View > Other… Select Server > Servers…

  • In the Servers view, right click and select “New”

  • Select Apache > Tomcat 5.5. Hit next.
  • Select c:\tomcat\apache-tomcat-5.5.26 as the installation directory (if your version number might not match the screenshot - that's okay as long as it's 5.5)

  • Hit Finish
  • In the servers view, you should see your new runtime below. Click on the “Play” button to start the server

  • If you see the text Server startup in xxxxx ms in the Console view, and the Servers view shows that your status is “Synchronized”, then your server is properly configured. Also, check the Console view for exception stacktraces - there should not be any.
  • If the Console view isn't open, go to Window > Show View… > Console

Setting up MySQL

If iTrust cannot connect to the local database, you may need to create the database manually using MySQL.

  • Browse the Start Menu to find MySQL Command Line Client in the MySQL > MySQL Server 5.1 folder, as shown below:

  • Enter your MySQL password (for lab installations, the password is root). Hit enter to authenticate.
  • Type the following command at the mysql> prompt:
       create database XYZ;  

where XYZ is the name of the database you wish to create. Don't forget the semicolon!

  • Remember the name of your database, then return to your context.xml file within your project folder to update the information you may have changed.
  • Restart your Tomcat server for the changes to take effect. Re-run DBBuilder.java and TestDataGenerator.java within iTrust.
  • In your web browser, load http://localhost:8080/iTrust/ once again.

Refresh, Rebuild, Clean

TAs - need instructions and screenshots on “Project > Clean”, “Use F5 to refresh your workspace. (fixes 'resource out of sync' errors)”, and “Clean Tomcat Work Directory” by right-clicking on the servers view.

Other Common Issues

We'll post common issues people have had or might have in this section.

 
lab_deployment_instructions.txt · Last modified: 2009/09/09 18:02 by jtking
 
Recent changes RSS feed Creative Commons License Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki