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 IIS

  1. Configuring IIS/PWS
    1. ISAPI Filter
    2. Configuring resin.conf
    3. Testing the servlet engine
    4. Troubleshooting
  2. Command line arguments
  3. Deploying on NT
  4. Load Balancing
Resin provides a fast servlet runner for IIS 4.0 and PWS, allowing IIS to run servlets and JSP files.

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

  1. Configure IIS/PWS
  2. Configure resin.conf
  3. Start srun

Configuring IIS/PWS

ISAPI Filter


Note: The resin1.1/bin/setup program will automatically setup the Resin ISAPI filter. However, if you need to know the steps involved
  1. Make sure httpd.exe works
  2. If you have a virtual site, you must have the virtual directory /scripts point to d:\inetpub\scripts
  3. Copy iis_srun.dll to the IIS scripts directory, d:\inetpub\scripts. You may need to run net stop w3svc.
  4. Create a resin.ini in d:\inetpub\scripts pointing to the resin.conf.
  5. Configure IIS to load iis_srun.dll as an ISAPI filter.
  6. Restart IIS (control panel/services) or net stop w3svc followed by net start w3svc.
  7. Browse /servlet/Hello and /foo.jsp. You should see a "cannot connect" error.
  8. Start srun.exe
  9. Browse /servlet/Hello and /foo.jsp. You should now see the servlet.

Copying iis_srun.dll to inetpub/scripts directory is relatively straightforward. If you're upgrading to a new version of Resin, you may need to stop IIS (control panel/services) to get permission to overwrite iis_srun.dll.

The resin.ini is an optional file in inetpub/scripts to override the automatic registry $RESIN_HOME/conf/resin.conf configuration file. The resin.ini should contain the following line:

CauchoConfigFile d:/resin1.1/resin.conf

Adding an ISAPI filter is accomplished in the IIS manager.

Configuring resin.conf

resin.conf should mirror the configuration of IIS. In other words, you need to configure the document root and any directory aliases. You only need to change the app-dir attribute from 'doc' to something like 'd:\inetpub\wwwroot'.

resin.conf
<caucho.com>
  <http-server
      app-dir='d:\inetpub\wwwroot'>
    <servlet-mapping url-pattern='/servlet/*'
              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>

Testing the servlet engine

From the Resin bin folder, you need to start srun.exe to start the servlet runner.

Now browse http://localhost/test.jsp. You should get a 'file not found' message.

Create a test file 'd:\inetpub\wwwroot\test.jsp'

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

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

2 + 2 = 4

As a final test, change language to 'java' and refresh the page. Nothing should change.

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/caucho-status. That will tell if the ISAPI filter/extension is properly installed.
  3. If caucho-status fails entirely, the problem is in the iis_srun installation. Try http://localhost/scripts/iis_srun.dll/caucho-status directly (bypassing the filter). If this fails, IIS can't find iis_srun.dll.
    • Check that iis_srun.dll is in c:\inetpub\scripts.
    • Make sure that your IIS host has a mapping from /scripts to c:\inetpub\scripts and that the /scripts has execute permissions.
  4. If you've created a new IIS web site, you need to create a virtual directory /scripts pointing to the d:\inetpub\scripts directory.
  5. If caucho-status shows the wrong mappings, there's something wrong with the resin.conf.
  6. If caucho-status shows a red servlet runner, then srun.exe hasn't properly started.
  7. If you get a "cannot connect to servlet engine", caucho-status will show red, and srun.exe hasn't started properly.
  8. If srun.exe doesn't start properly, you should look at the logs in resin1.1/log. You should start srun.exe -verbose to get more information.
  9. If you get Resin's file not found, the IIS configuration is good but the resin.conf probably points to the wrong directories.

Command line arguments

The following configuration line arguments are recognized by srun.exe and httpd.exe. When installed as a service, these argument will be used when the service starts.

-verbose Write more verbose information to the log file
-resin_home <path> Sets the location of Resin
-java_home <path> Specify the JDK location
-msjava Use Microsoft's JVM
-nojit Disable JIT compilation to help debugging
-classpath <cp> Add to the classpath
-J<arg> Set a Java command line argument, e.g. -J-nojit.
-D<foo=bar> Set a Java variable, e.g. -Dresin.home=here.
-install Install as an NT service
-install-as <name> Install as an NT service with the specific name.
-remove Remove as an NT service
-remove-as <name> Remove as an NT service with the specific name.

Deploying on NT

Once you're comfortable with using Resin with IIS, you can install it as an NT service. As a service, Resin will automatically start when NT reboots. The service will automatically restart Resin if it unexpectedly exits.

To install the service, use

dos> resin1.1/bin/srun -install

To remove the service, use

dos> resin1.1/bin/srun -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 servlet runner.

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, the IIS filter 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>

Unix Netscape   Other Servlets
Copyright © 1998-2000 Caucho Technology. All rights reserved.
Last modified: Fri, 24 Mar 2000 14:19:06 -0800 (PST)