Easy to Learn Java: Programming Articles, Examples and Tips

Start with Java in a few days with Java Lessons or Lectures

Home

Code Examples

Java Tools

More Java Tools!

Java Forum

All Java Tips

Books

Submit News
Search the site here...
Search...
 
Search the JavaFAQ.nu
1000 Java Tips ebook

1000 Java Tips - Click here for the high resolution copy!1000 Java Tips - Click here for the high resolution copy!

Java Screensaver, take it here

Free "1000 Java Tips" eBook is here! It is huge collection of big and small Java programming articles and tips. Please take your copy here.

Take your copy of free "Java Technology Screensaver"!.

How to Tomcat 5? Part 2

JavaFAQ Home » Java Tools Go to all tips in Java Tools


Bookmark and Share

There are only 3 things likely to go wrong during a stand-alone Tomcat installation

In my previous article I described the Tomcat installation for single user. It is good if you run Tomcat server on your very own machine. But now days when computers are so powerful, we often share an application amongst many users.

How do we install one Tomcat server to share it between many users?

Normally after installation of Tomcat for single user you get such directory structure under $CATALINA_HOME directory:

bin - contains startup and binary files
common - contains all the external libraries which are used by Tomcat, not Tomcat classes here, look at server directory
    common/classes
    common/endorsed
    common/i18n
    common/lib

conf - all major configuration files are here
logs - here you find "famous" catalina.out log file and saved previous
    catalina.out and more logs, like manager.log, admin.log, host-manager.log
server - here Tomcat class files, packed in jar files and plus configuration files
    for host-manager and manager. Who are that? Read later
shared - here shared classes should be
temp - place for some temp things... Do not know exactly what is it.
    On my machine bugzilla37035-safeToDelete.tmp file with 0 bytes length here.
webapps - place where your web applications are/will be.
work - here Tomcat will place class files after the compilation. As you probably know,
    Tomcat compiles first JSP pages into servlet java code and then compiles them into
    class files. That's why it names servlet container, not JSP container Smile

Now when you got an overview on Tomcat structure we are ready to go further.

Tomcat has the variable $CATALINA_BASE which is in case of single user is equal to $CATALINA_HOME. Just add the argument "-Dcatalina.base=$CATALINA_BASE" to startup file and  $CATALINA_BASE variable must contain files for 'personal' Tomcat instance.

As you can probably assume sharing Tomcat between multiple users requires that every use can have own configuration and own applications.

Usage of this argument will force Tomcat  to use relative references for files in the following directories based
on the value of $CATALINA_BASE instead of $CATALINA_HOME:

* conf - Server configuration files (including server.xml)

* logs - Log and output files

* shared - For classes and resources that must be shared across all web applications

* webapps - Automatically loaded web applications

* work - Temporary working directories for web applications

* temp - Directory used by the JVM for temporary files (java.io.tmpdir)

Exactly what you need to get freedom and feel free from another guys Smile

If you do not pass the "-Dcatalina.base=$CATALINA_BASE" argument to the startup command, $CATALINA_BASE will default to the same value as $CATALINA_HOME, which means that the same directory is used for all relative path resolutions.

For troubleshooting of Tomcat server installation please look at Troubleshooting section below

************************************************************

The administration and manager web applications, which are defined in the $CATALINA_BASE/conf/Catalina/localhost/admin.xml

and

$CATALINA_BASE/conf/Catalina/localhost/manager.xml files, will not run in that configuration, unless either:
    - The path specified in the docBase attribute of the Context element is made
        absolute, and replaced respectively by $CATALINA_HOME/server/webapps/admin
        and $CATALINA_HOME/server/webapps/manager

    - Both web applications are copied or moved to $CATALINA_BASE,
        and the path specified in the docBase attribute of the Context
        element is modified appropriately.

    - Both web applications are disabled by removing
        $CATALINA_BASE/conf/Catalina/localhost/admin.xml
        and

 

        $CATALINA_BASE/conf/Catalina/localhost/manager.xml.================

Troubleshooting

================There are only really 3 things likely to go wrong during the stand-alone Tomcat install:

(1) The most common hiccup is when another web server (or any process for that matter) has laid claim to port 8080. This is the default HTTP port that Tomcat attempts to bind to at startup. To change this, open the file:

    $CATALINA_HOME/conf/server.xml

and search for '8080'. Change it to a port that isn't in use, and is greater than 1024, as ports less than or equal to 1024 require superuser access to bind under UNIX.

Restart Tomcat and you're in business. Be sure that you replace the "8080" in the URL you're using to access Tomcat. For example, if you change the port to 1977, you would request the URL http://localhost:1977/ in your browser.

(2) An "out of environment space" error when running the batch files in Windows 95, 98, or ME operating systems.

Right-click on the STARTUP.BAT and SHUTDOWN.BAT files. Click on "Properties", then on the "Memory" tab. For the "Initial environment" field, enter in something like 4096.

After you click apply, Windows will create shortcuts which you can use to start and stop the container.

(3) The 'localhost' machine isn't found. This could happen if you're behind a proxy. If that's the case, make sure the proxy configuration for your browser knows that you shouldn't be going through the proxy to access the "localhost".

In Netscape, this is under Edit/Preferences -> Advanced/Proxies, and in Internet Explorer, Tools -> Internet Options -> Connections -> LAN Settings.

*************************************************************

Disclaimer: English is not native language for me and I appreciate if you correct my errors in a friendly way Smile


 Printer Friendly Page  Printer Friendly Page
 Send to a Friend  Send to a Friend

.. Bookmark and Share

Search here again if you need more info!
Custom Search



Home Code Examples Java Forum All Java Tips Books Submit News, Code... Search... Offshore Software Tech Doodling

RSS feed Java FAQ RSS feed Java FAQ News     

    RSS feed Java Forums RSS feed Java Forums

All logos and trademarks in this site are property of their respective owner. The comments are property of their posters, all the rest 1999-2006 by Java FAQs Daily Tips.

Interactive software released under GNU GPL, Code Credits, Privacy Policy