caucho
Resin 1.1
FAQ
Reference
JavaDoc
Demo
Java Tutorial

Getting Started
Configuration
Servlet
JSP
XTP/XSL
JavaScript
JS Library

Resin Web Server
Unix Apache
Windows Apache
Unix Netscape
IIS
Other Servlets
 Caucho Servlet Engine on Apache Unix

  1. Installation
    1. Apache binaries for OS/2
    2. mod_caucho module for OS/2
    3. Configuring Apache by hand
    4. Configure the Environment
    5. Configuring resin.conf
    6. Starting the Servlet Engine
    7. Testing the servlet engine
    8. Troubleshooting
  2. Load Balancing
  3. Error Page
Resin provides a fast servlet runner for Apache, allowing Apache to run servlets and JSP files. The servlet runner needs Apache 1.3.x and DSO support.

Installation

To configure Resin with Apache, you must follow the following steps:

  1. Getting Apache binaries
  2. Getting mod_caucho binaries
  3. Configure Apache
  4. Set up environment
  5. Configure resin.conf
  6. Restart Apache and start srun

Getting Apache binaries

You need a OS/2 version of Apache with DSO support enabled. You can get it from http://apache.org/~bjh/apache2/.

Getting mod_caucho binaries

mod_caucho for OS/2 included in this distribution. You can get caucho.dll from srun/os2-1.3.12/ directory.

Configuring Apache by hand

You must change httpd.conf file. Here are the changes:

httpd.conf
LoadModule caucho_module libexec/caucho.dll

<IfModule mod_caucho.c>
  CauchoConfigFile <installdir>/resin1.1/conf/resin.conf
  <Location /caucho-status>
    SetHandler caucho-status
  </Location>
</IfModule>

Note: The caucho-status is optional and probably should be avoided in a production site. It lets you ask the Caucho Apache module about the Caucho status, valuable for debugging.

Restart Apache. Now browse http://localhost/caucho-status. It should return a table indicating that the servlet runner is stopped.

Browse http://localhost/test.jsp. It should return a message like:

Cannot connect to Servlet Runner.

caucho-status Handler to display /caucho-status
caucho-request Handler to connect to srun

Configure the Environment

If you don't already have Java installed, you'll need to download a JDK and set some environment variables. OS/2 JDKs are available at and at IBM.

Configuring resin.conf

By default, Resin will look in resin1.1/doc for JSP files and resin1.1/doc/WEB-INF/classes for servlets and beans. To tell Resin to use Apache's document area, you configure the app-dir. Change app-dir from 'doc' to something like '/apache/htdocs'.
resin.conf
<caucho.com>
  <http-server
      app-dir='/apache/htdocs'>
    <servlet-mapping url-pattern='/servlets/*'
              servlet-name='invoker'/>

    <servlet-mapping url-pattern='*.xtp'
                        servlet-name='com.caucho.jsp.XtpServlet'/>
    <servlet-mapping url-pattern='*.jsp'
                        servlet-name='com.caucho.jsp.JspServlet'/>
  </http-server>
</caucho.com>

Starting the Servlet Engine

Now you need to start the servlet engine.

> resin1.1/bin/srun.cmd

Testing the servlet engine

Create a test file '/apache/htdocs/test.jsp'

<%@ page language=javascript %>
2 + 2 = <%= 2 + 2 %>

Browse http://localhost/test.jsp again. You should now get

2 + 2 = 4

Troubleshooting

  1. First, check your configuration with the standalone httpd.sh. Both httpd.sh and srun.sh use the same configuration file, so the results should be identical.
  2. Check http://localhost:8080/caucho-status. That will tell if mod_caucho has properly read the resin.conf.
  3. If caucho-status fails entirely, the problem is in the mod_caucho installation and the Apache httpd.conf.
  4. If caucho-status shows the wrong mappings, there's something wrong with the resin.conf or the pointer to resin.conf in httpd.conf.
  5. If caucho-status shows a red servlet runner, then srun.cmd hasn't properly started.
  6. If you get a "cannot connect to servlet engine", caucho-status will show red, and srun.cmd hasn't started properly.
  7. If srun.cmd doesn't start properly, you should look at the logs in resin1.1/log. You should start srun.cmd -verbose to get more information.
  8. If you get Resin's file not found, the Apache configuration is good but the resin.conf probably points to the wrong directories.

Load Balancing Resin 1.1

In Resin 1.1, you can distribute requests to multiple machines. All requests in a session will go to the same host. In addition, if one host goes down, Resin will send the request to the next available machine.

In addition, you can specify backup machines. The backup only will serve requests if all primaries are down.

See the http config section for more details.

resin.conf
<caucho.com>
<http-server>
  <srun host='host1' port='6802'/>
  <srun host='host2' port='6802'/>
  <srun-backup host='backup port='6802'/>
  ...
</http-server>
</caucho.com>

Error Page Resin 1.1

When mod_caucho can't reach any JVM, it will send a default error page. Sites can customize the error page with the CauchoErrorPage directive.

httpd.conf
CauchoErrorPage /apache/htdocs/resin_error_page.html

Resin Web Server   Windows Apache
OS/2 port by Eugen Kuleshov.
Copyright © 1998-2000 Caucho Technology. All rights reserved.
Last modified: Fri, 03 Mar 2000 18:23:40 -0800 (PST)