Skip to content
This repository was archived by the owner on Jun 7, 2024. It is now read-only.

Deployment on Microsoft Windows

mlist edited this page May 7, 2014 · 1 revision

Deployment on Microsoft Windows

##Author

  • Payman Tohidifar
  • The Rao Lab, PhD Student
  • Department of Chemical & Biomolecular Engineering
  • University of Illinois at Urbana-Champaign

OLF requires apache-Tomcat to run. What is Apache Tomcat?

It is an application server or web server or servlet container developed by the Apache Software Foundation (ASF) and released under the Apache License version 2. HTTP web servers provide an environment for Java code to run in. It includes tools for configuration and management, but can also be configured by editing XML configuration files. Most of the modern Java web frameworks are based on servlets and JavaServer Pages and can run on Apache Tomcat, for example Struts, JavaServer Faces, Spring, etcetera.

Apache Tomcat7.0.XX new released

The Apache Tomcat team has released version 7.0.53 of Apache. They removed several fixes that stop Tomcat attempting to parse text, improved handling and reporting if a ConcurrentModificationException occurs while checking for memory leaks, etcetera.

How to Install Tomcat 7.0.53

There are certain steps we must follow for configuring Apache Tomcat 7.

  • Step 1: Download and Install Tomcat. Go to http://tomcat.apache.org/download-70.cgi then go to the Binary Distribution/Core/ and download the "zip" package (for example "apache-tomcat-7.0.53.zip"). Now unzip the downloaded file into a directory of your choice. Don't unzip onto the dekstop (since its path is hard to locate). I suggest using "C:\myserver" or "D:\myserver". Tomcat will be unzipped into the directory "C:\myserver\apache-tomcat-7.0.53".

  • Step 2: Check the installed directory to ensure it contains the following sub-directories: bin, logs, webapps, work, temp, conf, lib.

  • Step 3: Now, you need to create an Environment Variable JAVA_HOME. You need to create an environment variable called "JAVA_HOME" and set it to your JDK installed directory.To create the JAVA_HOME environment variable in Windows 7/8.1 you need to push the "Start" button then select "Control Panel" / "System" / "Advanced system settings". Then switch to the "Advanced" tab and select "Environment Variables" / "System Variables" then select "New" (or "Edit" for modification). In "Variable Name", enter "JAVA_HOME". In "Variable Value", enter your JDK installed directory (e.g., "c:\Program Files\Java\jdk1.7.0_{xx}"). For ensuring that it is set correctly, you need to start a command shell (to refresh the environment) and issue: set JAVA_HOME JAVA_HOME=c:\Program Files\Java\jdk1.7.0_{xx} <== Check that this is your JDK installed directory. Sometimes you need to set JRE_HOME also. So for creating JRE_HOME you need to use the same procedure. So you can set JRE_HOME to your jre installed directory as you did for JAVA_HOME

  • Step 4: Configure Tomcat Server. The configuration files of the Apache Tomcat Server are located in the "conf" sub-directory of our Tomcat installed directory, for example "C:\myserver\apache-tomcat7.0.53\conf". There are 4 configuration XML files: context.xml file, tomcat-users.xml file, server.xml file, web.xml file Before proceeding, make a BACKUP of the configuration files.

  • Step 4(a): "conf\web.xml"; Enabling a Directory Listing Open the configuration file "web.xml". You shall enable the directory listing by changing "listings" from "false" to "true" for the "default" servlet.

listings true
  • Step 4(b) "conf\server.xml file"; set the TCP Port Number (This is optional) Open the file "server.xml" in a text editor.The default port number of Tomcat is 8080. Now you need to change the TCP port number for Tomcat, since the same port number can be used by other servers like SQL Server. You may choose any number between 1024 and 65535. You shall choose 9999 in this article. Locate the following lines, and change port="8080" to port="9999". Like:

