center-for-knowledge-communication / mathspring

Mathspring website
http://mathspring.org
6 stars 3 forks source link

mathspring-V2

Mathspring Version 2.0 compatible with AWS

This repo can be cloned or forked but you will still need to do some setup.

This repo contains the Java source files that make up the server side of mathspring and the Javascript/HTML/CSS that makes up the client side.

The project is set up to work with Eclipse Oxygen.1a Release (4.7.1a) edition.

There is a large amount of math content that is also not part of this repo. You can still develop and run the tutor without it but if you need to see math problems as part of your testing, then you will need to get this. That is explained below in step 6.

---INSTALLATION INSTRUCTIONS---

  1. If you are person who wants to do a project based on mathspring with the possibility of having your changes added to the system, fork the repository on Github, and clone the forked repository under your user. You will then need to keep track of the upstream branch to make sure you get fixes that are being added as you work on your own branch. At some point you may submit a pull request and your code will be reviewed and potentially integrated. It will go smoother for you if you make sure your commits are small and commented.

Mathspring developers: Clone the repository on your local machine.

  1. You will need to install Tomcat (apache-tomcat-9.0.35 is the latest version) and configure eclipse to find its installation directory. You will also need Java runtime environment. For a MAC OSX you will need the whole Java Development Kit.

Useful video for installing Java on a MAC, and updating path variables:

https://www.youtube.com/watch?v=sNYvYTmOGhU

  1. Install Eclipse. Make sure your Eclipse project points at the correct Java JDK (vers 8 or higher - same with the language level because of lambdas in use)

A few videos that were useful for installing Eclipse for the MAC: https://www.youtube.com/watch?v=CL36-szyr1c

There is a Video here where Ankit explains how to set up Eclipse with Maven and Tomcat and the database: https://drive.google.com/drive/u/0/folders/1QdoEQaZ1iBiVH0J6bGjFv6BiZ9xHQDoY

We got an error at the end, as apparently it needed Java 8 and no later. See here how to install an older version of Java on a MAC: https://support.planwithvoyant.com/hc/en-us/articles/209725003-Install-or-revert-to-a-prior-version-of-Java-Mac-OS-X

  1. Project dependencies are managed by Maven so you will want to make sure you have the eclipse with maven plugin installed. The project is maintained as a single module (pom.xml) with all the dependencies and plugins configured under them.You should make changes to the Project's pom.xml unless you need to bring in new libraries to support what you are doing (take a look at whats in there, as there are likely libraries that will be useful).

  2. The META-INF/context.xml is how mathspring knows how to connect to a database.The web.xml file in web/WEB-INF/web.xml defines an init-paramter called wodb.datasource. It should be set to jdbc/wodblocal if you want to connect to your local db. Thus your context.xml must have a resource like:

<Resource name="jdbc/wodblocal" type="javax.sql.DataSource"
            auth="Container" description="Mysql database for Mathforum"
            maxActive="100" maxIdle="30" maxWait="10000" username="MyDBUser"
            password="MyDBPassword" removeAbandoned="true" removeAbandonedTimeout="60"
            logAbandoned="true"  testWhileIdle="true"
            testOnBorrow="true"
            testOnReturn="true"
            timeBetweenEvictionRunMillis="600000"
            numTestsPerEvictionRun="10"
            validationQuery="SELECT 1"
            driverClassName="com.mysql.jdbc.Driver"
            url="jdbc:mysql://localhost/wayangoutpostdb?autoReconnect=true" />

If you want to connect to a database elsewhere (e.g. on the rose server) you will need to add additional resources to the context.xml and set the web.xml init parameter wodb.datasource so it uses them.

Use Mysql Workbench and make sure this user and password is defined for your database (with only localhost access to be safe) and that it has select,insert,delete,update access.

Note: The database was originally designed on a Windows machine where table names are not case sensitive. When you install the database on other systems that have case sensitive file systems, you will need to configure mysql (ubuntu has a my.cnf file in /etc/mysql that you can edit to have lower_case_table_names = 1 )

  1. Next you need to get the mathspring math content and unzip it. This is a dir called mscontent and it must be placed in your woServer/webResources/mathspring dir (you will need to create these dirs). Get the latest mscontent zip from rose.cs.umass.edu/mathspring/backup/ The result should be /woServer/webResources/mathspring/mscontent. If you run mathspring and get a bunch of 404 errors so that it doesn't show the learning companion and math problems, it will be because you didn't do this right.

  2. Once you have created the project, add the server and configured them to your project in eclipse. Go to project settings and open the deployment asssembly tab and make sure you have the following entries there Source Deploy Path /src WEB-INF/classes /resources / /web / Maven Dependencies WEB-INF/lib

Instructions for Windows - Working with IntelliJ

Tomcat Installation:

Setting Environment Variables:

Using the "setenv" script:

Configuring Tomcat for IntelliJ Community Edition:

Start Tomcat from IntelliJ:

Build using Maven and deploy to Tomcat:

Remote debugging with Tomcat:

Access the application:

http://localhost:8080/ms/welcome.html