servlet hosting logo
Contact us: +44 (0) 870 1657215 - contact@nameonthe.net
Members of
Members of Nominet Ripe member WorldPay Guarantee
We accept the following payment methods:
Visa payments supported by WorldPay Visa/Delta payments supported by WorldPay Visa/Electron payments supported by WorldPay Mastercard payments supported by WorldPay Switch payments supported by WorldPay JCB Solo payments supported by WorldPay
Tomcat Quick Start Guide
This guide offers a quick start guide to deploying and undeploying web applications under the the shared Tomcat JVM account. It assumes some knowledge of servlet and jsp technology as well as a running nameonthe.net account.

Deploying your first application
The directory paths used during this guide differ dependent upon if your account is SSH enabled (enabling you to obtain a Unix shell). If the account is SSH enabled the web app base will be /web, if not then the root application directory will be /.

By default a ROOT level context will be pre-configured as part of the account creation process (this is optional). This allows you to start development immediately by placing jsp files into the root level directory (/) and placing servlets within the WEB-INF/classes/ directory (relative to either /web or / - see above). If this is not what is required, such as if you intend to take advantage of the automatic deployment of web applications please instruct support to remove the default Context.

Hot Deployment of web applications
Using the pre-configured root context is useful during incremental development, allowing you to upload servlets and jsps which will be automatically reloaded when Tomcat detects them. Tomcat (like other servlet containers) offers the option of deploying web applications via alternative routes. Using .war files is perhaps the best known, the application developer packages the web application within an jar file which according to a structure defined by the servlet specification. A minimal .war file would have the following entries

/WEB-INF/web.xml
/index.jsp

This is the bare minimum (in fact the web.xml is not actually required under Tomcat) for Tomcat to detect and reload the war and subsequently be able to process requests for the index.jsp page.

To deploy a war file while Tomcat is running copy a .war file into the root directory of your web space (/ for non ssh users, /web for ssh users). Tomcat will detect this and deploy it.

.war naming conventions and accessing your application
The name of the .war file determines where the the application will be visible via the web (the path). The basic rule is: the name of the war file stripped of the .war extension will be the name of the application. For example, if the war file is named catalog.war then the root url of the application will be based at http://www.yourdomain.com/catalog. The exception to this rule is war files with the name ROOT.war. When Tomcat deploys this war file it will be accessible at the root level of your domain http://www.yourdomain.com/.

Deploying web application using directories
In addition to the standard .war deployment process, Tomcat is intelligent enough to deploy applications on the basis of what looks like a valid web application. When Tomcat is scanning the web application root it looks for directories beneath this directory which adhere to the minimal .war file structure presented above, if it finds a suitable directory it will create and deploy an application. It uses the same algorithm as that used during war file deployment to determine what path the web application should be assigned.

Deployment using .xml files (Advanced)
When Tomcat scans the web application root directory it attempts to find files with a .xml extension. If found, it attempts to locate a valid element which would normally appear in Tomcat main configuration file (server.xml). If well formed and valid, it then deploys a web application using this as it's source of configuration information. The benefits of this approach are it offers the developer access to configuration options (such a JNDI) which are unavailable when deploying web applications using the alternative approaches above.
Reloading web applications
By default Tomcat is configured to scan web applications for changes in jsps, classes within /WEB-INF/classes and the timestamp on the web.xml. Dependent upon the event, modified Tomcat will:
  • jsps - recompile
  • classes - reload (creating a new ClassLoader)
  • web.xml - reload the whole application
Destroying web application (hot deployment)
Unique to nameonthe.net is the process of hot undeployment. Under normal conditions, Tomcat may mark an application as unavailable due to errors within the web.xml file. This can occur during startup of Tomcat or during a reload triggered by the timestamp on the web.xml being updated. To avoid this problem, which can be frustrating because a restart of Tomcat is required, nameonthe.net have written a patch which will keep attempting to deploy a malformed web application. An additional bonus is 'hot deployment', if a web application has been loaded and is no longer required removing the source (.war, directory, .xml) file will cause Tomcat to undeploy this application.

Using the mysql command line client
The SSH enabled accounts come with the mysql client preinstalled which allows you to carry out database maintenance tasks. In supplement to the database web interface the mysql command line client is used to perform more complex tasks that cannot be made via the web interface. To connect to the client once logged in (see above) use the following command:mysql You should see the client introduce itself as shown below:
bash-2.05$ mysql
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 7 to server version: 3.23.55-max

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql>
To carry out a task issue the sql statement (note the mysql client accepts non SQL command for mysql specific purposes) followed by a ';'. Example:
mysql> select * from test;
+----------+
| test     |
+----------+
| ttesting |
+----------+
1 row in set (0.00 sec)
To exit from the mysql client type issue the 'exit' command. Those familiar with mysql will be aware that the client will normally require command line arguments to connect, for your convenience a .my.cnf file has been created which mysql uses to find which parameters to use when it connects to the database.

Using the psql command line client
If Postgres was chosen for the database and the account is ssh enabled, the psql client is available for use. To connect to the database use the following command:

psql -U username -h 127.0.0.1 username

Using the Tomcat manager application
The Tomcat manager application is pre-installed and configured appropriately with all shared JVM accounts. The manager application provides a web interface which can be used to manage the configuration of contexts associated with your your domain (you cannot view other user's web applications), using this interface you can start and stop contexts as well as perform other routine tasks. This application can be accessed from http://yourdomain/manager/html, the username and password will be the same as your ftp/ssh login credentials (you can modify this by editing /etc/tomcat-users.xml).
Viewing the Tomcat Logs
By default all the logging activity will be placed within the /logs/ directory of your application. If a ssh shell is available (if not, speak to support and ask for one) then 'tailing' the logs can provide a powerful tool in debugging your web application. Viewing the logs is recommended when you suspect that errors are occurring during the loading/reloading of your web application.
Contact Support
If you require support please email support@nameonthe.net
username
password
>> Login <<
Today's Tech Tip
Windows Tip (No 128)
Flush dns within windows using the ipconfig (DOS) tool, example

C:\>ipconfig /flushdns

Latest Java news
Oracle, BEA and the big virtual Java adventure
2008-06-26 11:09:00.0
MusicStation is fine tuned for Java handsets
2008-06-26 10:47:00.0
Sun To Set Up Education ...
2008-06-26 06:29:00.0
ImageMagick 6.4.2
2008-06-25 20:51:00.0
nameonthe.net news feed
System Status
(Fri Jul 04 14:46:45 BST 2008)
There are no known network or server problems

Valid XHTML 1.0!

Valid CSS!

Copyright © www.nameonthe.net 1999-2008, All Rights Reserved
All prices exclude VAT