CSS font stacks & developer FAQs with Web standards

WestNIC provides reliable web hosting services

Fastwebhost offers cheap web hosting & reseller hosting services

Site navigation below

This FAQ is part of the Code Style Help and FAQ section. Join our premium content service for full access all FAQ answers.

What if you were One Percent Better? Java ebooks for iPad, Kindle, Nook and Sony Reader

Tomcat configuration techniques

Q: How can I register a specific domain in Tomcat?

A: To register a specific domain name for your Tomcat server you should replace the "defaultHost" attribute in the <Engine> element of your server.xml configuration and update the <Host> element's name attribute to match, as in the code sample below.

… full answer hidden, click for full answers

Premium members click below for full answer
How can I register a specific domain in Tomcat?

Q: How can I move my Web applications outside the Tomcat directory?

A: Your suggestion is a sensible one, since it helps separate the fairly static server installation from frequently changing application resources, and makes the server less prone to accidental damage.

… full answer hidden, click for full answers

Premium members click below for full answer
How can I move my Web applications outside the Tomcat directory?

Q: How many connections can be made to Tomcat on Windows?

A: The number of connections accepted by Tomcat is determined by the <Connector> elements in the server.xml configuration file. The maxProcessors attribute sets the total number of threads that can run simultaneously and the acceptCount attribute controls the number of requests that may be queued waiting for a connection.

The physical limits to the number of connections will depend on the specification of the host machine and the configuration of the Java Virtual Machine (JVM) more than the operating system. A higher specification machine could manage more threads, but you may need to adjust the runtime parameters of the JVM to hold many more objects in memory and process the threads. See the -mx and -ss arguments to configure heap and stack size respectively.

At the time of writing, the Apache Software Foundation do not recommend Windows systems for production hosting of Tomcat.

Q: Can Tomcat call a servlet automatically using the <run-at> tag?

A: Tomcat does not support a <run-at> element, it is not part of the servlet specification. This feature is a custom extension of the Resin servlet container.

You may be able to achieve similar results using independent scheduling programs such as cron and uschedule.

Tomcat configuration problems

Q: Tomcat doesn't find my global initialization parameters!

A: Global initialisation parameters set using context-param elements can only be accessed through the Web application's ServletContext object in Tomcat, not via the ServletConfig object's getInitParameter method.

… full answer hidden, click for full answers

Premium members click below for full answer
Tomcat doesn't find my global initialization parameters!

Q: Why does the server fail to load the supporting class for my servlet?

A: Tomcat only loads supporting classes from specific directories in the server and application directory structure, not from the system classpath, so your library files must be in the wrong place. The three key locations are...

… full answer hidden, click for full answers

Premium members click below for full answer
Why does the server fail to load the supporting class for my servlet?

Q: All my JSP give a 404 error!

A: If static files are being served but JSP documents are not, first check the Web application directory where the JSP source should be deployed. In a default Tomcat installation this will be under the directory $CATALINA_HOME/webapps. Use the Host appBase attribute in your server.xml file to help locate the specific directory.

… full answer hidden, click for full answers

Premium members click below for full answer
All my JSP give a 404 error!

Q: I get a "Page cannot be displayed" error!

A: You should look at your server logs to see how your request was recorded. It is very difficult to guess what the problem might be without seeing your set-up but check you have a servlet mapping that matches the referring URL in your HTML or JSP document, something like this...

… full answer hidden, click for full answers

Premium members click below for full answer
I get a "Page cannot be displayed" error!

Q: I cannot generate tomcat-apache.conf, how come?

A: The tomcat-apache.conf file is created automatically when the Tomcat version 3 server process starts. Are you working with the version 3 architecture? If the server is not starting, go back and check through the Tomcat configuration points step by step, these are the most fundamental ones.

Q: I get NoClassDefFoundError for ELResolver with Tomcat 6!

A: Tomcat 6 implements the Java Server Pages 2.1 specification, in which the ELResolver class is moved to a more general javax.el package. If your servlet or other packages in your application, such as Java Server Faces or Java Standard Tag Library classes, reference the original package location at javax.servlet.jsp.el, they will need to be updated to compatible versions.

Q: How do I update the Tomcat JRE configuration?

A: Go to the Tomcat program group and choose the Properties / Configuration option. This will launch a small application configuration applet with several fields including the path for the Java Virtual Machine. Insert the path for your preferred JRE installation and point specifically to the jvm.dll file under the bin directory, as below.

Apache Tomcat properties configuration

Apache Tomcat properties configuration on Windows, including the Java Virtual Machine input field

Home · Web fonts · Font stacks · FAQs · Java · CSS · Javascript · HTML · Site manager