HOW TO: Create and deploy JSP Pages and Java Servlets ?

JSP Files

By default JSP files configures to work anywhere under your public_html directory. All you need to do to use JSP files is give your files an extension of '.jsp' and upload them to the server under public_html. Your public_html directory is located here:

/home/username/public_html

(Replace 'username' with your account's username)
All you need to do is give your files an extension of '.jsp' and they will be recognized as JSP files.

If you're having trouble with JSP Files


Check the Tomcat log files for error messages and stack traces. If a JSP is causing an exception to be thrown, it will be stored in the catalina.out file in your Tomcat server. Check that file for any useful messages whenever a JSP page fails. You can find your Tomcat log files here:

/tomcat-users/yourname.com/logs

(Replace 'yourname.com' with your account's domain name)

If you log in via SSH, there is a handy command you can use to view log entries as they appear in real time. The command to use is:

tail -f /tomcat-users/yourname.com/logs/catalina.out

This command will show you all of the log entries added to the catalina.out log file as they happen. So, as you're running your JSP page in your browser, keep an eye on that log file to see errors and messages that will help you debug problems.


Java Servlets

By default Tomcat configures to recognize Java Servlet classes stored under your web application installation. Any Servlet classes stored here will be automatically available to use without specifying a web.xml Servlet Mapping:

/home/username/public_html/WEB-INF/classes

(Replace 'username' with your account's username)

To use Java servlet stored here, access them at the following URL:

http://www.yourname.com/servlets/packageName.className


(Replace 'yourname.com' with your account's domain name)


Important Notes : Apache Tomcat will not properly handle servlets that are not part of a package. We strongly recommend that you include all of your servlets inside of a Package to ensure they are accessible in Tomcat.

If you're having trouble with Java Servlets

Make sure that your Tomcat instance is configured for Java Servlet support via the Invoker. To do the Invoker configuration check, log in to the server and check the Tomcat server web.xml file:

/tomcat-users/yourname.com/conf/web.xml

(Replace 'yourname.com' with your account's domain name)

Make sure that the Invoker servlet definition is NOT commented out in this file. If it is commented out, delete the comment markers, so that the Invoker servlet is created on startup. Then restart your Tomcat instance. After that, your servlets should render properly.

Check the Tomcat log files for error messages and stack traces. You can find your Tomcat log files here:

/tomcat-users/yourname.com/logs

Java Servlet Mappings

Tomcat server installations allow you to setup custom servlet mappings in your web site's web.xml file. By default,only configure Apache to forward requests matching the following URL strings to Tomcat:

*.jsp

/servlet/*

/servlets/*


Any URL's that do not meet this specification must be specifically setup by request.

 

  • Email, SSL
  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

What is the difference between shared SSL and private SSL?

A shared SSL displays as https://ip/~yourusername/. A private SSL would display as...

Why are my FrontPage extensions not working?

You must first make sure you have installed the extensions from going into your cpanel and...

Application Paths

Here are the applications paths. If you do not see what you are looking for, please email...

Custom error pages

To create a custom error page for your account you will need to upload a file with the...

How do I use SSL to setup my email?

Set your mail server to the host name for SMTP/POP3/IMAP (instead of domain.com) and then make...