<Connector port="9999" protocol="HTTP/1.1"

  • Step 4(c): "conf\context.xml"; Enabling Automatic Reload In that you set reloadable="true" to the element to enable automatic reload after code changes.Add reloadable="true" as in the following:
  • Step 4(d): "conf\tomcat-users.xml" (Optional) It is used to manage Tomcat by adding the highlighted lines, inside the elements. In that we can add a password and username as an optional step. By default, users are not allowed to access "Manager App" or "Server Status" in Tomcat webpage. To activate those add the following lines to your "conf\tomcat-users.xml" under :
...
  • Step 5: Now, start the tomcat server. Executable programs and scripts are kept in the "bin" sub-directory of the Tomcat installed directory, e.g., "C:\myserver\apache-tomcat7.0.53\bin".

  • Step 5(a): Start Server. Launch a command shell. Set the current directory to "<TOMCAT_HOME>\bin" like C:\myserver\apache-tomcat7.0.53\bin, and run "startup.bat" as follows:

C:\myserver\apache-tomcat-7.0.53\bin>startup.bat

Note that this is the manual server start-up which uses batch process *.bat file. You will need to run it as a Windows Service for deploying OLF.

  • Step 6: To shutdown the server you may invoke "shutdown.bat" in "/apache-tomcat7.0.53/bin" or simply ctrl+c in tomcat console.

*Source:This article is retrieved from "http://www.c-sharpcorner.com/UploadFile/fd0172/how-to- configure-and-install-apache-tomcat-server-in-windows/" and adapted for OLF deployment in Windows7 and 8.1.


Deploying OLF with Apache-Tomcat 7

Here, it is assumed that you have installed and configured your Tomcat 7 as it is described above. Please note that if you are deploying OLF on a Tomcat 7 installation using the manager application you should be aware that there is a default limit for the maximal size of a WAR file (50 MB). OLF WAR files, however, can be larger than that, so you should locate the config file of the manager application: "\your\path\to\apache-tomcat7.0.53\webapps\manager\WEB-INF\web.xml" and increase the corresponding limit:

104857600 104857600 0
  • Step (1): Download OLF WAR file In order to deploy OLF, download OLF WAR file from "https://github.com/NanoCAN/OpenLabFramework/releases" and place it into your tomcat webapp subdirectory (e.g. C:\myserver\apache-tomcat7.0.53\webapps). It is important to rename the "OpenLabFramework-1.2.1.war" file to "OpenLabFramework.war", otherwise, you won't be able to login to OLF after deployment.

  • Step (2): Run tomcat as windows service In order to run tomcat as windows service, run a "Command Prompt" as Administrator and change the directory to "\your_tomcat_directory\bin". Then invoke the follwing command:

C:\myserver\apache-tomcat7.0.53\bin>service.bat install

It will install a windows service for your tomcat where the default name is "Tomcat7".

  • Step (3): Increase your java Maximum Permanent generation Size . To do that in your Command Prompt invoke the following line to edit your java options:

C:\myserver\apache-tomcat7.0.53\bin>tomcat7w.exe //ES//Tomcat7

You will see a window "Apache Tomcat 7 Tomcat7 Properties" or other similar names. Go to "Java" tab and add the following line to the end of existing lines in "Java Options" section:

-XX:MaxPermSize=512m

Then increase your initial and maximum heap memory as well as Thread stack memory in "Initial memory pool", "Maximum memory pool", and Thread stack size, respectively: Initial memory pool: 512 MB Maximum memory pool: 512 MB Thread stack size: 256 MB

Please note that if you assign memory size less than those mentioned above, you may get "java.lang.OutOfMemoryError: PermGen space" error. However, you can resolve the issue by assigning more memory. Numbers above are already tested for 4GB RAM in Windows 7 and 8.1.

  • Step (4): Run you Tomcat 7. In your Command Prompt invoke the following line to start the server as a Windows service.

C:\myserver\apache-tomcat7.0.53\bin>tomcat7.exe

For detailed information about running tomcat as Windows service, please refer to "http://tomcat.apache.org/tomcat-7.0-doc/windows-service-howto.html"

You may see the process of deploying OLF and tomcat associated web applications in tomcat console.

Then login with the following username and password: Username: admin password: demo0815

Clone this wiki locally