Skip to content

sutdmssd/bankwebappnew

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SUTD-bank Webapp

Contents

Pre-requisites

Java Development Kit (JDK) 1.8 or later

See yet another insignificant programming notes for installation instructions.

Eclipse IDE for Java EE Developers (Optional but recommended)

Install Eclipse IDE for Java EE Developers (not to be confused with Eclipse IDE for Java Developers). You may choose the Oxygen release or any recent releases.

Make sure that you have selected Eclipse's default JRE to be JDK 1.8 or later (see yet another insignificant programming notes).

See yet another insignificant programming notes for installation instructions.

Apache Tomcat 8.0 or later

See yet another insignificant programming notes for installation instructions.

We shall refer to the Apache Tomcat installation directory as <TOMCAT_HOME>.

MySQL 5.7 or later

See yet another insignificant programming notes for installation instructions. A default MySQL server account with username root will be created and you will be prompted to create a password.

Do not forget your password!

MySQL WorkBench (Optional)

MySQL Workbench will be useful for debugging your web application's database.

Deployment guide

This guide assumes that you are using Eclipse IDE for Java EE Developers.

Step 1. Clone or download the source code from this repository

Download this repository as a zip file and extract it into your Eclipse workspace.

Alternatively, navigate to your Eclipse workspace using your terminal or command prompt and run the following code to clone the repository into your Eclipse workspace:

$ git clone https://github.com/sunjun-group/bankwebapp.git

We will refer to the project's root directory as <BANKWEBAPP>.

The project structure is as follows:

+ src/main/java [Java code]
+ src/main/resources [configuration for database and email]
    + database.properties
    + email.properties
    + create.sql [MySQL script to create tables]

Step 2. Import the web application project into Eclipse

  • Click on File --> Import...
  • Select Existing Projects into Workspace
  • Select the project's root directory <BANKWEBAPP> and click Finish

Step 3. Update your MySQL server configurations

Edit <BANKWEBAPP>/src/main/resources/database.properties and modify:

  • jdbc.password -- replace with the password of your root MySQL server account

Step 4. Start MySQL server

See yet another insignificant programming notes for instructions.

Step 5. Generate default MySQL tables

Right-click on <BANKWEBAPP>/src/test/java/sutdbank/DbCreator.java and select Run As --> Java Application.

This step creates/overwrites the default schema bankwebapp.

Step 6. Add a JDBC connector binary to Apache Tomcat server

Copy <BANKWEBAPP>/libs/mysql-connector-java-5.1.35.jar into <TOMCAT_HOME>/lib.

Step 7. Deploy your web application from Eclipse (Optional)

In this step, we will guide you to attach Apache Tomcat to Eclipse so that you can run and debug your web application from within Eclipse. If you do not wish to do so, skip ahead to Step 8.

Step 7a. Add Apache Tomcat server as a web server for Eclipse

Follow Steps 3 to 5 of this online tutorial.

Do not start your web server yet!

Step 7b. Modify the attached Apache Tomcat server's configurations

After the previous step, you should see a new project folder named Servers in your Eclipse workspace.

Open Servers/Tomcat vX.X Server at localhost-config/server.xml (where vX.X refers to your Apache Tomcat version, e.g., v8.5) and add the following lines between the <Engine> ... </Engine> tags:

    <Realm 
        className="org.apache.catalina.realm.JDBCRealm"
        driverName="org.gjt.mm.mysql.Driver"
        connectionURL="jdbc:mysql://localhost:3306/bankwebapp"
        connectionName="root" 
        connectionPassword="INSERT_YOUR_PASSWORD_HERE"
        userTable="user" 
        userNameCol="user_name" 
        userCredCol="password"
        userRoleTable="user_role" 
        roleNameCol="role" 
    />

Replace the connectionPassword field with the password of your root MySQL server account.

Step 7c. Run your web application from Eclipse

Right-click on your web application project in Eclipse and select Run As --> Run on server.

Navigate your web browser to http://localhost:8080/bankwepapp.

You should be able to log in with the default account staff_1/123456.

Step 8. Deploy your web application in Apache Tomcat (Optional)

Step 8a. Modify Apache Tomcat server's configurations

Edit <TOMCAT_HOME>/conf/server.xml and add the following lines between the <Engine> ... </Engine> tags:

    <Realm 
        className="org.apache.catalina.realm.JDBCRealm"
        driverName="org.gjt.mm.mysql.Driver"
        connectionURL="jdbc:mysql://localhost:3306/bankwebapp"
        connectionName="root" 
        connectionPassword="INSERT_YOUR_PASSWORD_HERE"
        userTable="user" 
        userNameCol="user_name" 
        userCredCol="password"
        userRoleTable="user_role" 
        roleNameCol="role" 
    />

Replace the connectionPassword field with the password of your root MySQL server account.

Step 8b. Clean your Apache Tomcat webapps directory

Delete (if it exists) the folder <TOMCAT_HOME>/webapps/bankwebapp/.

Step 8c. Expore your web application project as a war file

Right-click on your web application project in Eclipse and select Export.... Select the WAR file wizard and:

  • Give your web project the title bankwebapp.
  • Select the destination to be <TOMCAT_HOME>/webapps.
  • Un-check the box for Optimize for a specific server runtime.
  • Check the box for Overwrite existing file.

This creates the file <TOMCAT_HOME>/webapps/bankwebapp.war.

Step 8d. Run your web application from Apache Tomcat

Start Apache Tomcat (see instructions) and navigate your web browser to http://localhost:8080/bankwepapp.

You should be able to log in with the default account staff_1/123456.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published