caucho
Resin
FAQ
Reference Guide
JavaDoc
Demo
Tutorial

Getting Started
Configuration
EJB
IDE
Topics
JSP
XTP/XSL

Resin Web Server
Unix Apache
Windows Apache
Unix Netscape
IIS
WebSite
Other Servlets
 Caucho Servlet Engine on O'Reilly WebSite Pro

IIS
Getting Started
Other Servlets

  1. Configuring Resin and WebSite Pro
    1. WebSite Pro
    2. Resin Virtual Server
    3. Adjusting resin.conf
    4. Testing the servlet engine
    5. Troubleshooting
  2. Command line arguments
  3. Deploying on NT

Resin provides a fast servlet runner for O'Reilly WebSite Pro, allowing it to run servlets and JSP files.

To configure Resin with O'Reilly WebSite Pro, you must follow the following steps:

  1. Configure WebSite Pro via its property sheet
  2. Configure resin.conf with a text editor
  3. Start srun. You may want to run srun as an NT service.

Configuring Resin and WebSite Pro

You should use resin1.x/bin/setup.exe to setup your configuration. If you use setup.exe, you can just skip to the next section.

WebSite Pro

If you don't use the supplied setup.exe program, here are the steps needed to setup WebSite Pro to run Resin:
  1. Make sure Resin works via it's httpd.exe!
  2. Stop WebSite Pro.
  3. Copy isapi_srun.dll to the WebSite root directory, C:\WebSite.
  4. Using the WebSite property sheet, Mapping tab, Associations list, associate .jsp, .xml and .xtp with the above extension C:\WebSite\isapi_srun.dl.
  5. Using the WebSite property sheet, Mapping tab, Content types list, set the content type for .jsp, .xml, and .xtp to wwwserver/isapi.
  6. Add isapi_srun.dll to WebSite's API pre-load list. Use the registry editor and add the full pathname of isapi_srun.dll, typically C:\WebSite\isapi_srun.dll, to the LoadLibrary string. This is located under HKEY_LOCAL_MACHINE\Software\Denny\WebServer\CurrentVersion. The variable name is LoadLibrary, and it is a semicolon-delimited string. Simply add ;C:\WebSite\isapi_srun.dll to the end of the LoadLibrary string.

Resin Virtual Server

In order to browse the supplied documents and samples, we strongly recommend creating a virtual server and mapping its root to the Resin doc directory. When creating this virtual server with WebSite's New Identity Wizard, you can uncheck both CGI options in the New Identity Wizard. Then after it's finished, change the / mapping from htdocs to doc. To set the virtual server up:

  1. On WebSite's property sheet, Identity Tab, click New... and step through the New Identity Wizard. For this example, we'll assume that you used res as the URL prefix.
  2. Create the following document mappings using the property sheet, Mapping tab, Document list. We'll assume the identity hostname is resin.foo.com and the URL prefix is res.
    1. Map /res/ to the Resin doc subdirectory
    2. Map /res/caucho-status/ to C:\WebSite\isapi_srun.dll\caucho-status\
    3. Map /res/servlet/ to C:\WebSite\isapi_srun.dll\servlet\
    4. Map /res/snoop/ to C:\WebSite\isapi_srun.dll\snoop\
Make sure WebSite Pro is running, then:
  1. Browse http://resin.foo.com/servlet/Hello and /foo.jsp. You should see a "cannot connect" error.
  2. Start srun.exe
  3. Browse http://resin.foo.com//servlet/Hello and /foo.jsp. You should now see the servlet.

Adjusting resin.conf

resin.conf should mirror the configuration of WebSite Pro. In other words, you need to configure the document root and any directory aliases.

For many users, you only need to change the app-dir attribute from 'doc' to something like 'c:\website\htdocs'. For more complicated configurations, you'll need to add path-mapping attributes.

resin.conf
<caucho.com>
  <http-server
      app-dir='c:\website\htdocs'>
    <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 'C:\WebSite\htdocs\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.
  2. Check http://localhost/caucho-status. That will tell if the ISAPI extension is properly installed.
  3. Each srun host should be green and the mappings should match your resin.conf.
  4. If caucho-status fails entirely, the problem is in the isapi_srun installation.
  5. Check that isapi_srun.dll is in C:\WebSite.
  6. If caucho-status shows the wrong mappings, there's something wrong with the resin.conf.
  7. If caucho-status shows a red servlet runner, then srun.exe hasn't properly started.
  8. If you get a "cannot connect to servlet engine", caucho-status will show red, and srun.exe hasn't started properly.
  9. If srun.exe doesn't start properly, you should look at the logs in resin1.x/log. You should start srun.exe -verbose to get more information.
  10. If you get Resin's file not found, the WebSite 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 WebSite Pro, 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.x/bin/srun -install

To remove the service, use

dos> resin1.x/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.


IIS
Getting Started
Other Servlets
Copyright © 1998-2001 Caucho Technology. All rights reserved.
Copyright © 1998-2001 Caucho Technology, Inc. All rights reserved.
Resin® is a registered trademark, and HardCoretm and Quercustm are trademarks of Caucho Technology, Inc.