Tuesday, July 16, 2013

ISAPI Tomcat redirector on IIS 8 of Windows Server 2012

A client wants to migrate a J2EE app running on Tomcat and IIS 6 of Windows 2003 to IIS 8 of Windows Server 2012.

This is the first time I have a chance to work with Windows Server 2012!

After login via RDP I noticed the GUI looks like Windows 8 as I had a little bit experience to play with it when buying and setup an Asus touchscreen laptop for my brother.

I don't have any problems to copy files between the old server to this server and setup Java, Tomcat, MySQL, PostgreSQL, PostGIS... Except when start the Tomcat 5.5, it throws errors because the Java is 64 bit, so download Java 32 bit and reinstall it.

And to start Tomcat, we need to copy %JAVA_HOME%\bin\msvcr71.dll to Tomcat\bin folder.

Another issue is setup the Tomcat to trust SSL certificate from a https website that the J2EE app has request connection to it. Just copy the old jssecacerts file to "%JAVA_HOME%\lib\security\

But I want to test it by the command line first, just hit the shortcut Windows PowerShell on the launch bar, it open the console window looks like the MS-Dos window, except blue background, then execute command:
java -Djavax.net.ssl.trustStore="%JAVA_HOME%\lib\security\jssecacerts" myTest

And got the error:

Exception in thread "main" java.lang.NoClassDefFoundError:/net/ssl/trustStore=%JAVA_HOME%\lib\security\jssecacerts
Caused by: java.lang.ClassNotFoundException: .net.ssl.trustStore=%JAVA_HOME%\lib\security\jssecacerts
....

Don't know why, check/test everything is fine, the command run well on the old server. Try to add class path for the net/ssl.... Didn't work! Crazy about this.

Finally I thought the Windows PowerShell is different MS-Dos, so try to find a way to exec cmd. Don't know where the MS-Dos shortcut is, have to google again. Then Search > Run, cmd, enter the above command, it worked!
(MS hide everything. Please switch back to old UI, this is server, not tablet!, I hate it so much when access via RDP and it's hard to open Start menu, drag/drop shortcuts to desktop, show all apps links..., finally when I wan't to logout, I can't find the menu -> have to google again!!!)

Then Tomcat & J2EE app works fine.

Then I start to install ISAPI Tomcat redirector on IIS. My old instruction for Windows 2003 is there, but the IIS 8 administration GUI is totally different.

The first thing to do is define the Tomcat ISAPI Filter. Wow, there's no ISAPI Filters menu for the website! Googling around and know that we need to install ISAPI extensions and ISAPI Filters first in the Add Roles and Features of Server Roles as below screenshot

Then back to the IIS Admin and select the server, we'll see the ISAPI and CGI Restrictions

Then open it and Add... with isapi_redirect.dll path, make sure it's 64 bit version!



Then select the website and configure ISAPI Filters for it



 Then create virtual directory named jakarta with physical path is the folder contains isapi_redirect.dll


Then allow Execute permission on it


Create jsp-examples virtual path points to any folder, like IIShome

Don't need to change the uriworkermap.properties and workers.properties.

That's it. Hope help someone to work with this issue.




2 comments:

  1. I sometimes use the ISAPI connector but most often I use the BonCode connector for IIS. It is simpler to install and is non request blocking. For example, any static content is still evaluated by the ISAPI one and if Tomcat fails your sites stops responding. I would definitely evaluate both before making the jump. BonCode can be downloaded from http://tomcatiis.riaforge.org

    ReplyDelete
  2. Thanks for letting me. I'll try it when have a chance.

    ReplyDelete