...
This section contains various miscellaneous questions that are asked frequently enough to be listed here.
Questions
I have a problem with webapp reloading in tomcat 4.1.27.
Wiki Markup |
---|
Update to a later tomcat version, preferably the latest stable one. If you must stay with 4.1.27, get this hotfix: \[http://issues.apache.org/bugzilla/show_bug.cgi?id=22096 Bugzilla 22096\]. |
I am unable to compile my JSP!
Are you seeing this?
Answers
I am unable to compile my JSP!
Are you seeing this?
No Format |
---|
org.apache.jasper.JasperException: Unable to compile
class for JSP
An error |
No Format |
org.apache.jasper.JasperException: Unable to compile
class for JSP
An error occurred at line: -1 in the jsp file: null
Generated servlet error:
[javac] Since fork is true, ignoring compiler
setting.
[javac] Compiling 1 source file
[javac] Since fork is true, ignoring compiler
setting. |
...
No Format |
---|
<servlet> <servlet-name>listing</servlet-name> <servlet-class>org.apache.catalina.servlets.DefaultServlet</servlet-class> <init-param> <param-name>debug</param-name> <param-value>0</param-value> </init-param> <init-param> <param-name>listings</param-name> <param-value>true</param-value> </init-param> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>listing</servlet-name> <url-pattern>/</url-pattern> </servlet-mapping> |
How do I make Tomcat listen on a specific IP address instead of all available addressesuse symbolic links with jars?
Wiki Markup |
---|
RTFM! \[Add the property address='127.0.0.1'You'll need to yourtweak Connectorwith configserver.\] For more detail:xml and \[http://tomcatmarc.apachetheaimsgroup.orgcom/?l=tomcat-4.1-doc/config/jk.html JK\],user&m=105159411609623&w=2 do this\]. (Don't worry - its really easy!) |
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://tomcatwww.apacheonjava.org/tomcat-4.1-doc/config/http11.html http\] (legacy), \[http://tomcat.apache.org/tomcat-4.1-doc/config/coyote.html http\] (coyote).com/pub/a/onjava/excerpt/jebp_3/index3.html Content-Disposition\] header. |
Is tag pooling broken? It doesn't call release!How do I use symbolic links with jars?
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!
Wiki Markup |
---|
It is not broken, your tag probably is. Many bug reports have been filed about this. \[https://issues.apache.org/bugzilla/show_bug.cgi?id=16001 Bug 16001\] has 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
:
- Calling
setBufferSize
and content has been written. - The response has been committed and you do any of the following:
- Calling
ServletResponse.reset()
orServletResponse.resetBuffer()
- Calling either
HttpServletResponse.sendError()
orHttpServletResponse.sendRedirect()
. - Calling
RequestDispatcher.forward()
which includes performing a jsp:forward - Calling
RequestDispatcher.forward()
which includes performing a jsp:forward
- Calling
Remember that if you call forward()
or sendRedirect()
, any following lines of code will still execute. For example:
{{{
{
...
response.sendRedirect("foo.jsp");
// At this point, you should probably have a return statement otherwise
// the following code will run
System.out.println("After redirect! By the way ...");
System.out.println("Use commons-logging or log4j, not System.out");
System.out.println("System.out is a bad practice!");
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?
It is not broken, your tag probably is. Many bug reports have been filed about this. \[https://issues.apache.org/bugzilla/show_bug.cgi?id=16001 Bug 16001\] has 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
:
- Calling
setBufferSize
and content has been written. - The response has been committed and you do any of the following:
- Calling
ServletResponse.reset()
orServletResponse.resetBuffer()
- Calling either
HttpServletResponse.sendError()
orHttpServletResponse.sendRedirect()
. - Calling
RequestDispatcher.forward()
which includes performing a jsp:forward - Calling
RequestDispatcher.forward()
which includes performing a jsp:forward
- Calling
Remember that if you call forward()
or sendRedirect()
, any following lines of code will still execute. For example:
{{{
{
...
response.sendRedirect("foo.jsp");
// At this point, you should probably have a return statement otherwise
// the following code will run
System.out.println("After redirect! By the way ...");
System.out.println("Use commons-logging or log4j, not System.out");
System.out.println("System.out is a bad practice!");
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 See the \[http://wiki.apache.org/tomcat/FAQ/Logging Logging\] section of the FAQ. Wiki Markup
- How do open a file for reading in my webapp?*
...
Can I run tomcat with the JRE, or do I need the full JDK?
Tomcat officially 4 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. Tomcat 5.5 onwards will work with a JRE or a JDK.
Is tomcat an EJB server? Can I use EJBs with tomcat?
...
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.
...