Need

We will see in this article how to install 2 Analytics on the same Tomcat server.


Summarized Solution

To install 2 Analytics on the same Tomcat server, we will:

  • clear Tomcat’s cache

  • duplicate .war file

  • specify database definition for each Analytics


Detailed Solution


Clear the cache:

  1. Stop Tomcat.

  2. Delete the "semarchy-xdi-analytics" folder located in the "webapps" directory.

  3. Delete the "Catalina" folder located in the "work" directory.

  4. Restart Tomcat.

Duplicate the .war file and rename it

There will be two analytics sharing the same database and accessible via two different URLs.
In my case: 

http://localhost:8080/semarchy-xdi-analytics/semarchy
http://localhost:8080/semarchy-xdi-analytics_2/semarchy


Specify the database for each Analytics

  1. For each Analytics, in the "conf" directory, comment out the resource section of the "context.xml" file and set the correct information to connect to each database.

  1. In the "conf/Catalina/localhost" directory, create two files, each corresponding to an instance of Analytics with the same name as the WAR files (as mentioned above).

  1. In these files, provide the resource corresponding to your database along with the standard Valve.

<?xml version=""1.0"0" encoding=""UTF-8"8"?>
<Context>
<Valve className=""org.apache.catalina.authenticator.FormAuthenticator"FormAuthenticator" landingPage=""/"" />

<Resource name=""jdbc/xdi-analytics-datasource-tomcat"tomcat"  
    auth="Container""Container" type=""javax.sql.DataSource"DataSource"
        driverClassName=""org.postgresql.Driver"Driver" 
        url=""jdbc:postgresql://localhost:5432/postgres"postgres"
        username="analytique2""analytique2" 
        password="analytique2""analytique2" 
        maxTotal="100""100" 
        maxIdle="30""30" 
        maxWaitMillis="10000""10000" 
    />
</Context>


You can now connect to both Analytics: