# Installation of Tomcat Server and Deploying CData Sync on it

**URL:** <https://community.cdata.com/t/installation-of-tomcat-server-and-deploying-cdata-sync-on-it/861>\
**Category:** Editions\
**Tags:** article, cdata-sync, deployment, apache-tomcat\
**Created:** [July 12, 2024, 9:28pm UTC](https://community.cdata.com/t/installation-of-tomcat-server-and-deploying-cdata-sync-on-it/861 "2024-07-12T21:28:02Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Harsh\_Paliwal](https://avatars.discourse-cdn.com/v4/letter/h/49beb7/32.png) [@Harsh\_Paliwal](https://community.cdata.com/u/Harsh_Paliwal)\
**Post date:** [July 12, 2024, 9:28pm UTC](https://community.cdata.com/t/installation-of-tomcat-server-and-deploying-cdata-sync-on-it/861/1 "2024-07-12T21:28:03Z")

</div>

Apache Tomcat is a popular free and open-source web container and webserver to serve Java-based web apps or pages.

1. Download Tomcat server’s latest edition Zip file from [https://tomcat.apache.org/](https://tomcat.apache.org/) and extract the files to a particular folder(64bit or 32 bit as per requirement).

2. Install the Java edition of CData Sync from&nbsp; our website and place it in some folder.

3. Copy sync.war and services.war file from the specified path _**(C:\ProgramFiles\CData\java sync\webapp)**_ and paste it inside the tomcat folder at specific path **(_D:\apache-tomcat-9.0.68-windows-x64\apache-tomcat-9.0.68\webapps_) .**

4. Navigate to the _conf_ sub-directory within the extracted directory and locate the server.xml file. The default connection port is  **8080**. To choose a different port, edit the  **server.xml** **(ex: tomcat\conf\server.xml)** file with a text editor, such as Notepad++, and locate the following lines:

_ **\<Connector port=“8080” protocol=“HTTP/1.1”** _

_ **connectionTimeout=“20000”** _

_ **redirectPort=“8443” /\>** _

Change the connector port number to any number&nbsp;&nbsp;&nbsp;&nbsp; between _**1024 and 65535(If needed)**._

1. Again, visit conf sub directory and locate _ **tomcat.users.xml file** _ .

Create user for Tomcat and provide the necessary details.

**\<user username=”admin” password=”Admin123@” roles=”manager-gui”/\>**

**Configure the Java Authentication and Service(JAAS)**

To enable Sync to manage users dynamically within the application, you must configure the JAAS as described in the following subsections.

**_Create the Login Module_**

1. Create a JAAS configuration file with the name **jaas.config** in this folder: $tomcat/conf/.

2. Include the following content in the **jaas.config** to use standard authentication:

**Sync{sync.LoginModule required;};**

**Create (or Modify) the JAASRealm Module**

1. Create a context for Sync by creating (or modifying, if it is present) the configuration XML file that is located here:

**_D:\apache-tomcat-9.0.68-windows-x64\apache-tomcat-9.0.68_\conf\Catalina\localhost\sync.xml**

**Note** : Depending on how Tomcat is configured, this path might be slightly different. In this example, Catalina refers to the engine name, and localhost is the hostname that is defined in server.xml.

1. Define a _\<Context\>_ block and add an _\<Realm\>_ element as shown below:

**\<Context\>**

**\<Realm className=“org.apache.catalina.realm.JAASRealm” appName=“Sync”**

**userClassNames=“sync.SimplePrincipal”**

**roleClassNames=“sync.GroupPrincipal” /\>**

**\</Context\>**

1. Then, update the _\<Host\>_ element in the **server.xml** configuration file for the Tomcat server by setting the _copyXML_ attribute to _true_, as shown below:

**\<Host name=“localhost” appBase=“webapps” unpackWARS=“true” autoDeploy=“true” copyXML=“true”\>**

**…**

**\</Host\>**

**_Make the Login Module Visible_**

1. The Java virtual machine (JVM) must be directed to the login module (jaas.config) for the configuration to be visible. Set the java.security.auth.login.config system property on the JVM to the path of the jaas.config file. To do so, append the following line to

**_D:\apache-tomcat-9.0.68-windows-x64\apache-tomcat-9.0.68_\conf\catalina.properties** &nbsp; file:

**java.security.auth.login.config=${catalina.base}/conf/jaas.config**

1. Customize your app directory(In my case its under D:/Tomcat) for the application within the server.xml file for the Tomcat server:

**\<Context path=“sync”\>**

**\<Parameter name=“APP\_DIRECTORY” value=“D:\Tomcat” override=“false”/\>**

**\<Realm className=“org.apache.catalina.realm.JAASRealm” appName=“Sync”**

**userClassNames=“sync.SimplePrincipal”**

**roleClassNames=“sync.GroupPrincipal” /\>**

**\</Context\>**

**Restart Before Starting the Application**

**Start the application**

1. Navigate to the tomcat/bin folder, go to File open the directory with the PowerShell:

 ![b351a646-9e87-4b3c-89c9-9245b050ee00.png](https://us1.discourse-cdn.com/cdata/original/2X/f/f6ef6390d69e4acd3569e9286bc624c734cbf24d.png)

1. Enter the command to start the tomcat server:

 ![2e26ac31-84d1-4ef0-aece-b56c1f408646.png](https://us1.discourse-cdn.com/cdata/original/2X/c/cd15a99ce5cacf08fce9886cbd1eb4d176baa781.png)

1. The new terminal will start initializing the Sync application. Then go to any browser and enter **localhost:8080** (the Port may differ based on the server.xml). for the first time, it will ask to create a new user. Enter details and log in to the application.

2. Now you can navigate to the app directory to see whether the database is created or not. In my case, it is under **D:\Tomcat**.

 ![1798eccc-05de-4434-acc7-e1127e32a552.png](https://us1.discourse-cdn.com/cdata/original/2X/b/bab7e5962ad54b9dba1aa81c1c42508f1a586165.png)

1. To shutdown the server:

 ![0ab6ab31-f2d8-4015-9c62-e3295e0887fd.png](https://us1.discourse-cdn.com/cdata/original/1X/552dd7fb356257facbfe96b3f429eb2bd8c69dee.png)

Now run the server on localhost:8080 (port which you specified in the server.xml file.

Login with your username and password.

 ![07b7a51b-90d4-4edd-ba1b-2f1c7965a23d.png](https://us1.discourse-cdn.com/cdata/original/2X/2/2969740895fa5185ee58f7433d07775b5c5b6c3a.png)

Go to Manager Apps.

 ![2549f6c7-c2d9-44ef-adff-f02294bf3bc3.png](https://us1.discourse-cdn.com/cdata/original/2X/a/a31839716521e3a294f6157275f2d561b6450f65.png)
