Running GateIn-3.0 via JSVC

Run GateIn on port 80 as user 'tomcat' with the speed of the Apache httpd server.

To accomplish this, two items need to happen

  1. Tomcat needs to be launched as root, but run as an unpriviledged user.
    • 'jsvc' ( is a great tool for launching tomcat (or any java application) as root, then transfering control to a different user.  This is very handy when you want to run tomcat on port 80, but do not want to run as root.  The jsvc will launch tomcat as root to establish port, log files, etc., then spawn a child running with the UID of choice.
  2. Tomcat needs to be able to use the apache portable runtime libraries.      


Fortunatly, these two items are provided by just downloading the GateIn 3.0.0 Beta2 with Tomcat 6.0.20 (tar.gz) from




  1. First step is to download the GateIn-3.0.0-Beta02-tomcat.tar.gz
  2. I am planning on having the code under the '/opt' directory, so expand the GateIn-3.0.0-Beta02-tomcat.tar.gz under the '/opt' directory.
  3. I also plan on having a symbolic link to '/opt/gatein/ that points to the GateIn directory.  That way I can upgrade without having to make too many changes to the init script. 
    • ln -s /opt/GateIN-3.0.0.Beta2 /opt/gatein
  4. cd into /opt/gatein/bin 
    • You will see two archives:
      1. jsvc.tar.gz
      2. tomcat-native.tar.gz
    • expand each, compile and install each one. 
    • As an example, I compiled the jsvc with the following command 
      • ./configure --with-java=/usr/jd
    • The tomcat-native I compiled as 
      • ./configure --with-java-home=/usr/jdk --with-apr=/usr --with-ssl=/usr/lib/openssl --prefix=/usr/local
  5. Create the user 'tomcat' with his home being '/opt/tomcat' 
    • useradd -g 48 -u 58 -d /opt/tomcat -M -s /sbin/nologin tomcat
  6. Since I want to run tomcat on port 80 and I am not going to use the AJP connector, I made the following changes to the server.xml file 
    • --- server.xml.orig    2009-10-28 09:38:51.000000000 -0500
      +++ server.xml    2009-10-21 15:13:02.000000000 -0500
      @@ -61,7 +61,7 @@
                APR (HTTP/AJP) Connector: /docs/apr.html
                Define a non-SSL HTTP/1.1 Connector on port 8080
      -    <Connector port="8080" protocol="HTTP/1.1"
      +    <Connector port="80" protocol="HTTP/1.1"
                      maxThreads="150" connectionTimeout="20000"
                      redirectPort="8443" URIEncoding="UTF-8"/>

      @@ -76,7 +76,7 @@

           <!-- Define an AJP 1.3 Connector on port 8009 -->
      -    <Connector port="8009" protocol="AJP/1.3" redirectPort="8443"/>
      +    <!-- <Connector port="8009" protocol="AJP/1.3" redirectPort="8443"/> -->

           <!-- An Engine represents the entry point (within Catalina) that processes
  7. I changed owners to be tomcat 
    • chown -R tomcat /opt/GateIn-3.0.0-Beta02
  8. Attached is the init.d script that I put in /etc/init.d. 
  9. Test and run the GateIn portal by running the command:
    • "service gatein start" or
    • "service gatein stop"


Items to be aware of:
  • The gadgets, by default, are configured to connect to the localhost port 8080.  If you want to run on port 80, then go into the Administrator and edit the gadgets to run on port 80.
    • file eXoGadgets/gadgets/Todo/Todo.xml