Resin Web ServerResin 3.0
Resin 3.0

Features
Installation
Configuration
Web Applications
IOC/AOP
Resources
JSP
Servlets and Filters
Portlets
Databases
Admin (JMX)
CMP
EJB
Amber
EJB 3.0
Security
XML and XSLT
XTP
JMS
Performance
Protocols
Third-party
Troubleshooting/FAQ

Quick Start
Standalone Web Server
Apache
IIS
Details
FAQ
Scrapbook
Quick Start
Installation
Apache

Resin provides a fast standalone web server. In our benchmarks, it serves static pages faster than Apache! For many sites, the standalone web server is ideal because of its performance and because it is easier to configure and maintain than using a separate web server.

  1. Unix (including Linux and MacOS-X)
    1. Getting Started
    2. ./configure options
    3. Deploying on Unix
    4. bin/httpd.sh
    5. Starting Script
  2. Windows
    1. Getting Started
    2. Deploying as a Windows Service
  3. Command-line arguments
    1. Memory Configuration
  4. Starting Java directly

Unix (including Linux and MacOS-X)

Getting Started

The following steps will start Resin for development:

  1. Install JDK 1.4 or later and link /usr/java to the Java home or set environment variable JAVA_HOME.
  2. tar -vzxf resin-3.0.0.tar.gz
  3. (Optional) Link /usr/local/resin to the resin-3.0.0 directory.
  4. ./configure; make; make install
  5. Execute resin-3.0.0/bin/httpd.sh
  6. Browse http://localhost:8080

Getting Started on Unix
unix> resin-3.0.x/bin/httpd.sh
Resin 3.0.0-beta (built Thu Feb 13 18:21:13 PST 2003)
Copyright(c) 1998-2002 Caucho Technology.  All rights reserved.

