Deploying on tomcat
Either Tomcat 5.5.x and 6.x can be used. We will assume that Tomcat is installed in CATALINA_HOME and that it is running on your local machine on the standard port 8080.
There are several ways to deploy applications on Tomcat, as discussed in the sections below, but before you start you should choose the context name, i.e., the relative URL of your application. E.g., if the context name you choose is "myapp" then the application will be accessible at http://localhost:8080/myapp/
Open a browser and connect to http://localhost:8080/manager/html. Provide the login/password of Tomcat's admin user. If you don't have one, check Tomcat's documentation and make sure you have the manager role and an admin user defined in
CATALINA_HOME/conf/tomcat-users.xml as follows:
<role rolename="manager"/> <user username="admin" password="password" roles="manager"/>
Please notice that the default content of
CATALINA_HOME/conf/tomcat-users.xmlis slightly different between Tomcat 6.x and Tomcat 5.5.x. Tomcat 5.5.x has the manager role predefined but has no user impersonating it. Tomcat 6.x has no role or user definitions at all. Regardless of the version you use, make sure the manager role and the admin user are defined as described above.
Scroll down the page to the section called "Deploy directory or WAR file located on server". Enter the context name preceded by "/" (e.g., /myapp) in the "Context Path" field.
Leave the "XML Configuration file URL" filed blank.
Locate Portofino's WAR file and enter its absolute name (e.g., /absolute/path/portofino-war-3.1.war) in the "WAR or Directory URL" field.
The section should look like this:
Click the "Deploy" button. The page will reload. At the top of the page, check that the message is "OK - Deployed application at context path /myapp". In the "Applications" section check that there is a line with the new Portofino application. The following screenshot shows the situation on Tomcat 5.5.x (On Tomcat 6.x it is very similar):
The application is now ready and available at the specified URL.
The technique described in the previous section works if can copy Portofino's WAR file to the server's file system. If you cannot do that, you can still deploy it using a "remote deployment".
First locate the WAR file on your local machine and rename it to the context name with "war" extension, e.g., myapp.war.
Access the Tomcat Web Application Manager and scroll down to the section called "WAR file to deploy".
Click on the "Browse..." button and select the myapp.war file on your local machine.
Click "Deploy". The browser will upload the war file to the server and Tomcat will deploy it.
Many Tomcat installations do not offer the Tomcat Web Application Manager for security reason. Consequently, you have to deploy Portofino in some other way.
Tomcat has a useful auto-deploy feature. You can check if it is enabled by looking at the CATALINA_HOME/conf/server.xml file. The "Host" section of the xml should look like this:
<Host name="localhost" appBase="webapps" unpackWARs="true" autoDeploy="true" xmlValidation="false" xmlNamespaceAware="false">
Please notice the values of
unpackWARs. If they are both true, you can procede as follows.
Locate Portofino's WAR file and rename it to the context name with "war" extension, e.g., myapp.war. Then copy this file to CATALINA_HOME/webapps/.
Tomcat will automatically detect the new WAR file, open it and deploy the application. The operation requires just a few seconds.
If Tomcat's auto-deploy is not enabled, there is still one way you can deploy Portofino. Go to CATALINA_HOME/webapps and create a directory with the context's name. Then unzip the WAR file into it.
cd CATALINA_HOME/webapps mkdir myapp cd myapp unzip /path/to/portofino-war-3.0.war
Next go to CATALINA_HOME/conf/Catalina/localhost and create a file with the context's name and "xml" extension e.g., myapp.xml. Populate the file with the following content:
<?xml version="1.0" encoding="UTF-8"?> <Context docBase="/webapps/myapp"> </Context>
Restart Tomcat to make the new application available.