Place your text ad here.
World class data recovery software and renowned raid recovery services
WestNIC provides reliable web hosting services
Free software downloads and drivers download resources
Ahosting.biz reseller hosting, managed dedicated server with 24/7 support
This FAQ is part of the Code Style Help and FAQ section. Use the help request form below if your question is not answered here, but make sure you are asking the right question first.
Tomcat-Apache service for?
catalina.bat?
A: There is no difference between Apache Tomcat and a servlet container. Tomcat is the official reference implementation of the Java servlet and Java Server Pages specifications.
A: Yes, you can use Apache Tomcat for a commercial Web application and many companies do so.
A: Your servlet class files should be deployed to the classes subdirectory of WEB-INF under the relevant webapps directory, or packaged as a JAR in the lib subdirectory.
More details available to subscribers:
How do I run a servlet in Tomcat?
Tomcat-Apache service for?
A: This service configuration is given as an example of the WARP connector in the default Tomcat server installation and is not required for basic development purposes. The WARP connector allows Tomcat to establish two-way communication with a standard Apache HTTP server so they can delegate the response to Web requests. This means that Apache HTTPd can respond to requests for static content such as images, while Tomcat can service requests for JSP and servlets for example.
Unless you specifically want to make use of this feature, you can delete or comment-out this entire <Service> element from the configuration file.
A: Your compilation classpath only needs to include the classes and libraries necessary for your servlet. It's unlikely you are using Tomcat bootstrap classes in your servlet but, if so, make sure this package is on your classpath.
More details available to subscribers:
Should the Tomcat bootstrap classes be in my classpath?
A: See this Code Style article about configuring new Web application contexts under the heading Tomcat server configuration: server.xml. Tomcat creates a "test" directory by default, though, so it would be best to name your new directory differently.
A: The URL you use partly depends on the port you have configured Tomcat to operate on. This is configured in the HTTP Connector element in server.xml.
More details available to subscribers:
What URL do I use to run my servlet?
A: You can configure custom error pages in Tomcat using the error-page element in the application's web.xml file, as below. The error-code element contains the HTTP status code number, the location element contains the path to the error document relative to the Web application root. The error document may be a static HTML document or a JSP. The error-page element may be repeated to specify custom pages for any number of error codes.
More details available to subscribers:
Can I return custom error pages in Tomcat?
A: Tomcat 5 and above uses the Java Runtime Environment by default, not the Java Software Development Kit (JSDK). The Tomcat installer attempts to use the Windows system registry to find a valid JRE installation or a JAVA_HOME environment variable, not the system path. If your JRE is not found or its registry entry is not valid it may cause problems during installation.
Check and upgrade your JRE installation to Java 1.5 if necessary, and try setting the JAVA_HOME variable to the path of the JRE base directory if still not found.
A: To get more diagnostic information on this problem, open a command window and run the startup script manually: click Start select Run, type cmd and press Enter.
More details available to subscribers:
The Tomcat window opens then closes immediately, what can I do?
A: This is not a very helpful error message. If you can run Tomcat in console mode, you may get more helpful information from the container output. Create a Windows shortcut with the following Target ...
More details available to subscribers:
Tomcat 5.5 on Windows just reports "terminated unexpectedly"!
catalina.bat?
A: If you have many environment properties already set for other applications, Java packages and system devices, the addition of the Tomcat startup variables may exceed your initial allocation. Professional Apache Tomcat by Vivek Chopra et al. suggests you set environment space to 4096 bytes. If it still doesn't work at that level, you could try setting it extremely high to see if this makes the difference, then reduce it by trial and error to a working value.
A: Tomcat 5 is designed to run with the Java 1.5 runtime environment and does not work with the Java Software Development Kit (JSDK) version 1.4 without modification. So you have two options, either install the Java 1.5 runtime environment, or use the Apache Tomcat JDK 1.4 Compatibility Package, which includes additional JAR files for the Java Management Extensions API (JMX) and Xerces XML Parser.
A: Tomcat requires a system environment variable called TOMCAT_HOME to be set in advance, so that it knows where to find the key Java code it needs to run, including servlet.jar. This is normally found in the main installation directory for Tomcat. You also need to set a similar JAVA_HOME variable.
More details available to subscribers:
Tomcat reports "Unable to locate servlet.jar"!
A: The normal way of logging servlet information is to use the servlet's log(String) or log(String, Throwable) methods. To log a message when the servlet starts up, place the calls in the servlet's init(ServletConfig) method, as follows.
More details available to subscribers:
How can I log messages to the console?
| Front-end FAQs | Back-end FAQs | Learning Java |
|---|---|---|
See site help for questions about this site, our text ads and sponsored links services.