Difference between revisions of "Configure Tomcat service windows"

From OpenKM Documentation
Jump to: navigation, search
m (Step 6 - Install tomcat as service)
 
(23 intermediate revisions by 2 users not shown)
Line 4: Line 4:
 
Configure OpenKM in windows as service need some extra work because are several tomcat versions depending your hardware architecture.
 
Configure OpenKM in windows as service need some extra work because are several tomcat versions depending your hardware architecture.
  
We recommend before starting with installation have some good test editor application like [http://www.geany.org/Download/Releases Geany]] because will be needed modify some xml files.
+
We recommend before starting with installation have some good test editor application like [http://www.geany.org/Download/Releases Geany] because will be needed modify some xml files.
  
 
=== Step 1 - Download OpenKM Bundle ===
 
=== Step 1 - Download OpenKM Bundle ===
Download from [[http://sourceforge.net/projects/openkm/files/?source=navbar | sourceforge.net]] the latest OpenKM bundle, name will be something like  
+
Download from [http://sourceforge.net/projects/openkm/files/?source=navbar sourceforge.net] the latest OpenKM bundle, name will be something like openkm-X.X.X-community-tomcat-bundle.zip.
openkm-X.X.X-community-tomcat-bundle.zip.
 
  
 
'''Uncompress zip file at c:\'''. It will create a c:\tomcat-7.0.27 folder. '''Rename c:\tomcat-7.0.27 folder to c:\openkm'''
 
'''Uncompress zip file at c:\'''. It will create a c:\tomcat-7.0.27 folder. '''Rename c:\tomcat-7.0.27 folder to c:\openkm'''
  
{{Note|At the moment we have writting documentation the latest version is openkm-6.2.3-community-tomcat-bundle.zip}}
+
{{Note|At the moment we have writting documentation the latest version is openkm-6.2.4-community-tomcat-bundle.zip}}
  
 
=== Step 2 - Select your tomcat ===
 
=== Step 2 - Select your tomcat ===
Line 51: Line 50:
 
4.2 - Into the tag <GlobalNamingResources> add the lines:
 
4.2 - Into the tag <GlobalNamingResources> add the lines:
 
<source lang="xml">
 
<source lang="xml">
<Resource auth="Container" driverClassName="org.hsqldb.jdbcDriver" maxActive="100" maxIdle="30" maxWait="10000" name="jdbc/OpenKMDS" password="" type="javax.sql.DataSource" url="jdbc:hsqldb:${catalina.base}/repository/okmdb" username="sa" validationQuery="select 1 from INFORMATION_SCHEMA.SYSTEM_USERS"/>  
+
<Resource auth="Container" driverClassName="org.hsqldb.jdbcDriver" maxActive="100" maxIdle="30"  
 +
          maxWait="10000" name="jdbc/OpenKMDS" password="" type="javax.sql.DataSource"  
 +
          url="jdbc:hsqldb:${catalina.base}/repository/okmdb" username="sa"
 +
          validationQuery="select 1 from INFORMATION_SCHEMA.SYSTEM_USERS"/>  
 
    
 
    
 
<Resource name="mail/OpenKM" auth="Container" type="javax.mail.Session"
 
<Resource name="mail/OpenKM" auth="Container" type="javax.mail.Session"
Line 66: Line 68:
 
</source>
 
</source>
  
 +
=== Step 5 - Copy or overwrite files from c:\openkm to c:\tomcat-7.0.27 ===
 +
List of files:
 +
* c:\openkm\OpenKM.cfg
 +
* c:\openkm\OpenKM.xml
 +
* c:\openkm\PropertyGroups.xml
 +
* c:\openkm\conf\log4j.properties
 +
* c:\openkm\bin\setenv.bat
 +
* c:\openkm\conf\log4j.properties
 +
* c:\openkm\lib\javassist-3.11.0.GA.jar
 +
* c:\openkm\lib\jstl-1.2.jar
 +
* c:\openkm\lib\jta-1.1.jar
 +
* c:\openkm\lib\log4j-1.2.17.jar
 +
* c:\openkm\lib\log4j-initializer.jar
 +
* c:\openkm\lib\mail-1.4.5.jar
 +
* c:\openkm\lib\mysql-connector-java-5.1.12-bin.jar
 +
* c:\openkm\lib\tomcat-juli-adapters.jar
 +
* c:\openkm\lib\unicode.ttf
 +
* c:\openkm\lib\sigar ( entire folder )
 +
* c:\openkm\bin\tomcat-juli.jar ( overwrite )
 +
* c:\openkm\webapps\OpenKM.war
  
 +
{{Note|Maintain relative $TOMCAT_HOME when copy or overwrite. For example c:\openkm\OpenKM.cfg should be copyed to c:\tomcat-7.0.27\OpenKM.cfg}}
  
  
 +
=== Step 6 - Install tomcat as service ===
 +
{{Note| In oficial [http://tomcat.apache.org Apache tomcat website] you can find information about how to [http://tomcat.apache.org/tomcat-6.0-doc/windows-service-howto.html Configure Tomcat as service in window], is not trivial understand.}}
  
 +
{{Warning|Before starting this point, consider have already installed Java JDK otherside next steps will not be exactly as are shown from here until the end. Basically tomcat will not detect your jdk and you will need to configure yourself into service parameters}}
  
 +
6.1 '''Open windows terminal as administrator'''.
  
 +
[[File:Okm_installation_guide_019.png|center]]
  
 +
6.2 Go to folder '''bin''' if you have followed all steps should be '''c:\tomcat-7.0.27\bin'''
  
 +
6.3 Execute the commands:
 +
service.bat install
 +
tomcat7 //US//Tomcat7 -JvmMx 1024
 +
tomcat7 //US//Tomcat7 ++JvmOptions="-XX:MaxPermSize=256m"
 +
tomcat7 //US//Tomcat7 ++JvmOptions="-XX:PermSize=128m"
 +
tomcat7 //US//Tomcat7 ++JvmOptions="-Djava.awt.headless=true"
 +
tomcat7 //US//Tomcat7 ++JvmOptions="-Dfile.encoding=utf-8"
  
 +
{{Note| here we've configured tomcat to use only 1024mb, depending your harware resource that can be changed}}
  
 +
6.4 Execute tomcat7w as administrator.
  
 +
[[File:Okm_installation_guide_020.png|center]]
  
 +
Take a look at configuration parameters. Configure Service as manual or automatic.
  
 +
{| align="center"
 +
|[[File:Okm_installation_guide_021.png|center]]
 +
|[[File:Okm_installation_guide_022.png|center]]
 +
|-
 +
|[[File:Okm_installation_guide_023.png|center]]
 +
|[[File:Okm_installation_guide_024.png|center]]
 +
|-
 +
|colspan="2"|[[File:Okm_installation_guide_025.png|center]]
 +
|}
  
 +
=== Step 7 - Configure environment variables ===
 +
Open environment variables:
  
 +
[[File:Okm_installation_guide_026.png|center]]
  
  
 +
[[File:Okm_installation_guide_027.png|center]]
  
  
 +
[[File:Okm_installation_guide_028.png|center]]
  
  
 +
'''Add sigar''' folder path -  c:\openkm\lib\sigar\ - to your environment path:
  
  
 +
[[File:Okm_installation_guide_029.png|center]]
  
 +
=== Step 8 - Start openkm service ===
 +
You can start OpenKM service from windows service panel or from tomcat7w.exe utility. In both cases you can start / stop OpenKM service.
  
=== Known issue ===
+
[[File:Okm_installation_guide_031.png|800px|center]]
If you got openoffice or libreoffice configured will get some error when OpenKM try start as service, to solve it edit your general environment variable PATH and add your '''tomcat\lib\sigar\''' folder, for example like '''PATH=...;C:\Program Files\OpenKM-6.2.1\tomcat\lib\sigar'''
+
 
<source lang="java">
+
or
Caused by: java.lang.UnsatisfiedLinkError: org.hyperic.sigar.Sigar.getSigNum(Ljava/lang/String;)I
+
 
at org.hyperic.sigar.Sigar.getSigNum(Native Method)
+
[[File:Okm_installation_guide_030.png|center]]
at org.hyperic.sigar.Sigar.kill(Sigar.java:275)
 
</source>
 
  
  
 
[[Category: Installation Guide]]
 
[[Category: Installation Guide]]

Latest revision as of 00:20, 16 September 2013

Running as a Windows Service

Configure OpenKM in windows as service need some extra work because are several tomcat versions depending your hardware architecture.

We recommend before starting with installation have some good test editor application like Geany because will be needed modify some xml files.

Step 1 - Download OpenKM Bundle

Download from sourceforge.net the latest OpenKM bundle, name will be something like openkm-X.X.X-community-tomcat-bundle.zip.

Uncompress zip file at c:\. It will create a c:\tomcat-7.0.27 folder. Rename c:\tomcat-7.0.27 folder to c:\openkm


Nota clasica.png At the moment we have writting documentation the latest version is openkm-6.2.4-community-tomcat-bundle.zip

Step 2 - Select your tomcat

Uncompress zip file at c:\. It will create a c:\tomcat-7.0.27 folder


Nota clasica.png At this point we got two folders c:\openkm which contains OpenKM bundle and tomcat-7.0.27 which contains tomcat in correspondence with your hardware architecture

Step 3 - Modify context.xml files

Modify file c:\tomcat-7.0.27\conf\context.xml.

3.1 - After line:

<WatchedResource>WEB-INF/web.xml</WatchedResource>

Add lines:

<ResourceLink global="jdbc/OpenKMDS" name="jdbc/OpenKMDS" type="javax.sql.DataSource"/>
<ResourceLink global="mail/OpenKM" name="mail/OpenKM" type="javax.mail.Session"/>

Step 4 - Modify server.xml files

Modify file c:\tomcat-7.0.27\conf\server.xml.

4.1 - After line:

<Listener className="org.apache.catalina.core.ThreadLocalLeakPreventionListener" />

Add lines:

<!-- Automatically reload log4j configuration -->
<Listener className="com.openkm.util.Log4JInitializer" configFile="${catalina.base}/conf/log4j.properties"/>

4.2 - Into the tag <GlobalNamingResources> add the lines:

<Resource auth="Container" driverClassName="org.hsqldb.jdbcDriver" maxActive="100" maxIdle="30" 
          maxWait="10000" name="jdbc/OpenKMDS" password="" type="javax.sql.DataSource" 
          url="jdbc:hsqldb:${catalina.base}/repository/okmdb" username="sa"
          validationQuery="select 1 from INFORMATION_SCHEMA.SYSTEM_USERS"/> 
  
<Resource name="mail/OpenKM" auth="Container" type="javax.mail.Session"
            mail.smtp.host="localhost" mail.from="testing@openkm.com"/>

4.3 - Modify line:

<Connector connectionTimeout="20000" port="8880" protocol="HTTP/1.1" redirectPort="8443"/>

To

<Connector address="0.0.0.0" connectionTimeout="20000" port="8880" protocol="HTTP/1.1" redirectPort="8443"/>

Step 5 - Copy or overwrite files from c:\openkm to c:\tomcat-7.0.27

List of files:

  • c:\openkm\OpenKM.cfg
  • c:\openkm\OpenKM.xml
  • c:\openkm\PropertyGroups.xml
  • c:\openkm\conf\log4j.properties
  • c:\openkm\bin\setenv.bat
  • c:\openkm\conf\log4j.properties
  • c:\openkm\lib\javassist-3.11.0.GA.jar
  • c:\openkm\lib\jstl-1.2.jar
  • c:\openkm\lib\jta-1.1.jar
  • c:\openkm\lib\log4j-1.2.17.jar
  • c:\openkm\lib\log4j-initializer.jar
  • c:\openkm\lib\mail-1.4.5.jar
  • c:\openkm\lib\mysql-connector-java-5.1.12-bin.jar
  • c:\openkm\lib\tomcat-juli-adapters.jar
  • c:\openkm\lib\unicode.ttf
  • c:\openkm\lib\sigar ( entire folder )
  • c:\openkm\bin\tomcat-juli.jar ( overwrite )
  • c:\openkm\webapps\OpenKM.war

Nota clasica.png Maintain relative $TOMCAT_HOME when copy or overwrite. For example c:\openkm\OpenKM.cfg should be copyed to c:\tomcat-7.0.27\OpenKM.cfg


Step 6 - Install tomcat as service


Nota clasica.png In oficial Apache tomcat website you can find information about how to Configure Tomcat as service in window, is not trivial understand.


Nota advertencia.png Before starting this point, consider have already installed Java JDK otherside next steps will not be exactly as are shown from here until the end. Basically tomcat will not detect your jdk and you will need to configure yourself into service parameters

6.1 Open windows terminal as administrator.

Okm installation guide 019.png

6.2 Go to folder bin if you have followed all steps should be c:\tomcat-7.0.27\bin

6.3 Execute the commands:

service.bat install
tomcat7 //US//Tomcat7 -JvmMx 1024
tomcat7 //US//Tomcat7 ++JvmOptions="-XX:MaxPermSize=256m"
tomcat7 //US//Tomcat7 ++JvmOptions="-XX:PermSize=128m"
tomcat7 //US//Tomcat7 ++JvmOptions="-Djava.awt.headless=true"
tomcat7 //US//Tomcat7 ++JvmOptions="-Dfile.encoding=utf-8"

Nota clasica.png here we've configured tomcat to use only 1024mb, depending your harware resource that can be changed

6.4 Execute tomcat7w as administrator.

Okm installation guide 020.png

Take a look at configuration parameters. Configure Service as manual or automatic.

Okm installation guide 021.png
Okm installation guide 022.png
Okm installation guide 023.png
Okm installation guide 024.png
Okm installation guide 025.png

Step 7 - Configure environment variables

Open environment variables:

Okm installation guide 026.png


Okm installation guide 027.png


Okm installation guide 028.png


Add sigar folder path - c:\openkm\lib\sigar\ - to your environment path:


Okm installation guide 029.png

Step 8 - Start openkm service

You can start OpenKM service from windows service panel or from tomcat7w.exe utility. In both cases you can start / stop OpenKM service.

Okm installation guide 031.png

or

Okm installation guide 030.png