Examinator Quick Start
Introduction
This document shows you how to quickly install, configure, and run Examinator, a multi-instance test-taking web application with a database store. You can run Examinator instances in both an unclustered mode (without Terracotta) and a clustered mode (with Terracotta). Tests demonstrating that in-memory data clustered with Terracotta remains coherent are also provided below.
Initial Setup
The following sections show how to set up Examinator, its database, and email properties required for registering new users.
Platform Summary
You must have JDK 1.5.x or greater installed. Run java -version in a terminal window to confirm the JDK version.
 |
Be sure to install the JDK before proceeding. |
Download the Examinator Package
Download the Examinator package.
Unpack the Examinator package in the desired parent directory. The name of the Examinator home directory, which is created under the chosen parent directory, has the format:
Create the Database
- Start the H2 database server from the Examinator home directory:
 | You can stop the database with h2db.sh stop. |
- Create the database schema:
- Confirm that the database is set up:
- A console login similar to the following should appear in your browser:

- Enter the value jdbc:h2:tcp://localhost/target/data/exam in the JDBC URL field.
All other fields can remain unchanged.
- Click Connect.
You should see the exam database schema listed in the left-hand panel of the console.
Default Data
The first time Examinator starts up, its bootstrap functionality adds default users to the database. During subsequent startups, the application adds the default data only if it isn't present. The default data consists of the following administrator and user accounts (username - password):
admin1 - passwd1
admin2 - passwd2
admin3 - passwd3
admin4 - passwd4
admin5 - passwd5
student1 - passwd1
student2 - passwd2
student3 - passwd3
student4 - passwd4
student5 - passwd5
If this is the initial installation of Examinator, this default data has not yet been added.
Configure Examinator to Use an SMTP Server
The exam application requires access to an SMTP mail server to send confirmation emails for new accounts. You configure an SMTP server in the mail.properties file located in <Examinator home directory>/webapps/examinator/WEB-INF/classes.
 |
If you use only the default accounts shown in Default Data, an SMTP mail server is not required because no confirmation emails need to be sent. |
You must edit the following properties:
- examinator.from.email – An email address that represents the sender.
- smtp.host - The address of any available SMTP server.
The remaining properties in mail.properties set the text that appears in the subject of different types of emails. A configured mail.properties file should appear similar to the following:
examinator.from.email=MyAddress@MyCompany.com
smtp.host=mail.MyCompany.com
subject.signup.confirmation=Welcome to Examinator
subject.password.reset.confirmation=Password reset confirmation
subject.password.reset.done=Your password has been reset
Download, Install, and Configure Terracotta
See the README file in the Examinator home directory for the version of Terracotta required for the version of Examinator you have. Then follow these steps:
- Download Terracotta.
Installation is as simple as unpacking the package (UNIX/Linux) or running an installer (Microsoft Windows).
- Set the following environment variable:
- From the Terracotta home directory, install all required TIMs:
Running the Exam Application Without Terracotta
You can use the embedded Jetty servers to run Examinator without Terracotta:
- Ensure that no other servlet container is running on ports 8080/8081.
Connecting to http://localhost:8080 and http://localhost:8081 should fail.
- Start the database if it isn't running.
- Change to the Examinator home directory and start the first node:
- Repeat the previous step, changing the port number to 8081.
Check console.log under work/8080/logs and work/8081/logs to make sure both Jetty instances finish starting up. Jetty is running when you see this type of message:
Two instances of Examinator should now be running, served by two Jetty instances and backed by a database.
Verifying that the Application is Not Clustered
With two instances of Examinator running, it is possible to test how data is handled and presented in an environment lacking Terracotta clustering. The test should demonstrate that while committed data is shared, in-memory data remains completely independent even in a case where it should be coherent. That is, data that has been committed to the database appears the same no matter which session accesses it, while data that is only in memory on the two nodes can quickly lose integrity as the application state diverges. In the second case, each session sees different data.
Create a User Account
 |
