You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by "Konstantin Kolinko (Confluence)" <no...@apache.org> on 2019/11/25 02:00:15 UTC

[CONF] Apache Tomcat > Miscellaneous

There's **2 new edits** on this page  
---  
|  
---  
|  | [![page icon](cid:page-
icon)](https://cwiki.apache.org/confluence/display/TOMCAT/Miscellaneous?src=mail&src.mail.product=confluence-
server&src.mail.timestamp=1574647215047&src.mail.notification=com.atlassian.confluence.plugins.confluence-
notifications-batch-plugin%3Abatching-
notification&src.mail.recipient=8aa9809569d423cd016a0413306f00db&src.mail.action=view
"page icon")  
---  
[Miscellaneous](https://cwiki.apache.org/confluence/display/TOMCAT/Miscellaneous?src=mail&src.mail.product=confluence-
server&src.mail.timestamp=1574647215047&src.mail.notification=com.atlassian.confluence.plugins.confluence-
notifications-batch-plugin%3Abatching-
notification&src.mail.recipient=8aa9809569d423cd016a0413306f00db&src.mail.action=view
"Miscellaneous")  
|  |  |  |  | ![](cid:avatar_892fc5b633a433d86a56f192323474ea) |  | Konstantin
Kolinko edited this page  
---  
|  
|  | Here's the version comments  
---  
|  
---  
|  |  | ![](cid:avatar_892fc5b633a433d86a56f192323474ea) |  | Konstantin
Kolinko edited at [01:57
AM](https://cwiki.apache.org/confluence/pages/viewpage.action?pageId=103098964)  
---  
|  |  |  Correct links.  
---  
|  
|  |  | ![](cid:avatar_892fc5b633a433d86a56f192323474ea) |  | Konstantin
Kolinko edited at [01:53
AM](https://cwiki.apache.org/confluence/pages/viewpage.action?pageId=135862505)  
---  
|  |  |  Add a permalink. Fix formatting and links.  
---  
|  
|  | Here's what changed:  
---  
|

_Permalink_ to this page: [
https://cwiki.apache.org/confluence/x/VColBg](https://cwiki.apache.org/confluence/x/VColBg)

## Preface

This section contains various miscellaneous questions that are asked
frequently enough to be listed here.

...

  1. [I am unable to compile my JSP!](/confluence/pages/viewpage.action?pageId=103098964)
  2. [I can't get servlets to work under /servlet/*!](/confluence/pages/viewpage.action?pageId=103098964)
  3. [Why is the invoker evil?](/confluence/pages/viewpage.action?pageId=103098964)
  4. [How to I get Tomcat's version number?](/confluence/pages/viewpage.action?pageId=103098964)
  5. [Tomcat eats 100% of the CPU!](/confluence/pages/viewpage.action?pageId=103098964)
  6. [How do I get a customized error page?](/confluence/pages/viewpage.action?pageId=103098964)
  7. [Should I use the LE version (of Tomcat 4)?](/confluence/pages/viewpage.action?pageId=103098964)
  8. [How do I configure Tomcat to NOT to store the sessions during shutdown?](/confluence/pages/viewpage.action?pageId=103098964)
  9. [Is there a DTD for server.xml?](/confluence/pages/viewpage.action?pageId=103098964)
  10. [How do I change the welcome file? ( I want to show index.jsp instead of index.html)](/confluence/pages/viewpage.action?pageId=103098964)
  11. [How do I enable/disable directory listings?](/confluence/pages/viewpage.action?pageId=103098964)
  12. [How do I use symbolic links with jars?](/confluence/pages/viewpage.action?pageId=103098964)
  13. [How do I change the name of the file in the download Save-As dialog from a servlet? (or jsp)](/confluence/pages/viewpage.action?pageId=103098964)
  14. [Is tag pooling broken? It doesn't call release!](/confluence/pages/viewpage.action?pageId=103098964)
  15. [How do I disable tag pooling?](/confluence/pages/viewpage.action?pageId=103098964)
  16. [Why do I get java.lang.IllegalStateException ?](/confluence/pages/viewpage.action?pageId=103098964)
  17. [How do I make a scheduled event on Tomcat?](/confluence/pages/viewpage.action?pageId=103098964)
  18. [What is Element "web-app" does not allow "servlet" here?](/confluence/pages/viewpage.action?pageId=103098964)
  19. [How do I open a file for reading in my webapp?](/confluence/pages/viewpage.action?pageId=103098964)
  20. [Can I run Tomcat with the JRE, or do I need the full JDK?](/confluence/pages/viewpage.action?pageId=103098964)
  21. [Is Tomcat an EJB server? Can I use EJBs with Tomcat?](/confluence/pages/viewpage.action?pageId=103098964)
  22. [Can I access Tomcat's JNDI provider from outside Tomcat?](/confluence/pages/viewpage.action?pageId=103098964)
  23. [Who uses Tomcat in production?](/confluence/pages/viewpage.action?pageId=103098964)
  24. [I'm getting java.lang.ThreadDeath exceptions when reloading my webapp.](/confluence/pages/viewpage.action?pageId=103098964)
  25. [Help! Even though I run shutdown.sh (or shutdown.bat), Tomcat does not stop!](/confluence/pages/viewpage.action?pageId=103098964)
  26. [How do I debug JSP errors in the Admin web application?](/confluence/pages/viewpage.action?pageId=103098964)
  27. [What order do webapps start (or How can I change startup order)?](/confluence/pages/viewpage.action?pageId=103098964)
  28. [What's the different difference between a Valve and Filter?](/confluence/pages/viewpage.action?pageId=103098964)
  29. [How do I set system properties at startup?](/confluence/pages/viewpage.action?pageId=103098964)

## Answers

###  |
![](https://cwiki.apache.org/confluence/s/en_GB/8100/6ef1ce95c788ac159314a8fa6387047b8d1cc9fb/_/images/icons/macrobrowser/dropdown/anchor.png)
Anchor  
---  
|  | Q1  
---|---  
| Q1  
I am unable to compile my JSP!

Are you seeing this?

![](https://cwiki.apache.org/confluence/s/en_GB/8100/6ef1ce95c788ac159314a8fa6387047b8d1cc9fb/_/images/icons/macrobrowser/dropdown/noformat.png)
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.
      
  
---  
  
...  
  

---  
  
If so, here are some solutions:

  * [Environment variable issue](https://marc.info/?l=tomcat-user&m=104949554010352&w=2)
  * [Environment issue](https://bz.apache.org/bugzilla/show_bug.cgi?id=16688) or [Ant issue](https://bz.apache.org/bugzilla/show_bug.cgi?id=20527)
  * Others have had success by added JAVA_HOME/bin to their PATH. [[1](https://marc.info/?l=tomcat-user&m=105525594928279&w=2) ... []](https://marc.info/?l=tomcat-user&m=105525594928279&w=2) [[2]](https://marc.info/?l=tomcat-user&m=105526353505541&w=2) and make sure you are using the full JDK and not the JRE.

In the case of the Environment issues, it is typical that on Windows, the
startup scripts work fine and the service does not. The service uses registry
values to look for java and other "stuff". To save yourself some trouble, see
if the [NT Service Config Utility](http://web.bvu.edu/staff/david/tcservcfg/)
is helpful.

###
![](https://cwiki.apache.org/confluence/s/en_GB/8100/6ef1ce95c788ac159314a8fa6387047b8d1cc9fb/_/images/icons/macrobrowser/dropdown/anchor.png)
Anchor  
---  
|  | Q2  
---|---  
| Q2  
I can't get servlets to work under /servlet/*!

Using /servlet/ to map servlets is evil, absolutely evil. Even more evil than
[this](http://www.eviloverlord.com/lists/overlord.html) . That being said,
here are some threads that may answer this:

  * [(SECURITY) Apache Tomcat 4.x JSP source disclosure](https://marc.info/?l=tomcat-user&m=103417249925541&w=2) vulnerability
  * [Cannot Run Servlets, only JSP's, Part II](https://marc.info/?t=103945337100003&r=1&w=2)
  * [Tomcat configuration problem: JSPs work, servlets don't](https://marc.info/?t=104326854100001&r=1&w=2)

###
![](https://cwiki.apache.org/confluence/s/en_GB/8100/6ef1ce95c788ac159314a8fa6387047b8d1cc9fb/_/images/icons/macrobrowser/dropdown/anchor.png)
Anchor  
---  
|  | Q3  
---|---  
| Q3  
Why is the invoker evil?

This is opinions of the writer (YMMV) Quickie about the invoker: The invoker
is a dynamic servlet which allows run-time loading of other servlets based on
class name. This servlet is the one that allows
_http://localhost/servlet/com.foo.MyClass?more=cowbell_ , where
`com.foo.MyClass` is some class which can be loaded as a servlet but was never
explicitly declared in a config file.

...

For another explanation of the invoker servlet, why it's evil, and what to do
about it, see [JavaRanch FAQ](https://coderanch.com/wiki/660115/Invoker-
Servlet).

###
![](https://cwiki.apache.org/confluence/s/en_GB/8100/6ef1ce95c788ac159314a8fa6387047b8d1cc9fb/_/images/icons/macrobrowser/dropdown/anchor.png)
Anchor  
---  
|  | Q4  
---|---  
| Q4  
How to I get Tomcat's version number?

`javax.servlet.ServletContext.getServerInfo();`

Starting with Tomcat 5.0.28 - there is now a version.sh (or version.bat)
program in the bin directory. It will print the version number of Tomcat to
Standard output.

###
![](https://cwiki.apache.org/confluence/s/en_GB/8100/6ef1ce95c788ac159314a8fa6387047b8d1cc9fb/_/images/icons/macrobrowser/dropdown/anchor.png)
Anchor  
---  
|  | Q5  
---|---  
| Q5  
Tomcat eats 100% of the CPU!

Odds are, it might be the garbage collector going wacky.

In 1.4.1 JVMs there is a memory leak which could hampering the garbage
collector. [More
information](https://bugs.java.com/bugdatabase/view_bug.do?bug_id=4724129)
Otherwise - get a memory profiler and/or tweak your memory settings.

###
![](https://cwiki.apache.org/confluence/s/en_GB/8100/6ef1ce95c788ac159314a8fa6387047b8d1cc9fb/_/images/icons/macrobrowser/dropdown/anchor.png)
Anchor  
---  
|  | Q6  
---|---  
| Q6  
How do I get a customized error page?

In your `WEB-INF/web.xml` ... file:

![](https://cwiki.apache.org/confluence/s/en_GB/8100/6ef1ce95c788ac159314a8fa6387047b8d1cc9fb/_/plugins/servlet/confluence/placeholder/macro-
icon?name=code) Code Block  
---  
| language | xml  
---|---  
      
    
        
      
  
...

    
    
    <error-page>
            
      
  
---  
  
...

    
    
    <error-code>404</error-code>
            
      
  
---  
  
...

    
    
    <location>/error/404.html</location>
        
      
  
---  
  
...

    
    
    </error-page>
      
  
---  
  
You may also catch error 500's as well as other specific exceptions or
exceptions which extend Throwable. For more information, see the Servlet
Specification for all the gory details of how you can play with this.

###
![](https://cwiki.apache.org/confluence/s/en_GB/8100/6ef1ce95c788ac159314a8fa6387047b8d1cc9fb/_/images/icons/macrobrowser/dropdown/anchor.png)
Anchor  
---  
|  | Q7  
---|---  
| Q7  
Should I use the LE version (of Tomcat 4)?

No. It was an experiment, it failed. (YMMV) The original purpose of LE "light"
edition of Tomcat 4.0, 4.1 was because jdk1.4 provides a LOT of standard
functionality that Tomcat uses that was not in jdk1.3. So to save some space
two distributions were made to save some bandwidth. Since then, it has been an
exercise in confusion. (Flame me if you disagree) [More
info](https://marc.info/?l=tomcat-user&m=105341005928071&w=2)

###
![](https://cwiki.apache.org/confluence/s/en_GB/8100/6ef1ce95c788ac159314a8fa6387047b8d1cc9fb/_/images/icons/macrobrowser/dropdown/anchor.png)
Anchor  
---  
|  | Q8  
---|---  
| Q8  
How do I configure Tomcat to NOT to store the sessions during shutdown?

[Look at the Session manager
component](https://tomcat.apache.org/tomcat-9.0-doc/config/manager.html) and
tweak accordingly. One way is to tell Tomcat to persist sessions to a path
which does not exist. (So Tomcat will not store, or be able to load the
sessions).

###
![](https://cwiki.apache.org/confluence/s/en_GB/8100/6ef1ce95c788ac159314a8fa6387047b8d1cc9fb/_/images/icons/macrobrowser/dropdown/anchor.png)
Anchor  
---  
|  | Q10  
---|---  
| Q10  
Is there a DTD for server.xml?

No! Nor can one accurately exist. [Here's why](https://marc.info/?l=tomcat-
user&m=104205666221372&w=2)

###
![](https://cwiki.apache.org/confluence/s/en_GB/8100/6ef1ce95c788ac159314a8fa6387047b8d1cc9fb/_/images/icons/macrobrowser/dropdown/anchor.png)
Anchor  
---  
|  | Q11  
---|---  
| Q11  
How do I change the welcome file? ( I want to show index.jsp instead of
index.html)

This is done in web.xml by changing welcome-files-list. [More
detail](https://marc.info/?l=tomcat-user&m=104566785828794&w=2).

###
![](https://cwiki.apache.org/confluence/s/en_GB/8100/6ef1ce95c788ac159314a8fa6387047b8d1cc9fb/_/images/icons/macrobrowser/dropdown/anchor.png)
Anchor  
---  
|  | Q12  
---|---  
| Q12  
How do I enable/disable directory listings?

To make a global change, this is done in TOMCATCATALINA_HOMEBASE/conf/web.xml
by changing the listings property for the default servlet.

If you want to enable it for an individual webapp, then you need to add
something similar to the following to your `WEB-INF/web.xml` file (for your
individual app):

![](https://cwiki.apache.org/confluence/s/en_GB/8100/6ef1ce95c788ac159314a8fa6387047b8d1cc9fb/_/plugins/servlet/confluence/placeholder/macro-
icon?name=code) Code Block  
---  
| language | xml  
---|---  
      
    
       <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>
      
  
...  
  

---  
  
  

###
![](https://cwiki.apache.org/confluence/s/en_GB/8100/6ef1ce95c788ac159314a8fa6387047b8d1cc9fb/_/images/icons/macrobrowser/dropdown/anchor.png)
Anchor  
---  
|  | Q13  
---|---  
| Q13  
How do I use symbolic links with jars?

You'll need to tweak with server.xml and [do
this](https://marc.info/?l=tomcat-user&m=105159411609623&w=2). (Don't worry -
its really easy!) Update: you should be worried – this feature has its
drawbacks.

###
![](https://cwiki.apache.org/confluence/s/en_GB/8100/6ef1ce95c788ac159314a8fa6387047b8d1cc9fb/_/images/icons/macrobrowser/dropdown/anchor.png)
Anchor  
---  
|  | Q14  
---|---  
| Q14  
How do I change the name of the file in the download Save-As dialog from a
servlet? (or jsp)

Use the Content-Disposition header (as defined by
[RFC6266](https://tools.ietf.org/html/rfc6266)).

###
![](https://cwiki.apache.org/confluence/s/en_GB/8100/6ef1ce95c788ac159314a8fa6387047b8d1cc9fb/_/images/icons/macrobrowser/dropdown/anchor.png)
Anchor  
---  
|  | Q15  
---|---  
| Q15  
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. [Bug 16001](https://bz.apache.org/bugzilla/show_bug.cgi?id=16001) has
all the gory details. There is also a nice [description of the life
cycle](https://tomcat.apache.org/taglibs/site/guidelines.html).

Note, that this issue does not affect the `SimpleTag` tags and tag files of
JSP 2.0 and later specifications, because those do not use tag pooling.

###
![](https://cwiki.apache.org/confluence/s/en_GB/8100/6ef1ce95c788ac159314a8fa6387047b8d1cc9fb/_/images/icons/macrobrowser/dropdown/anchor.png)
Anchor  
---  
|  | Q9  
---|---  
| Q9  
How do I disable tag pooling?

To disable tag pooling: See $TOMCAT$CATALINA_HOMEBASE/conf/web.xml \--> file
and set enablePooling=false for the jsp servlet the `JspServlet` declaration.

**_Note_ :** This option, as well as most other configuration options of
[JspServlet](https://tomcat.apache.org/tomcat-9.0-doc/jasper-howto.html),
affects code generation and compilation of JSP pages. It will not alter the
behavior of JSPs that have already been compiled.

###
![](https://cwiki.apache.org/confluence/s/en_GB/8100/6ef1ce95c788ac159314a8fa6387047b8d1cc9fb/_/images/icons/macrobrowser/dropdown/anchor.png)
Anchor  
---  
|  | Q16  
---|---  
| Q16  
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()` or `ServletResponse.resetBuffer()`
    * Calling either `HttpServletResponse.sendError()` or `HttpServletResponse.sendRedirect()`.
    * Calling `RequestDispatcher.forward()` which includes performing a jsp:forward
    * Calling `RequestDispatcher.forward()` which includes performing a jsp:forward

Remember that if you call `forward()` or `sendRedirect()`, any following lines
of code will still execute. For example:{{{  
{  

![](https://cwiki.apache.org/confluence/s/en_GB/8100/6ef1ce95c788ac159314a8fa6387047b8d1cc9fb/_/plugins/servlet/confluence/placeholder/macro-
icon?name=code) Code Block  
---  
| language | java  
---|---  
      
    
    {
      ...
      
  
...

    
    
    
      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! */
      
  
---  
  
...

    
    
    
    
    }
      
  
---  
  
...

###
![](https://cwiki.apache.org/confluence/s/en_GB/8100/6ef1ce95c788ac159314a8fa6387047b8d1cc9fb/_/images/icons/macrobrowser/dropdown/anchor.png)
Anchor  
---  
|  | Q17  
---|---  
| Q17  
How do I make a scheduled event on Tomcat?

Tomcat does not support this directly. Its not part of the Servlet or JSP
Specification. If you do need this functionality see [Apache
TomEE](https://tomee.apache.org/) which includes support for the
[@Schedule](https://docs.oracle.com/javaee/6/api/javax/ejb/Schedule.html)
annotation and [ScheduleExpression
API](https://docs.oracle.com/javaee/6/api/javax/ejb/ScheduleExpression.html),
or see [this thread](https://marc.info/?t=106192918700004&r=1&w=2) or [this
link](https://marc.info/?l=tomcat-user&m=106157051231075&w=2).

###
![](https://cwiki.apache.org/confluence/s/en_GB/8100/6ef1ce95c788ac159314a8fa6387047b8d1cc9fb/_/images/icons/macrobrowser/dropdown/anchor.png)
Anchor  
---  
|  | Q18  
---|---  
| Q18  
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.

###
![](https://cwiki.apache.org/confluence/s/en_GB/8100/6ef1ce95c788ac159314a8fa6387047b8d1cc9fb/_/images/icons/macrobrowser/dropdown/anchor.png)
Anchor  
---  
|  | Q19  
---|---  
| Q19  
  
...

###  How do open a file for reading in my webapp?

...

###

Use `ServletContext.getResourceAsStream()`

###
![](https://cwiki.apache.org/confluence/s/en_GB/8100/6ef1ce95c788ac159314a8fa6387047b8d1cc9fb/_/images/icons/macrobrowser/dropdown/anchor.png)
Anchor  
---  
|  | Q20  
---|---  
| Q20  
Can I run Tomcat with the JRE, or do I need the full JDK?

Tomcat 4 requires the full JDK. Tomcat 5.5 onwards will work with a JRE or a
JDK.

###
![](https://cwiki.apache.org/confluence/s/en_GB/8100/6ef1ce95c788ac159314a8fa6387047b8d1cc9fb/_/images/icons/macrobrowser/dropdown/anchor.png)
Anchor  
---  
|  | Q21  
---|---  
| Q21  
Is Tomcat an EJB server? Can I use EJBs with Tomcat?

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

[Apache TomEE](https://tomee.apache.org/apache-tomee.html) is a Java EE
certified distribution built from Tomcat and contains support for EJB, CDI,
JSF, JPA, BeanValidation and Transactions. The goal of TomEE is to maintain
all Tomcat functionality and identity, only adding what is necessary to pass
that Java EE 6 Web Profile TCK. A second distribution, called TomEE Plus, adds
JAX-RS, JAX-WS, JMS and support for the JavaEE Connector Architecture.

###
![](https://cwiki.apache.org/confluence/s/en_GB/8100/6ef1ce95c788ac159314a8fa6387047b8d1cc9fb/_/images/icons/macrobrowser/dropdown/anchor.png)
Anchor  
---  
|  | Q22  
---|---  
| Q22  
Can I access Tomcat's JNDI provider from outside Tomcat?

Not at this time.

###
![](https://cwiki.apache.org/confluence/s/en_GB/8100/6ef1ce95c788ac159314a8fa6387047b8d1cc9fb/_/images/icons/macrobrowser/dropdown/anchor.png)
Anchor  
---  
|  | Q23  
---|---  
| Q23  
Who uses Tomcat in production?

Numerous organizations across various industries all over the world. A full
listing can be found at the
[Wiki](http://wiki.apache.org/tomcat/PoweredBy)There is a
[PoweredBy](/confluence/pages/viewpage.action?pageId=103099576) page in this
wiki.

###
![](https://cwiki.apache.org/confluence/s/en_GB/8100/6ef1ce95c788ac159314a8fa6387047b8d1cc9fb/_/images/icons/macrobrowser/dropdown/anchor.png)
Anchor  
---  
|  | Q24  
---|---  
| Q24  
I'm getting `java.lang.ThreadDeath` exceptions when reloading my webapp.

See [Bugzilla
discussion](https://bz.apache.org/bugzilla/show_bug.cgi?id=26372) of this.

###
![](https://cwiki.apache.org/confluence/s/en_GB/8100/6ef1ce95c788ac159314a8fa6387047b8d1cc9fb/_/images/icons/macrobrowser/dropdown/anchor.png)
Anchor  
---  
|  | Q25  
---|---  
| Q25  
Help! Even though I run shutdown.sh (or shutdown.bat), Tomcat does not stop!

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](/confluence/pages/viewpage.action?pageId=103099265) to determine the
code which started the thread.

###
![](https://cwiki.apache.org/confluence/s/en_GB/8100/6ef1ce95c788ac159314a8fa6387047b8d1cc9fb/_/images/icons/macrobrowser/dropdown/anchor.png)
Anchor  
---  
|  | Q26  
---|---  
| Q26  
How do I debug JSP errors in the Admin web application?

The admin web application that ships was shiped with Tomcat's binary
distribution contains of Tomcat 5.5 and earlier, contained 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\. 
  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\. 
  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\. 
  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\. 
  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\. 
  6. If you haven't already, define an admin user in %CATALINA_HOME%\conf\tomcat-users.xml. 7\. 
  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.

###
![](https://cwiki.apache.org/confluence/s/en_GB/8100/6ef1ce95c788ac159314a8fa6387047b8d1cc9fb/_/images/icons/macrobrowser/dropdown/anchor.png)
Anchor  
---  
|  | Q27  
---|---  
| Q27  
What order do webapps start (or how can I change startup order)?

There is no expected startup order. Neither the Servlet spec nor Tomcat define
one. You can't rely on the apps starting in any particular order.

While the above statement is certainly true, there is a potential
"workaround":  
If you actually have two (or more) apps depending on each other, you may
decide to start multiple services in you server.xml:

![](https://cwiki.apache.org/confluence/s/en_GB/8100/6ef1ce95c788ac159314a8fa6387047b8d1cc9fb/_/plugins/servlet/confluence/placeholder/macro-
icon?name=code) Code Block  
---  
| language | xml  
---|---  
      
    
    <Service name="Webapps1">
      <Connector .../>
    
      <Engine ...>
         <Host appbase="webapps1" ...>
           ...        
         </Host>
      </Engine>
    </Service>
    <Service name="Webapps2">
      <Connector .../>
    
      <Engine ...>
         <Host appbase="webapps2" ...>
           ...        
         </Host>
      </Engine>
    </Service>
      
  
I.e. you split the regular "/webapps" directory into "/webapps1" and
"/webapps2", whereas everything in the former is deployed and started before
the later. The drawback is that you need separate ports for the services.

###
![](https://cwiki.apache.org/confluence/s/en_GB/8100/6ef1ce95c788ac159314a8fa6387047b8d1cc9fb/_/images/icons/macrobrowser/dropdown/anchor.png)
Anchor  
---  
|  | Q28  
---|---  
| Q28  
What's the

...

###  difference between a Valve and Filter?

A Filter lives in the webapp space and its behavior is defined by the Servlet
spec. It will work across all Servlet containers.

...

If you can achieve the desired functionality with a Filter, it is the
preferred way to go.

###
![](https://cwiki.apache.org/confluence/s/en_GB/8100/6ef1ce95c788ac159314a8fa6387047b8d1cc9fb/_/images/icons/macrobrowser/dropdown/anchor.png)
Anchor  
---  
|  | Q29  
---|---  
| Q29  
How do I set system properties at startup?

Set JAVA_OPTS to be something BEFORE calling startupCreate a `setenv.bat` or
before calling catalina.bat. (or you can edit those files, but it isn't
advised) `setenv.sh` file. It is documented in RUNNING.txt.

Example (windows):SET JAVA

![](https://cwiki.apache.org/confluence/s/en_GB/8100/6ef1ce95c788ac159314a8fa6387047b8d1cc9fb/_/plugins/servlet/confluence/placeholder/macro-
icon?name=code) Code Block  
---  
| language | text  
---|---  
title | bin/setenv.bat  
      
    
    SET CATALINA_OPTS='-DpropName=propValue'
      
  
Example (UNIX):export JAVA

![](https://cwiki.apache.org/confluence/s/en_GB/8100/6ef1ce95c788ac159314a8fa6387047b8d1cc9fb/_/plugins/servlet/confluence/placeholder/macro-
icon?name=code) Code Block  
---  
| language | text  
---|---  
title | bin/setenv.sh  
      
    
    export CATALINA_OPTS='-DpropName=propValue'
      
  
Windows service users \- use
[this](http://web.bvu.edu/staff/david/tcservcfg/)— use service configuration
application (e.g. `tomcat9w.exe`).  
  
|  |  | [Go to page
history](https://cwiki.apache.org/confluence/pages/viewpreviousversions.action?pageId=103098964&src=mail&src.mail.product=confluence-
server&src.mail.timestamp=1574647215047&src.mail.notification=com.atlassian.confluence.plugins.confluence-
notifications-batch-plugin%3Abatching-
notification&src.mail.recipient=8aa9809569d423cd016a0413306f00db "Go to page
history")  
---  
---  
| [View
page](https://cwiki.apache.org/confluence/display/TOMCAT/Miscellaneous?src=mail&src.mail.product=confluence-
server&src.mail.timestamp=1574647215047&src.mail.notification=com.atlassian.confluence.plugins.confluence-
notifications-batch-plugin%3Abatching-
notification&src.mail.recipient=8aa9809569d423cd016a0413306f00db&src.mail.action=view)  
---  
  
|  | [Stop watching
space](https://cwiki.apache.org/confluence/users/removespacenotification.action?spaceKey=TOMCAT&src=mail&src.mail.product=confluence-
server&src.mail.timestamp=1574647215047&src.mail.notification=com.atlassian.confluence.plugins.confluence-
notifications-batch-plugin%3Abatching-
notification&src.mail.recipient=8aa9809569d423cd016a0413306f00db&src.mail.action=stop-
watching&jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJ4c3JmOjhhYTk4MDk1NjlkNDIzY2QwMTZhMDQxMzMwNmYwMGRiIiwicXNoIjoiZjQ0NDIzODE4N2FiM2VmM2E3ODY2ZDI5ZTc3MjE3YTRlZWNjOWQ5YTRkZTc0NDViY2M2MzNlY2JiYzIwYzkzZSIsImlzcyI6ImNvbmZsdWVuY2Vfbm90aWZpY2F0aW9uc0FSRUgtWFVEMS1QT1FHLUNTQU8iLCJleHAiOjE1NzUyNTIwMTUsImlhdCI6MTU3NDY0NzIxNX0.6ZQJ3jKRm_AkpRMYJ9UdXnV0rXmUCX9W9AenFkyfbio)
| •  
---|---  
[Manage
notifications](https://cwiki.apache.org/confluence/users/editmyemailsettings.action?src=mail&src.mail.product=confluence-
server&src.mail.timestamp=1574647215047&src.mail.notification=com.atlassian.confluence.plugins.confluence-
notifications-batch-plugin%3Abatching-
notification&src.mail.recipient=8aa9809569d423cd016a0413306f00db&src.mail.action=manage)  
---  
| ![Confluence logo big](cid:footer-desktop-logo)  
---  
This message was sent by Atlassian Confluence 6.15.8  
![](cid:footer-mobile-logo)  
---