resin with iis
For sites requiring the use of IIS, Resin provides a fast servlet runner, allowing IIS to run servlets and JSP files.
If you have not yet done so, we suggest you consider the Resin web server option first, either as a standalone web server or as a web-tier server load-balancing to Resin app-tier servers. Resin's Java web server provides management, clustering, and load-balancing with failover.
Resin requires a 1.5 JDK. You can download one from Sun and install it.
The Control Panel is used to configure two environment variables:
To configure Resin with IIS, you must follow the following steps:
You should run
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.
ResinConfigServer localhost 6802 CauchoStatus yes IISPriority high
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, the only need to change needed in Resin is to change the <document-directory> attribute from 'webapps/ROOT' to something like 'C:/inetpub/wwwroot'. The mapping of url paths from the browser to real files on the disk must be the same for Resin as they are for IIS. For more complicated configurations that use mappings in IIS, you'll need to add path-mapping attributes to match.
<!-- configures the default host, matching any host name --> <host id=''> <!-- configures the root web-app --> <web-app id='/'> <document-directory>C:/inetpub/wwwroot</document-directory> <!-- adds xsl to the search path --> <class-loader> <simple-loader path="$host-root/xsl"/> </class-loader> </web-app> </host>
Testing the servlet engine
C:\> cd %RESIN_HOME% C:\resin-3.0> cd bin C:\resin-3.0> httpd.exe
Now browse http://localhost/test.jsp. You should get a 'file not found' message.
Create a test file 'd:\inetpub\wwwroot\test.jsp'
2 + 2 = <%= 2 + 2 %>
Browse http://localhost/test.jsp again. You should now get
2 + 2 = 4
The following configuration line arguments are recognized by httpd.exe.
When command line arguments are used along with
Memory configuration is part of the JVM's arguments. For most JVMs, you can find the full list by starting "java -X".
See Performance : JVM Tuning : Memory for more information on JVM memory usage.
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 also automatically restart Resin if it unexpectedly exits.
To install the service, use
win> resin-3.0.x/httpd -install
To remove the service, use
win> resin-3.0.x/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.
NoteThere is a bug in many JDKs which cause the JDK to exit when the administrator logs out. JDK 1.4 and later can avoid that bug if the JDK is started with -Xrs.
win> resin-3.0.x/httpd -install -Xrs
With Resin, you can distribute requests to multiple machines. All requests with the same 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 Resin config section for more details.
<resin xmlns="http://caucho.com/ns/resin"> <server> <cluster> <srun id="a" host="host1" port="6802" index="1"/> <srun id="b" host="host2" port="6802" index="2"/> <srun id="c" host="backup" port="6802" index="3" backup="true"/> ... </server> </resin>
win> resin-3.0.x/httpd -install-as "Resin-A" -server a -Xrs win> resin-3.0.x/httpd -install-as "Resin-B" -server b -Xrs win> resin-3.0.x/httpd -install-as "Resin-C" -server c -Xrs
Experts may want to configure Resin/IIS by hand instead of using the setup program. The steps involved are:
Copying isapi_srun.dll todirectory 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 into 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:
ResinConfigServer localhost 6802
You can change the host fromto a backend server. You can also add multiple items to cluster the configuration.
For debugging, you can add a "CauchoStatus yes" line to the resin.ini:
ResinConfigServer localhost 6802 CauchoStatus yes
For security purposes, the default value of CauchoStatus is "no" when you have a resin.ini.
Adding an ISAPI filter is accomplished in the IIS manager.
IIS and Resin on different machines
When Resin and IIS are on different machines, you'll change the ResinConfigServer from "localhost" to the IP address of the Resin server.
ResinConfigServer 192.168.0.10 6802 CauchoStatus yes
If IIS is managing multiple virtual sites (everyone else calls them virtual hosts), then you need to configure IIS to use the isapi_srun.dll filter for each virtual site. Configure IIS to have the virtual directoryfor each virtual site point to , so that each virtual site uses the isapiu_srun.dll.
Resin is configured to recognize virtual hosts with theattribute of <host>.
<resin xmlns="http://caucho.com/ns/resin"> ... <server> ... <host id="foo.com"> ... </host> <host id="bar.com"> ... </host> <host id="baz.com"> ... </host> </server> </resin>
Resin recognizes which host to use by examing the url. With the above
example, a url of
If a seperate JVM for each virtual site is desired, a seperate
<resin xmlns="http://caucho.com/ns/resin"> <server> <cluster> <srun port="6802"/> </cluster> ... <host id="*"> ... </host> </server> </resin>
<resin xmlns="http://caucho.com/ns/resin"> <server> <cluster> <srun port="6803"/> </cluster> ... <host id="*"> ... </host> </server> </resin>
win> resin-3.0.x/httpd -install-as "Resin-foo" \ -conf resin-foo.conf -Xrs win> resin-3.0.x/httpd -install-as "Resin-bar" \ -conf resin-bar.conf -Xrs
ResinConfigServer localhost 6802
ResinConfigServer localhost 6803
The ResinConfigServer tells the isapi_srun.dll the port number to use to connect to the Resin instance. You can change the host fromto a backend server. You can also add multiple items to cluster the configuration.
resin-foo.conf and resin-bar.conf contain a <host id="*">, you do not need to specify the host name because each conf/JVM is only going to receive requests from a particular virtual site (because of the unique resin.ini files).
Troubleshooting IIS 6
IIS 6/Windows 2003 users may need to perform additional steps.