Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Added an external link, updated formatting.

...

Anyone may edit this page to add their own content. That is why this page is part of a Wiki and not a hardcoded static file in the FAQ.

Wiki Markup
However, _do not_ add questions without answers to this page. If you have a question about how to do something in Tomcat which has not been addressed yet, ask
the tomcat-user list:
 the \[http://jakarta.apache.org/tomcat/faq/tomcatuser.html tomcat-user list\]. Once you've figured out how to fix your problem, come back and update the Wiki to allow the rest of us to benefit from what you've learned!

...

How do I set up and run Tomcat on Macintosh OS X?

Wiki Markup
See \[wiki:Self:TomcatOnMacOS Running Tomcat on MacOS X\]

...

Here are the two most popular ways::1)

  • Use a ResourceBundle. See the Java docs for the specifics of how the ResourceBundle class works. Using this method, the properties file must go into the WEB-INF/classes directory or in a jar file contained in the WEB-INF/lib directory.

...

  • Another way is to use the method getResourceAsStream() from the ServletContext class. This allows you update the file without having to reload the webapp as required by the first method. Here is an example code snippet, without any error trapping:
    No Format
        // Assuming you are in a Servlet extending HttpServlet 
        // This will look for a file called "/more/cowbell.properties" relative 
        // to your servlet Root Context 
        InputStream is = getServletContext().getResourceAsStream("/more/cowbell.properties"); 
        Properties  p  = new Properties(); 
        p.load(is); 
        is.close();  

...

How do I use log4j for all Tomcat log output?

...

If you only need to use log4j in your own web app, just include log4j (and any log4j properties file) in your WAR file.

...

How do I configure

...

Tomcat Connectors?

On the Tomcat FAQ, there is a list of Other Resources which should have information pointing you to the relevant pages.

...

In particular, here are a number of locations for Tomcat Connectors:

  • Wiki Markup
    \[http://jakarta.apache.org/tomcat/connectors-doc/index.html Tomcat Connectors Documentation\]
  • Wiki Markup
    \[http://jakarta.apache.org/tomcat/connectors-doc/faq.html Tomcat Connectors FAQ\]
  • Wiki Markup
    \[http://jakarta.apache.org/tomcat/tomcat-4.1-doc/jk2/config/apache.html Configuring Tomcat Connectors for Apache\]

...

  • 
    \\

Wiki Markup
John Turner has an excellent page about \[http://johnturner.com/howto/apache-tomcat-howto.html Using Apache HTTP with Apache Tomcat\].

...

Tomcat crashed! What do I do now?

These steps are in no particular order ...

1.#0

Tomcat crashed! What do I do now?

These steps are in no particular order ...

...

Read the Tomcat FAQ

...

  1. Read the Tomcat RELEASE NOTES - there is something about Linux in it

...

  1. First look at the stack traces. I hope a stack trace was produced before the failure aborted the JVM process. After you get a few stack traces, see if a pattern appears. Trace back to source code if needed.

...

  1. Patch (or unpatch!) the operating system as needed.

...

  1. Patch (or unpatch!) the JVM (Java Virtual Machine).

...

  1. Linux Problem? - read the RELEASE NOTES!

...

  1. Look at commercial vendor support for other servlet engines. Sometimes the problem is universal regardless of servlet engine and may be a JVM/OS/application code issue

...

  1. Search Google for web pages - maybe someone else had this problem. I'll bet they did.

...

  1. Search Google news groups

...

  1. If the JVM is from a commercial vendor, (eg: IBM, HP) check their release notes and news groups

...

  1. Using a database? Make sure JDBC type 4 drivers are used. Check their release notes.

...

  1. Tweak JVM memory parameters. Setting memory too high can be as bad as having memory too low. If your memory settings are set too high, Java 1.3 JVMs may freeze while waiting for the entire garbage collection to finish. Also if the JVM has too much memory, if may be starving other resources on the machine which are needed which may be causing unforeseen exceptions. In a nutshell, throwing more memory doesn't always solve the problem!

...

  1. Turn off the Java JIT compiler. See the Java Docs on how to do this.

...

How do I share sessions across web apps?

Wiki Markup
You cannot share sessions directly across web apps, as that would be a violation of the Servlet Specification.  There are workarounds, including using a singleton class loaded from the common classloader repository to hold shared information, or putting some of this shared information in a database or another
data store. Some of these approaches have been discussed on the tomcat-user mailing list, whose archives you should search for more
 data store.  Some of these approaches have been discussed on the \[http://jakarta.apache.org/tomcat/faq/tomcatuser.html tomcat-user mailing list\], whose archives you should search for more information.

Sharing sessions across containers for clustering or replication purposes is a different matter altogether.

...

Wiki Markup
You might want to try serializing the response of 'request.getUserPrincipal()' and deserialize it to an instance of \[webapp\]MyPrincipal.

Setting up SSL - from the tomcat user list archives

]MyPrincipal.

...

Setting up SSL

Wiki Markup
Threads from the \[http://jakarta.apache.org/tomcat/faq/tomcatuser.html tomcat-user list\]

Using with Verisign:

...

Wiki Markup
withUsing \["OpenSSL"\]:

or this:

and this:

Plus, A description of "what SSL is all about anyway":

...


...

How do I install Tomcat as a service under Unix?

...