Starting Resin on Sat, 01 Mar 2003 19:11:52 -0500 (EST)
[19:11:56.479] ServletServer[] starting
[19:11:57.000] Host[] starting
[19:11:58.312] Application[http://localhost:8380/doc] starting
[19:12:11.872] Application[http://localhost:8380/quercus] starting

...

[19:12:12.803]http listening to *:8380
[19:12:12.933]hmux listening to *:6802

./configure options

--enable-64bitCompiles the JNI using 64-bits

The 64-bit JNI compilation must match the JDK you're using, i.e. you'll need to use something like "-J-d64" to properly enable 64 bit JDKs.

Deploying on Unix

When deploying, it's a good idea to create a bit of structure to make Resin and website upgrades easier and more maintainable.

  1. Create a user to run Resin (e.g. resin or another non-root user)
  2. Link /usr/local/resin to the current Resin version. This is $RESIN_HOME.
  3. Create a deployment root, e.g. /usr/local/web, owned by the resin user. This is $SERVER_ROOT.
  4. Put the modified resin.conf in /usr/local/web/conf/resin.conf
  5. Put the site documents in /usr/local/web/doc.
  6. Put any .war files in /usr/local/web/webapps.
  7. Output logs will appear in /usr/local/web/log.
  8. Create a startup script and configure the server to start it when the machine reboots.

bin/httpd.sh

bin/httpd.sh uses a perl script, resin-3.0.0/bin/wrapper.pl, to control the Java process (bin/httpd.sh is a tiny shell script that calls wrapper.pl). You can modify bin/httpd.sh.

If you need to stop Resin with kill, you'll need to kill the wrapper.pl process to make sure it doesn't restart Resin. ("httpd.sh stop" works by killing the wrapper.pl process.) or bin/wrapper.pl for your configuration.

In a production environment, the "start" and "stop" arguments to bin/httpd.sh will start and stop Resin as a Unix daemon for extra reliability. If Resin should ever exit, it will automatically be restarted.

Starting Script

You can create your own starting script which will start and stop your Resin instance, and will pass any command-line arguments. The script will typically do a number of things:

  1. Configure the location of Java in JAVA_HOME
  2. Configure the location of Resin in RESIN_HOME
  3. Configure your web site directory in SERVER_ROOT
  4. Select a server and pid file if you have multiple Resin servers.
  5. Start and stop the Resin daemon.

The start script might look like:

Example start.sh script
#!/bin/sh

JAVA_HOME=/usr/java
RESIN_HOME=/usr/local/resin
SERVER_ROOT=/usr/local/web

export JAVA_HOME
export RESIN_HOME
export SERVER_ROOT

$RESIN_HOME/bin/httpd.sh -server-root $SERVER_ROOT \
                         -conf $SERVER_ROOT/conf/resin.conf \
                         -server a -pid $SERVER_ROOT/a.pid \
                         $*

The script would be called as "./start.sh start" to start and "./start.sh stop" to stop.

The -server and -pid arguments are only necessary if you have multiple JVMs either on different machines or the same machine. The load balancing and distributed sessions pages describe when you might use -server and -pid.

More information on deploying on Unix is available at:

Windows

Getting Started

  1. Install JDK 1.4 or later.
  2. Make sure the JDK installation set the environment variable JAVA_HOME correctly
  3. Unzip resin-3.0.0.zip
  4. Execute resin-3.0.0/httpd.exe
  5. Browse http://localhost:8080

Starting on Win32
C:\win32> resin-3.0.0\bin\httpd
Resin 3.0.0-beta (built Thu Feb 13 18:21:13 PST 2003)
Copyright(c) 1998-2002 Caucho Technology.  All rights reserved.

Starting Resin on Sat, 01 Mar 2003 19:11:52 -0500 (EST)
[19:11:56.479] ServletServer[] starting
[19:11:57.000] Host[] starting
[19:11:58.312] Application[http://localhost:8380/doc] starting
[19:12:11.872] Application[http://localhost:8380/quercus] starting

...

[19:12:12.803]http listening to *:8380
[19:12:12.933]hmux listening to *:6802

Deploying as a Windows Service

The Resin Web Server can be installed as an Windows service.

To install the service, use

C:\> resin-3.0.x\bin\httpd -install -conf conf/myconf.conf

To remove the service, use

C:\> resin-3.0.x\bin\httpd -remove

You will either need to reboot the machine or start the service from the Control Panel/Services panel to start the server. On a machine reboot, Windows will automatically start the web server.

You can also start and stop the service from the command-line:

C:\> net start resin
...
C:\> net stop resin

Resin's -install saves the command-line arguments and starts the service with those arguments. You can look at them in the control panel, under the executable string.

With multiple servers, you can use -install-as foo to specify the service name.

C:\> resin-3.0.x\bin\httpd -install-as ResinA -conf conf/myconf.conf -server a
C:\> net start ResinA

Note: There is a bug in many JDKs which cause the JDK to exit when the administrator logs out. You can avoid that bug if the JDK is started with -Xrs.

C:\> resin3.0.0/httpd.exe -install -Xrs

Command-line arguments

ArgumentMeaningDefault
-verboseShow the Java environment before starting Resin.off
-conf xxxSelects the Resin configuration fileconf/resin.conf
-java_home xxxSets the JDK (also recognizes the environment variable JAVA_HOME.)A heuristic search
-resin_home xxxSets the Resin home directory (also recognizes the environment variable RESIN_HOME.)The parent directory of wrapper.pl
-classpath xxxAdds to the system classpath.$CLASSPATH
-pid xxx(Unix) With start or stop, sets the file to save the process id.resin.pid
-stdout xxxSets the file to save stdout messages.log/stdout.log.
-stderr xxxSets the file to save stdout messages.log/stderr.log.
-Dmy.foo=valueSets a Java system property.n/a
-XxxxPasses the -Xxxx command to the JDK.n/a
-JxxxPasses xxx as a JDK argument.n/a
-nojitDisables the Just-In-Time compiler. Useful for debugging.enabled
start(Unix) Starts Resin as a daemon, saving the pid in the pid file.n/a
stop(Unix) Stops Resin as a daemon, using the pid in the pid file.n/a
restart(Unix) Restarts Resin as a daemon, using the pid in the pid file.n/a
-install(Windows) install Resin as a service (but doesn't automatically start.)n/a
-install-as xxx(Windows) install Resin as a named service (but doesn't automatically start.)n/a
-remove(Windows) install Resin as a service (but doesn't automatically start.)n/a
-remove-as xxx(Windows) remove Resin as a named service (but doesn't automatically start.)n/a

Memory Configuration

Memory configuration is part of the JVM's arguments. For most JVMs, you can find the full list by starting "java -X".

Memory Configuration
-Xms<size>Initial Java heap size, e.g. -Xms32m
-Xmx<size>Maximum Java heap size, e.g. -Xmx128m

Starting Java directly

You can use the -verbose flag to see the arguments the startup scripts/executables pass to the JDK. The main Java executable is com.caucho.server.resin.Resin and starting Resin looks like the following, once you've properly configured the classpath:

unix> java -Dresin.home=/usr/resin \
           -Djava.util.logging.manager=com.caucho.log.LogManagerImpl \
           com.caucho.server.resin.Resin \
           -conf conf/resin.conf 


Quick Start
Installation
Apache
Copyright © 1998-2005 Caucho Technology, Inc. All rights reserved.
Resin® is a registered trademark, and HardCoretm and Quercustm are trademarks of Caucho Technology, Inc.