Java platform is extremely successful in building robust and high performance web applications. Platform independence is one of the strength of Java engine and Helicon Zoo now provides a convenient way to deploy and run Java web applications on Windows platform with Microsoft IIS. To deploy Java Servlet application on IIS 7 you will only need to follow this simple instruction:
- Download and install Web Platform Installer.
- Run Web Platform Installer and click “Options”.
- Add Helicon Zoo feed into Display additional scenarios box: http://www.helicontech.com/zoo/feed. New “Zoo” tab will appear.
- Go to the Zoo, Packages and install Java Hosting Package.
- Accept licenses to start installation process.
Alternatively, instead of installing Java Hosting Package you can install Modules –> Helicon Zoo Module and Engines –> Jetty separately. This is minimal requirement to run Java Servlet applications under Microsoft IIS web server. If you want to run Java Servlets under IIS Express and WebMatrix in your development environment, then you will also need to install Helicon Zoo Module for IIS Express form Engines section.
This is enough configuration to run most of Java Servlet applications directly form IIS.
Launch IIS Manager and create new web-site or an application within a web-site. Copy your Java application into the root folder of this IIS application. Java application could be either a single .war file or set of unpacked files with directory structure, including web-inf folder. Then just create the following web.config:[sourcecode language=”xml”] <?xml version="1.0" encoding="UTF-8"?>
<application name="jetty.project" >
<!– Uncomment line below if you want to set contexts directory –>
<!– <add name="CONTEXTS_DIR" value="%APPL_VIRTUAL_PATH%" /> –>
<!– Optional variables: –>
<!– <add name="CONTEXT_PATH" value="%APPL_VIRTUAL_PATH%" /> –>
<!– <add name="WAR_EXTRACT_PATH" value="%APPL_PHYSICAL_PATH%" /> –>
<!– A WAR file or start directory to run –>
<add name="WAR_FILE" value="my_application.war" />
<add name="jetty.project#x86" scriptProcessor="java.jetty"
path="*" verb="*" modules="HeliconZoo_x86"
<add name="jetty.project#x64" scriptProcessor="java.jetty"
path="*" verb="*" modules="HeliconZoo_x64"
Please take a look at <environmentVariables> section.
- CONTEXTS_DIR — optional path to directory with .xml files which describe Jetty contexts. If this variable isn’t set, Zoo looks for “contexts” folder in the root of application. If no such folder found, Zoo presumes the application has single context and uses variables described below.
- CONTEXT_PATH — optional virtual path of the application. Default value is taken from APPL_VIRTUAL_PATH variable.
- WAR_FILE — optional path to a .war file or directory with extracted application.
- WAR_EXTRACT_PATH — optional .war file extraction path. Is set to application’s root folder by default.
Here is an example of context.xml file that you may use instead of setting WAR file name explicitly. This allows to run multiple applications and contexts in a single IIS web site.
contexts/context.xml[sourcecode language=”xml”] <?xml version="1.0"?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure.dtd">
WARNING: Since WAR files need to be extracted before execution you will need to have a folder with write permissions. In default IIS installation all application pools are executed with permissions of IIS_IUSRS group which does not have write permissions to the web application folders. You will need to provide write permissions to the user running Application Pool or IIS_IUSRS group to the folder containing Java application or specify other folder using WAR_EXTRACT_PATH variable with write permissions provided.Now you can open IIS web site in the browser and see your Java web application running.
That’s it! Installation process is clear and automatic and will only take several minutes.
5 Responses to Deploying Java Servlet applications on Windows with IIS
- Introduction To JavaEE Concepts (javacodegeeks.com)
- Mark sheet maintenance using WCF (bitsandbinaries.wordpress.com)
- Remote Access to Your Files via WebDAV (jelastic.com)
- One Jar to Rule Them All (java.dzone.com)
- Configure digest authentication for a claims-based web application in SharePoint 2013 (onpointwithsharepoint.wordpress.com)