Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Wiki Markup
You'll need to tweak with server.xml and \[http://marc.theaimsgroup.com/?l=tomcat-user&m=105159411609623&w=2 do this\]. (Don't worry - its really easy!)

*How do I get UTF-8?

Wiki Markup
\[http://marc.theaimsgroup.com/?t=105524444400002&r=1&w=2 This thread\] should answer that.*

How do I change the name of the file in the download Save-As dialog from a servlet? (or jsp)*

Wiki Markup
Use the \[http://www.onjava.com/pub/a/onjava/excerpt/jebp_3/index3.html Content-Disposition\] header.*

Is tag pooling broken? It doesn't call release!*

It is not broken, your tag probably is. Many bug reports have been filed about this. Here is the bug report with all the gory details.*

Why do I get java.lang.IllegalStateException ?*

These are the most common reasons how you can get an java.lang.IllegalStateException:

...

response.sendRedirect("bar.jsp"); /* This will throw an error! */

}
}}} *

How do I make a scheduled event on Tomcat?*

Wiki Markup
Tomcat does not support this directly. Its not part of the Servlet or JSP Specification. If you do need this functionality see \[http://marc.theaimsgroup.com/?t=106192918700004&r=1&w=2 this thread\] or \[http://marc.theaimsgroup.com/?l=tomcat-user&m=106157051231075&w=2 this link\].*

What is Element "web-app" does not allow "servlet" here?*

Your web.xml is not well formed or it is not conforming to the DTD as defined by the servlet spec. Use an XML validator to ensure your web.xml file is ok.*

Where does System.out go? How do I rotate catalina.out?*

Wiki Markup
See the \[http://wiki.apache.org/tomcat/FAQ/Logging Logging\] section of the FAQ.*

  • How do open a file for reading in my webapp?*

Use ServletContext.getResourceAsStream()*

Can I run tomcat with the JRE, or do I need the full JDK?*

Tomcat officially requires the full JDK, because it needs javac in order to compile JSPs. If you pre-compile all your JSPs, you can get away with running tomcat on a JRE only, but you do so at your own risk.*

Is tomcat an EJB server? Can I use EJBs with tomcat?*

Tomcat is not an EJB server. Tomcat is not a full J2EE server. Tomcat is a Servlet container. Tomcat does support those parts of the J2EE specification that are required for Servlets, such as a subset of JNDI functionality. Furthermore, you can connect to remote J2EE servers, or run tomcat embedded inside a full J2EE server.*

Can I access Tomcat's JNDI provider from outside tomcat?*

Not at this time.*

Who uses tomcat in production?*

Wiki Markup
Numerous organizations across various industries all over the world. A full listing can be found at the \[http://wiki.apache.org/tomcat/PoweredBy Wiki\].*

How do I configure commons-logging and log4j in tomcat 5?*

Wiki Markup
See the \[http://wiki.apache.org/tomcat/FAQ/Logging Logging\] section of the FAQ.*

I'm getting java.lang.ThreadDeath exceptions when reloading my webapp.*

Wiki Markup
See \[http://issues.apache.org/bugzilla/show_bug.cgi?id=26372 Bugzilla discussion\] of this.*

Help! Even though I run shutdown.sh (or shutdown.bat), Tomcat does not stop!*

Wiki Markup
Most likely, a non-daemon thread is running. JVM's do not shutdown until there are 0 non-daemon threads. You will need to perform a thread dump \[kill -3 pid for Unix or CTRL+Break for Windows\] to determine the code which started the thread.*

How do I debug JSP errors in the Admin web application?*

The admin web application that ships with Tomcat's binary distribution contains pre-compiled JSPs and mappings for them. In order to debug these JSPs, you need to get the source versions, place them in the admin webapp directory, and disable the JSPC-generated web.xml servlet mappings. Here's how to do it from scratch for a clean Tomcat installation:

  1. Download Tomcat's base and admin webapp distributions (binaries), unzip to a directory of your choice. We'll use c:\temp in this example. 2. Edit c:\temp\server\webapps\admin\WEB-INF\web.xml to remove the JSPC-generated servlet mappings. These are marked in the web.xml file with comments indicating the beginning and end of the JSPC section. You can simply comment out all these servlet-mappping elements. Be careful not to comment out other servlet mappings such as the Struts dispatcher servlet. 3. Open c:\temp\server\webapps\admin\WEB-INF\lib\catalina-admin.jar with a zip file program like WinZip. Remove the files named *_jsp.class, as these are the compiled JSPs. Do not remove the other class files, the ones under the org/apache/ paths. 4. Download a Tomcat source distribution and unzip it to a directory of your choice, but not the same directory that you used above. We'll use c:\src in this example. 5. Copy everything * except''' the WEB-INF/lib directory from c:\src\container\webapps\admin to c:\temp\server\webapps\admin. Now you will have the uncompiled admin webapp JSPs. 6. If you haven't already, define an admin user in %CATALINA_HOME%\conf\tomcat-users.xml. 7. Start Tomcat, navigate to http://localhost:8080 (or your actual server:port if you have modified the default values), and access the admin web application. It will run slower because Tomcat is now compiling the JSPs on-demand the first time you access them, but should otherwise appear normal.