Bookmark Topic Watch Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Some of the most frequently asked questions regarding Servlet development on Tomcat. Some questions may also be answered in the ServletsFaq and the JspFaq.

As any other page in this wiki, the page is editable by anyone, so don't hesitate to add useful stuff. Click on "edit this page" below to contribute.


The Official Tomcat Wiki answers many questions, and is an excellent starting point for further research: http://wiki.apache.org/tomcat/HowTo

It also lists the various Tomcat versions and the Servlet/JSP version they support: http://wiki.apache.org/tomcat/TomcatVersions. Some more information about version differences can be found at http://tomcat.apache.org/whichversion.html


What are the differences between a web server, a servlet container and an application server? What differentiates Tomcat, JBoss and Geronimo? Is Tomcat an Application Server?

See: WebVsApplicationServer

Also see this forum discussion https://coderanch.com/t/87730/Tomcat/tomcat-Application-Server



How to set CATALINA_HOME in Tomcat

Here's a previous discussion, on how to set CATALINA_HOME - Set CATALINA_HOME



How to change the JDK version used by Tomcat

Tomcat (startup scripts) looks for the presence of JAVA_HOME environment variable to pick up the Java version to use. You can set the JAVA_HOME appropriately to point to the version of Java, you want Tomcat to use.

Some of the previous discussions, in our Tomcat Forum, on how this can be done:

  • Change Tomcat JDK version




  • Setting up the Tomcat Manager Application

    The Tomcat Manager application is essential to listing and controlling the contexts (web apps) managed by the container. The Manager application ships with Tomcat, but you must create a privileged user in order to user the application.

    Open the file tomcat-users.xml file in Tomcat's conf folder as add the following line if it is not already there:



    The add the following:



    Be sure to substitute appropriate usernames and passwords.

    Restart Tomcat and hit the URL:



    You should see the list of running web applications.



    Tomcat Admin Application

    Starting Tomcat 5.5, the "admin" application in Tomcat is not shipped by default. Tomcat Admin Application is a previous discussion on how to download and deploy the admin application.



    How to define a context name in Tomcat

    One of the frequently asked questions in Tomcat is - how to define a custom context name for a web application deployed in Tomcat. For example, if you are deploying a war named MyApp and want it to be available at http://localhost:8080/HelloWorld instead of http://localhost:8080/MyApp, then you'll have to configure a context name for that war. Here are some of the previous discussions which explain, how to do this:


  • Tomcat 6 - How to define context name
  • Tomcat - Which files to configure for context name




  • 404 Errors


  • Why do I get 404 not found?
    • You are requesting a page or servlet that's not there. Check whether you are referring to an incorrect file location or have made a typo in a URL. Calling an external resource while on a computer that has no access to the Internet can also cause this.
  • What is the invoker servlet?




  • How do I see what requests are being made ?


  • Edit the file conf/server.xml
  • Uncomment the following lines




  • Is it possible to embed Tomcat in a desktop application, so it can be used without having to be installed as a separate server ?

    Yes, that's possible. You can download a special embedding version of Tomcat, which is smaller than the standard distribution, but the normal version will do as well. All the details can be found in this article.

    Update: Some of the Tomcat APIs have changed since that article was written; see this writeup for an example that works with Tomcat 7 and (presumably) newer.


    How do I enable the EL (Expression Language) for Tomcat 5?

    In order for Tomcat 5 to automatically enable the Expression Language in your JSP pages, your app must be declared as a Servlets 2.4 web application in the application's web.xml deployment descriptor.

    Here's how:




    How can I control a Tomcat server on a remote machine, e.g. to restart a web app or Tomcat itself?

    Tomcat comes with a number of Ant tasks that can be used to control it from afar. Some documentation about that is here.


    ProxyApacheHttpdAndTomcat


    Tomcat crashes with a 'java.lang.OutOfMemoryError: PermGen space' message. What gives?

    Some discussion and proposed solutions can be found in a couple of Saloon threads here and here. A couple of articles discussing the issue -and proposing solutions- can be found at http://frankkieviet.blogspot.de/2006/10/classloader-leaks-dreaded-permgen-space.html and http://frankkieviet.blogspot.de/2006/10/how-to-fix-dreaded-permgen-space.html.


    Tomcat as service

    If you want to add or customize Tomcat as a service on Windows, then follow this.

    Some previous discussions in our Tomcat Forum about installing Tomcat as a service:

  • Start Tomcat as service




  • What does "The Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path" log message mean
     
    brevity is the soul of wit - shakepeare. Tiny ad:
    a bit of art, as a gift, the permaculture playing cards
    https://gardener-gift.com
      Bookmark Topic Watch Topic
    • New Topic