Configuring IIS/PWS ISAPI Filter You should use resin-2.1.0/bin/setup.exe to setup your configuration. If you use setup.exe, you can just skip to the next section.
ISAPI Filter Priority isapi_srun.dll installs itself as the default priority. Some users may need to set the priority to a higher level, e.g. to override IIS's DAV support.
<caUCho.com> <iis priority='high'/>
<http-server> ... </http-server>
<caucho.com>
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.
For many users, you only need to change the app-dir attribute from 'doc' to something like 'd:/inetpub/wwwroot'. For more complicated configurations, you'll need to add path-mapping attributes.
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.
Command line arguments The following configuration line arguments are recognized by httpd.exe. When installed as a service, these argument will be used when the service starts.
Argument Meaning -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. -X<arg> Set a Java -X command line argument, e.g. -Xms128m. -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.
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
Argument Meaning -Xms<size> Initial Java heap size, e.g. -Xms32m -Xmx<size> Maximum Java heap size, e.g. -Xmx128m
Deploying as an NT Service
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> resin-2.1.0/bin/httpd -install
To remove the service, use
dos> resin-2.1.0/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 servlet runner.
Note: There is a bug in many JDKs which cause the JDK to exit when the administrator logs out. JDK 1.3 and later can avoid that bug if the JDK is started with -Xrs.
dos> resin-2.1.0/bin/httpd -install -Xrs
Load Balancing
Configuring IIS/PWS ISAPI Filter ISAPI Filter Priority Configuring resin.conf Testing the servlet engine Command line arguments Memory Configuration Deploying as an NT Service Load Balancing Manual Configuration Troubleshooting
Resin provides a fast servlet runner for IIS 4.0 and PWS, allowing IIS to run servlets and JSP files.
To configure Resin with IIS, you must follow the following steps:
ISAPI Filter You should use resin-2.1.0/bin/setup.exe to setup your configuration. If you use setup.exe, you can just skip to the next section.
ISAPI Filter Priority isapi_srun.dll installs itself as the default priority. Some users may need to set the priority to a higher level, e.g. to override IIS's DAV support.
<caucho.com> <iis priority='high'/>
<http-server> ... </http-server>
<caucho.com>
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.
For many users, you only need to change the app-dir attribute from 'doc' to something like 'd:/inetpub/wwwroot'. For more complicated configurations, you'll need to add path-mapping attributes.
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.
Command line arguments
The following configuration line arguments are recognized by httpd.exe. When installed as a service, these argument will be used when the service starts.
Argument Meaning -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. -X<arg> Set a Java -X command line argument, e.g. -Xms128m. -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.
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 Argument Meaning -Xms<size> Initial Java heap size, e.g. -Xms32m -Xmx<size> Maximum Java heap size, e.g. -Xmx128m
Deploying as an NT Service
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> resin-2.1.0/bin/httpd -install
To remove the service, use
dos> resin-2.1.0/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 servlet runner.
Note: There is a bug in many JDKs which cause the JDK to exit when the administrator logs out. JDK 1.3 and later can avoid that bug if the JDK is started with -Xrs.
dos> resin-2.1.0/bin/httpd -install -Xrs
Load Balancing Resin 1.2
In Resin 1.2, 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.
Manual Configuration Experts may want to configure Resin/IIS by hand instead of using the setup program. If you need to know the steps involved:
Make sure httpd.exe works If you have a virtual site, you must have the virtual directory /scripts point to d:/inetpub/scripts Copy isapi_srun.dll to the IIS scripts directory, d:/inetpub/scripts. You may need to run net stop w3svc. (optional) Create a resin.ini in d:/inetpub/scripts pointing to the resin.conf. Configure IIS to load isapi_srun.dll as an ISAPI filter. Restart IIS (control panel/services) or net stop w3svc followed by net start w3svc. Browse /servlet/Hello and /foo.jsp. You should see a "cannot connect" error. Start httpd.exe Browse /servlet/Hello and /foo.jsp. You should now see the servlet. Copying isapi_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 isapi_srun.dll.
The resin.ini is an optional file in inetpub/scripts to override the automatic registry $RESIN_HOME/conf/resin.conf configuration file. If you only have one Resin server, you should not create a resin.ini and let isapi_srun.dll use the registry value set by the setup.exe program.
resin.ini is only needed if you have multiple Resin configuration files for different IIS virtual hosts.
The resin.ini should contain the following line:
CauchoConfigFile d:/resin2.0/conf/resin.conf
Adding an ISAPI filter is accomplished in the IIS manager.
Troubleshooting
Check your configuration with the standalone bin/httpd. In other words, add a <http port='8080'/> block and browse http://localhost:8080. Check http://localhost/caucho-status. That will tell if the ISAPI filter/extension is properly installed. Each srun host should be green and the mappings should match your resin.conf. If caucho-status fails entirely, the problem is in the isapi_srun installation. Try http://localhost/scripts/isapi_srun.dll/caucho-status directly (bypassing the filter). If this fails, IIS can't find isapi_srun.dll. Check that isapi_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. If you've created a new IIS web site, you need to create a virtual directory /scripts pointing to the d:/inetpub/scripts directory. If caucho-status shows the wrong mappings, there's something wrong with the resin.conf. If caucho-status shows a red servlet runner, then httpd.exe hasn't properly started. If you get a "cannot connect to servlet engine", caucho-status will show red, and httpd.exe hasn't started properly. If httpd.exe doesn't start properly, you should look at the logs in resin2.0/log. You should start httpd.exe -verbose to get more information. If you get Resin's file not found, the IIS configuration is good but the resin.conf probably points to the wrong directories.