caucho
Resin
FAQ
Reference Guide
JavaDoc
Demo
Tutorial

Getting Started
Configuration
EJB
Topics
JSP
XTP/XSL

Resin Web Server
Unix Apache
Windows Apache
Unix Netscape
IIS
WebSite
Other Servlets
 

Getting Started
Getting Started
Unix Apache

    Resin provides a standalone web server. In our benchmarks, it actually serves static pages faster than Apache! The standalone web server is ideal for evaluation or experimentation and is a good choice as the web server for many sites.

    To start the Resin web server, type:
    Starting on Unix
    unix> resin1.2/bin/httpd.sh
    Resin 1.2.s010113 -- Sat Jan 13 11:17:18 PST 2001
    http listening to *:8080
    srun listening to localhost:6802
    
    Starting on Win32
    c:\win32> resin1.2\bin\httpd
    Resin 1.2.s010113 -- Sat Jan 13 11:17:18 PST 2001
    http listening to *:8080
    srun listening to localhost:6802
    

    Resin will print every port its listening to. In the above example, Resin is listening to port 8080 using HTTP and 6802 using its servlet runner protocol. (The servlet runner protocol only matters if you're using Resin with another web server, like Apache.)

    The following snippet shows the <http> and <srun> configuration for the above example.

    <caucho.com>
      <http-server>
        <http port='8080'/>
        <srun host='localhost' port='6802'/>
    
        ...
      </http-server>
    </caucho.com>
    
    The default port is 8080, so use http://localhost:8080 in your browser.

    Go to the demos and make sure they work.

    Now, add a file resin1.2/doc/test.jsp containing the following:

    2 + 2 = <%= 2 + 2 %>
    
    You should see the page '2 + 2 = 4'.

    A better way to run the servlet engine in a production environment is to use the start and stop scripts. These run Resin as a unix daemon and add extra reliability to the server. If Resin should ever exit, it will automatically be restarted. When developing, however, running Resin in the foreground is often more convenient.

    To start the web server, use

    unix> resin1.2/bin/httpd.sh start
    

    To stop it, use

    unix> resin1.2/bin/httpd.sh stop
    
    Resin uses a perl script, resin1.2/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 or bin/wrapper.pl for your configuration.

    wrapper.pl automatically restarts Resin when it determines the Java process has died. 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.) Many configurations launch Resin from the init as another user. Here's an example:

    root# su ferg -c "/home/resin/start"
    
    The start script might look like:

    #!/bin/sh
    
    JAVA_HOME=/usr/java
    RESIN_HOME=/home/resin
    
    export JAVA_HOME
    export RESIN_HOME
    
    cd $RESIN_HOME
    
    bin/httpd.sh -verbose start
    

    On some Unixes, the ./configure; make process will build a bin/resin executable. You can use that executable to launch Resin, just like using httpd.sh:

    unix> resin1.2/bin/resin -conf conf/test.conf start
    

    The bin/resin executable will let you run Resin standalone as another user than root. To use the user-name and group-name directives, you must use bin/resin.

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

    To install the service, use

    c:\> resin1.2\bin\httpd -install
    

    To remove the service, use

    c:\> resin1.2\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, NT will automatically start the web server.

    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.

    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(NT) install Resin as a service (but doesn't automatically start.)n/a
    -install-as xxx(NT) install Resin as a named service (but doesn't automatically start.)n/a
    -remove(NT) install Resin as a service (but doesn't automatically start.)n/a
    -remove-as xxx(NT) remove Resin as a named service (but doesn't automatically start.)n/a

    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.http.HttpServer and starting Resin looks like the following, once you've properly configured the classpath:

    unix> java -Dresin.home=/usr/resin \
               com.caucho.server.http.HttpServer \
               -conf conf/resin.conf 
    


    Getting Started
    Getting Started
    Unix Apache
    Copyright © 1998-2002 Caucho Technology, Inc. All rights reserved.
    Resin® is a registered trademark, and HardCoretm and Quercustm are trademarks of Caucho Technology, Inc.