Jeff's Personal Weblog

Friday, January 02, 2009

Setting up 64-bit Tomcat 6 on IIS7

Download the latest Tomcat binaries for Win64 (AMD64 or x64)
  1. Download Tomcat binaries (Windows Service Installer) from http://tomcat.apache.org/download-60.cgi

    NOTE: It appears the latest Tomcat Service Installer now supports 64 bit so the below files may no longer be needed
  2. Download 64 bit Tomcat Native binaries from http://tomcat.apache.org/download-native.cgi
  3. Download 64 bit versions of tomcat6.exe and tomcat6w.exe from http://svn.apache.org/viewvc/tomcat/tc6.0.x/tags/TOMCAT_6_0_20/res/procrun/
    (replace the 6_0_20 to reflect the version you downloaded in step 1
  4. Download 64 bit Isapi_Redirector.dll from http://tomcat.apache.org/download-connectors.cgi
Install Tomcat

NOTE: It appears the Tomcat Service Installer now supports a 64 bit installation. A typical Tomcat install should work (I haven't tried it), in which case you can skip to the Configure Tomcat section below.
  1. Run normal 32 bit Tomcat install but install as if it were a 64 bit install. Install to "Program Files" and not "Program Files (x86)". Alternately, you can install to a different location completely (ex: "C:\Tomcat"). Make sure to point Tomcat to a 64 bit JRE.
  2. If you chose to install "Tomcat Native" in the above step, replace tomcat native dll's (found in tomcat's bin directory) with 64 bit versions
  3. Replace tomcat6.exe and tomcat6w.exe (found in tomcat's bin directory) with 64 bit versions
  4. If copied from another computer, unblock the exe's (Properties -> Unblock)
  5. Allow tomcat6w.exe to run as Administrator
Configure Tomcat
  1. Set up server.xml
  2. Set up context.xml
  3. Set up isapi_redirect.properties, workers.properties, and uriworkermap.properties (see http://tomcat.apache.org/connectors-doc/reference/iis.html)
Configure IIS 7
  1. Open IIS 7 Manager
  2. Navigate to your host.
  3. Double click on the ISAPI and CGI Restrictions icon
  4. On the right hand panel, click Add...
  5. Point the path to your isapi_redirect.dll file and give it a description eg. tomcat
  6. Check "Allow extension path to execute"
  7. Now, click on the Default Website and navigate to ISAPI Filters.
  8. On the right hand panel, click on Add... and point to your isapi_redirect.dll file, give the filter a name (eg. tomcat)
  9. Navigate to your Default Website again
  10. Add a virtual directory and name it jakarta, point this to the directory containing isapi_redirect.dll
  11. Click on the newly created virtual directory jakarta
  12. Navigate into Handler Mappings, on the right hand side you will see a panel called Actions. Click on Edit Feature Permissions and tick the execute permission.
  13. Finally, navigate to your host context again and do a restart.

Labels:

21 Comments:

  • Many thanks.
    This really helped get me moving.

    By Anonymous Anonymous, at 2:06 PM  

  • Jeff,

    It's very useful documentation. One problem is when I try to access examples URL. I am getting lot of junk in the browser. Most of the information was displayed in ASCII character and at some point it was shown message as No URL mapping was defined.

    Could you please advise?

    By Anonymous Anonymous, at 10:45 AM  

  • Without knowing too much about the error or your setup, I'm guessing a likely cause could be a mistake in your workers.properties or uriworkermap.properties file. Take a look at the documentation here: http://tomcat.apache.org/connectors-doc/reference/iis.html

    By Blogger Jeff, at 1:39 PM  

  • Jeff,

    Here is my isapi.log file

    [Tue Apr 28 11:24:04.612 2009] [2104:2980] [debug] find_match::jk_uri_worker_map.c (863): Found a wildchar match '/examples/*=ajp13'
    [Tue Apr 28 11:24:04.612 2009] [2104:2980] [debug] HttpFilterProc::jk_isapi_plugin.c (1922): check if [/examples/jsp/index.html] points to the web-inf directory
    [Tue Apr 28 11:24:04.612 2009] [2104:2980] [debug] HttpFilterProc::jk_isapi_plugin.c (1938): [/examples/jsp/index.html] is a servlet url - should redirect to ajp13
    [Tue Apr 28 11:24:04.612 2009] [2104:2980] [debug] HttpFilterProc::jk_isapi_plugin.c (1978): fowarding escaped URI [/examples/jsp/index.html]

    By Anonymous Anonymous, at 5:44 AM  

  • You're workers.properties file seems odd to me (although I am not an expert on the JK connector). It appears you are referencing workers in your uriworkermap file that are not declared in the worker.list line in your workers.properties file.

    I would start with a minimal workers.properties file:

    # Define 1 real worker using ajp13
    worker.list=ajp13
    # Set properties for worker1 (ajp13)
    worker.ajp13.type=ajp13
    worker.ajp13.host=localhost
    worker.ajp13.port=8009

    and uriworkermap.properties:

    /examples/*=ajp13

    Assuming that works, you can then add in any load balancing or other options you need. For help with the JK options, your best bet is to read through the links below, then ask additional questions to the Tomcat Users Discussion list.

    http://tomcat.apache.org/connectors-doc/miscellaneous/faq.htmlhttp://tomcat.apache.org/connectors-doc/generic_howto/workers.htmlhttp://tomcat.apache.org/connectors-doc/reference/workers.htmlhttp://tomcat.apache.org/connectors-doc/webserver_howto/iis.html

    By Blogger Jeff, at 10:02 AM  

  • By Blogger Jeff, at 10:11 AM  

  • Jeff,

    I have posted some information on IIS website regarding the issues which I was asking earlier.

    http://forums.iis.net/t/1157271.aspx

    regards

    By Anonymous Anonymous, at 5:21 AM  

  • This comment has been removed by the author.

    By Blogger Unknown, at 6:31 AM  

  • I couldn't get the isapi_redirect.dll to work after switching the IIS server to 32 bit compatible mode (needed to run 32 bit COM objects in ASP).
    I tried all three flavors of the DLL but it just doesn't want to listen.
    Finally I decided to go a completely other way and not use ISAPI at all.
    I now use MS 'Application Request Routing' for the redirection of traffic.
    Follow the installation instructions on;
    http://learn.iis.net/page.aspx/482/install-application-request-routing/
    (make sure to check the log file that the install was succesfull)

    Open the ARR icon on the server, enable the proxy and add a ‘url rewrite’ rule
    The rule must use wildcards and to enable a tomcat application called 'examples' the pattern will be examples*
    The rewrite URL is http://localhost:8080/examples{R:1}

    Meindert

    By Blogger Unknown, at 2:12 AM  

  • Thank you. You saved my day :)

    By Anonymous Anonymous, at 7:57 PM  

  • Read many pages and struggled many hours in vain. Finally succeeded because of your page and the page at http://blog.datajelly.com/company/blog/35-running-tomcat-as-a-64-bit-windows-service.html. the latter has the correct url to download exe's

    By Anonymous Anonymous, at 1:11 AM  

  • Thanks for the comments. I've updated the link to the latest version of Tomcat 6 (as of 12/4/2009).

    By Blogger Jeff, at 9:51 AM  

  • Can anyone recommend the top performing Remote Management system for a small IT service company like mine? Does anyone use Kaseya.com or GFI.com? How do they compare to these guys I found recently: N-able N-central network management
    ? What is your best take in cost vs performance among those three? I need a good advice please... Thanks in advance!

    By Anonymous Anonymous, at 10:34 AM  

  • Great post!

    By Anonymous Anonymous, at 2:13 PM  

  • It is really nice post, and helped me to make this happen, Thanks Jeff.

    Koteswara Rao

    By Anonymous Anonymous, at 12:46 PM  

  • Hi,

    i have followed your instructions on an MS SBS 2008 (64bit) and my Vista notebook (32bit).
    I always end up with an error 500 saying:

    HTTP-Fehler 500.0 - Internal Server Error
    Beschreibung: Die Seite kann aufgrund eines internen Serverfehlers nicht angezeigt werden.
    Fehlercode: 0x80070001
    Benachrichtigung: AuthorizeRequest
    Modul: IsapiFilterModule
    Angeforderte URL: http://localhost:80/
    Physikalischer Pfad: C:\inetpub\wwwroot
    Angemeldeter Benutzer: Anonym
    Anmeldemethode: Anonym
    Handler: StaticFile

    I think the dll has been picked up successfully, because a log file for the redirector has been created.
    However, the properties file approach did not work for me, so I have set the registry settings explicitly.
    I also gave permissions to the folders containing the dll to IUSR, NETZWERKDIENST, NETZWERT to avoid any access conflicts.

    I also checked that I have no authentication setup anywhere.
    And my uriworkermap.properties is the most simple one:
    /*=worker1

    This error message is due to a problem in IIS or in tomcat already?
    The tomcat logs say nothing, the windows event viewer says nothing and the redirect log also looks OK?!

    [Fri Sep 17 19:45:54.865 2010] [5896:4660] [debug] jk_util.c (458): Pre-processed log time stamp format is '[%a %b %d %H:%M:%S.000 %Y] '
    [Fri Sep 17 19:45:54.866 2010] [5896:4660] [info] jk_isapi_plugin.c (2405): Starting Jakarta/ISAPI/isapi_redirector/1.2.28
    [Fri Sep 17 19:45:54.866 2010] [5896:4660] [debug] jk_isapi_plugin.c (2423): Detected IIS version 7.0
    [Fri Sep 17 19:45:54.866 2010] [5896:4660] [debug] jk_isapi_plugin.c (2428): Using registry.
    [Fri Sep 17 19:45:54.866 2010] [5896:4660] [debug] jk_isapi_plugin.c (2431): Using log file c:\isapi\logs\redirect.log.
    [Fri Sep 17 19:45:54.866 2010] [5896:4660] [debug] jk_isapi_plugin.c (2432): Using log level 1.
    [Fri Sep 17 19:45:54.866 2010] [5896:4660] [debug] jk_isapi_plugin.c (2433): Using extension uri /jakarta/isapi_redirect.dll.
    [Fri Sep 17 19:45:54.866 2010] [5896:4660] [debug] jk_isapi_plugin.c (2434): Using worker file c:\isapi\conf\workers.properties.
    [Fri Sep 17 19:45:54.866 2010] [5896:4660] [debug] jk_isapi_plugin.c (2435): Using worker mount file c:\isapi\conf\uriworkermap.properties.
    [Fri Sep 17 19:45:54.866 2010] [5896:4660] [debug] jk_isapi_plugin.c (2437): Using rewrite rule file .
    [Fri Sep 17 19:45:54.866 2010] [5896:4660] [debug] jk_isapi_plugin.c (2439): Using uri select 3.
    [Fri Sep 17 19:45:54.866 2010] [5896:4660] [debug] jk_isapi_plugin.c (2440): Using no chunked encoding.
    [Fri Sep 17 19:45:54.866 2010] [5896:4660] [debug] jk_isapi_plugin.c (2442): Using notification event SF_NOTIFY_AUTH_COMPLETE (0x04000000)
    [Fri Sep 17 19:45:54.866 2010] [5896:4660] [debug] jk_isapi_plugin.c (2452): Using uri header TOMCATURI6A6B0000:.
    [Fri Sep 17 19:45:54.866 2010] [5896:4660] [debug] jk_isapi_plugin.c (2453): Using query header TOMCATQUERY6A6B0000:.
    [Fri Sep 17 19:45:54.866 2010] [5896:4660] [debug] jk_isapi_plugin.c (2454): Using worker header TOMCATWORKER6A6B0000:.
    [Fri Sep 17 19:45:54.866 2010] [5896:4660] [debug] jk_isapi_plugin.c (2455): Using worker index TOMCATWORKERIDX6A6B0000:.
    [Fri Sep 17 19:45:54.866 2010] [5896:4660] [debug] jk_isapi_plugin.c (2456): Using translate header TOMCATTRANSLATE6A6B0000:.
    [Fri Sep 17 19:45:54.866 2010] [5896:4660] [debug] jk_isapi_plugin.c (2457): Using a default of 250 connections per pool.

    I am really stuck for a couple of days now!
    Any help appreciated.

    Stefan

    By Anonymous Anonymous, at 12:56 PM  

  • I haven't dealt with the Tomcat/IIS stuff in quite a while so I'm a little rusty, but I think if you are seeing startup logs from your isapi redirect, then it is linked properly. My guess is there is a problem with your workers.properties or uriworkermap.properties files. Sorry I can't be of more help.

    By Blogger Jeff, at 9:42 AM  

  • I have used the boncode connector to conenct tomcat 6 and IIS on 64-bit windows.
    Seemed simpler.
    http://tomcatiis.riaforge.org
    Download site also links to youtube videos etc.

    By Anonymous Anonymous, at 9:30 AM  

  • This posting is great!

    But I still do not understand, what is the configuration required at IIS7 such that it can forward the requests to tomcat host:port.

    In other words, how does the IIS7 know which tomcat server it need to forward to? In this blog, I do not notice any configuration going for this setup. Or am I missing something?

    By Blogger sjee, at 9:49 PM  

  • Fantastic. Thanks so much for the steps. One addition,I had problems using a DLL that had a name 'isapi_redirect-1.2.26-amd64.dll' instead of 'isapi_redirect.dll'. That was causing an issue and renaming it to isapi_redirect.dll worked.

    By Anonymous Anonymous, at 3:11 PM  

  • Nice job, regards

    By Anonymous Anonymous, at 11:54 PM  



<< Home