This demonstration requires Examinator to have access to an SMTP mail server. |
- Connect to http://localhost:8080/examinator and click the Register link.
- Fill in the form and submit it.
A confirmation email is sent to the address you provided containing an URL similar to http://localhost:8080/examinator/registration/confirm.do and a confirmation code. Do not click the URL.
- Copy the indicated URL from the confirmation email to your browser's Location field and edit it so the port reads 8081 (in place of 8080) and the context path "examinator2" (in place of "examinator").
The URL should now look like http://localhost:8081/examinator2/registration/confirm.do.
- Go to the confirmation page using the changed URL.
- In the confirmation email, copy the confirmation code.
You need the confirmation code to complete the registration process.
- Complete the registration on the confirmation page by filling in the form, then click Finalize.
The registration attempt is rejected due to invalid data.
- Using a different browser or browser tab, connect to the original URL:
http://localhost:8080/examinator/registration/confirm.do
- Complete the registration on the confirmation page by filling in the form, then click Finalize.
The registration is accepted.
 | Since the application is not clustered, you can not switch between application servers without losing the session. The second instance of the application does not know about the pending registration held by the first instance. This is because unconfirmed registration data does not get committed, remaining in memory to help maximize performance. |
Take a Test
- Log in to the new user account using http://localhost:8080/examinator.
See Create a User Account. If you did not create a user account, use one of the default accounts.
- Click Take an Exam.
- Choose an exam and, following the on-screen directions, begin to answer questions.
- Log into the same user account using http://localhost:8081/examinator2.
- Click Take an Exam and attempt to take the same exam.
 | To maximize performance, incomplete exams remain in memory. But since the application is not clustered with Terracotta, a second exam is started from the beginning, completely independent of the first exam already being taken. This happens even though:
- Both sessions are using the same user account;
- the user is taking the same exam;
- the same database data is being accessed (see, for example, the exams offered and exam results).
Note that questions which were answered during the first session appear again in the second, unanswered. Also, the time remaining to finish the second exam begins with the total time allowed, even though the first exam's allowed time has been run down since that exam started. The second instance of the application does not know about the exam being taken by the user in the first instance.
|
Running the Exam Application with Terracotta
 |
Before continuing, take down the Jetty instances from the previous demonstration. Change to the Examinator home directory and stop the first node:
Stop the second node using the same command but changing the port number to 8081. |
- Change to the Terracotta installation directory and start a Terracotta server instance:
- Change to the Examinator home directory and start the Jetty application servers:
Check console.log under work/8080/logs and work/8081/logs to make sure both Jetty instances finish starting up. Jetty is running when you see this type of message:
The cluster should now be running with two instances of Examinator at the following addresses:
 |
Several user accounts are created in the database by default. Usernames and passwords are listed above. |
Verifying that the Application is Clustered
There are a number of ways to see how Terracotta introduces clustering to the exam application. Some examples are given below.
Create a User Account
 |
This demonstration requires Examinator to have access to an SMTP mail server. |
- Connect to http://localhost:8080/examinator and click the Register link.
- Fill in the form and submit it.
A confirmation email is sent to the address you provided containing an URL similar to http://localhost:8080/examinator/registration/confirm.do and a confirmation code. Do not click the URL.
- Copy the indicated URL from the confirmation email to your browser's Location field and change the port to 8081.
The URL should now look like http://localhost:8081/examinator/registration/confirm.do.
- Go to the confirmation page using the changed URL.
- In the confirmation email, copy the confirmation code.
You need the confirmation code to complete the registration process.
- Complete the registration on the confirmation page by filling in the form, then click Finalize.
- Using a different browser or browser tab, connect to http://localhost:8080/examinator and log into the new account.
 | Since the application is being clustered with Terracotta, you can switch between application servers without losing the session. The second instance of the application knows about the pending registration held by the first instance despite the fact that the data is in memory only. |
Take a Test
- Log in to the new user account using http://localhost:8080/examinator.
See Create a User Account.
- Click Take an Exam.
- Choose an exam and, following the on-screen directions, begin to answer questions.
- Log into the same user account using http://localhost:8081/examinator.
- Click Take an Exam and attempt to take the same exam.
 | Since the application is being clustered with Terracotta, a second attempt to take the exam shows an exam in progress. Note that questions which were answered during the first connection appear answered, and that the time remaining to finish the exam is the same in both instances. The second instance of the application knows about the user's exam-in-progress on the first instance despite the fact that the data is in memory only. |