Why does tomcat use catalina




















Apache Tomcat is a widely used implementation of the Java Servlet Specification, which has been developed as an open- source project by the Apache Software Foundation since , when the project source was donated to the ASF by Sun Microsystems. Tomcat is actually composed of a number of components, including a Tomcat JSP engine and a variety of different connectors, but its core component is called Catalina.

Catalina provides Tomcat's actual implementation of the servlet specification; when you start up your Tomcat server, you're actually starting Catalina. In this article, we'll get to know Tomcat's core component, from the origins of the name "Catalina", to an overview of how Catalina is configured. This runs the java command to invoke the Tomcat startup and shutdown classes.

This is used internally, and then only on Windows systems, to append items to Tomcat classpath environment variables. This makes a crypto digest of Tomcat passwords. Use it to generate encrypted passwords. This is also only used internally and sets the Tomcat classpath and several other environment variables. This is a generic Tomcat command-line tool wrapper script that can be used to set environment variables and then call the main method of any fully qualified class that is in the classpath that is set.

This is used internally by the digest script. This runs the catalina version , which outputs Tomcat's version information. The main script, catalina , is invoked with one of several arguments. The most common arguments are start , run , or stop. The run argument causes Tomcat to leave the standard output and error streams where they currently are such as to the console window useful for running from a terminal when you want to see the startup output.

This output should look similar to Example If you use catalina with the start option or invoke the startup script instead of using the run argument, you see only the first few Using The shutdown script invokes catalina with the argument stop , which causes Tomcat to connect to the default port specified in your Server element discussed in Chapter 7 and send it a shutdown message. A complete list of startup options is listed in Table This specifies an alternate server.

The default is to use the server. See the " server. This allows Tomcat to be tested in an embedded mode, and is usually used by application server developers.

This starts up Tomcat, with standard output and errors going to the Tomcat logfiles. To prevent runaway programs from overwhelming the operating system, Java runtime environments feature limits such as "maximum heap size. However, there are options supplied to the java command that let you control the limits. The exact form depends upon the Java runtime, but if you are using the Sun runtime, you can enter:.

This will run a class file called MyProg with a maximum memory size of MB for the entire Java runtime process. These options become important when using Tomcat, as running servlets can begin to take up a lot of memory in your Java environment. Windows users should set this environment variable from the Control Panel, and Unix users should set it directly in a shell prompt or login script:. Other Tomcat environment variables you can set are listed in Table This sets the base directory for writable or customized portions of a Tomcat installation tree, such as logging files, work directories, Tomcat's conf directory, and the webapps directory.

This sets the base directory for static read-only portions of Tomcat, such as Tomcat's lib directories and command-line scripts. This passes through Tomcat-specific command-line options to the java command. This sets the address for the JPDA used with the catalina jpda start command. This variable may optionally hold the path to the process ID file that Tomcat should use when starting up and shutting down.

If you have installed Tomcat via an Apache binary release archive either a. Make sure it's set to the absolute path of the directory where the Java installation you want Tomcat to use resides. If it's not, set it and export it now. Try running telnet localhost and telnet localhost to see if any existing server accepts a connection, just to be sure.

You should see output similar to this when Tomcat starts up. If you've installed Tomcat via the RPM package on Linux, you can test it out by issuing a start command via Tomcat's init script, like this:. Or, on some Linux distributions, such as Fedora and Red Hat, to do the same thing, you may instead type the shorter command:. If you installed the JPackage. You should see several Java processes scroll by. Another way to see whether Tomcat is running is to request a web page from the server over TCP port Also check out the " Common Errors " section, later in this chapter.

To use Tomcat's init script on Solaris, you must be the root user. Switch to root first. Then, you can start Tomcat like this:. AsyncFileHandler is a subclass of FileHandler that queues the log messages and writes them asynchronously to the log files. Its additional behaviour can be configured by setting some system properties.

Example logging. A web application running on Apache Tomcat can: Use any logging framework of its choice. Use system logging API, java. Java logging API — java.

Servlets logging API The calls to javax. Such messages are logged to the category named org. Console When running Tomcat on unixes, the console output is usually redirected to the file named catalina. That may include: Uncaught exceptions printed by java. Thread dumps, if you requested them via a system signal When running as a service on Windows, the console output is also caught and redirected, but the file names are different.

Access logging Access logging is a related but different feature, which is implemented as a Valve. This means that logging can be configured at the following layers: Globally. The file is specified by the java. In the web application. FileHandler, java. ConsoleHandler Handler specific properties. Describes specific configuration info for Handlers. OneLineFormatter java. Provides extra control for each logger.

FileHandler org. FileHandler For example, set the org. LifecycleBase logger to log each component that extends LifecycleBase changing state: org. Different implementations of Realm allow Catalina to be integrated into environments where such authentication information is already being created and maintained, and then use that information to implement Container Managed Security as described in the Servlet Specification Coyote is a Connector component for Tomcat that supports the HTTP 1.

Improve this answer. The Overflow Blog. Does ES6 make JavaScript frameworks obsolete? Podcast Do polyglots have an edge when it comes to mastering programming Featured on Meta. Now live: A fully responsive profile. Linked Related Hot Network Questions.



0コメント

  • 1000 / 1000