what do these options means in tomcat 7?

on the other day i was installing tomcat 7.0.30 on eclipse juno. i downloaded , extracted zip file containing tomcat 7 . then did new server > add tomcat 7 and gave path to tomcat directory. i right clicked on the tomcat 7 server in eclipse and started it. server started normally. when i opened my browser and typed localhost:8080 it gave me 404 error. i tried 127.0.0.1:8080 but same thing happened. i read few posts and checked my hosts file in c:/windows/system 32/etc directory and it was fine. then finally i saw these options as shown in the image below

under SERVER LOCATION we have 3 radio buttons. when i installed tomcat USE WORKSPACE METADATA option was selected. but when i coincidently selected second option viz. USE TOMCAT INSTALLATION , everything worked fine. i was able to open tomcat manager-gui in my browser.

my question is what do these options means ? why it didnt worked using first option ? how to make it work if first option is to be used ? also when i selected second option it asked me to right click on the server and click on PUBLISH. what does PUBLISH do ? how can we publish a server ? i thought web-apps gets published on server ?

This is really more of an Eclipse question than a Tomcat question, and it's a specialized question even for Eclipse. I don't use WTP (in fact, I loathe it), so even though I use Eclipse, this isn't a dialog I'm familiar with.

Tomcat is designed to work with 2 component collections, designated by CATALINA_HOME and CATALINA_BASE. CATALINA_HOME is the directory that houses the binaries and sharable data. CATALINA_BASE is the directory that defines a particular instance of Tomcat. Thus, for a given version of Tomcat, you can have one Home and multiple Bases.

For most of us, all of the components of CATALINA_HOME and CATALINA_BASE are dumped into a single directory, and the two environment variables will have the same value.

So one of the things that I expect that this dialog allows is setting whether CATALINA_HOME and CATALINA_BASE are, in fact the same directory, and if not, what directories to use with Eclipse.

However, one of the things that makes me so very angry at Eclipse WTP is that it meddles with the basic Tomcat architecture, copying certain (but not all) configuration elements to an alternative Eclipse-specific location. So some of the options on this dialog are probably related to that mechanism as well, and I can't see a clear distinction between the CATALINA_HOME/CATALINA_BASE configuration options and the WTP options, so I can't help on that one.

thanks alot Tim. that was really helpful. how come the tutorials on the internet regarding installing tomcat on eclipse don't mention this crucial option. since without selecting appropriate option tomcat manager does not get opened in browser. should i switch to some old version of eclipse from eclipse juno ? i really want to work in eclipse but the very first step viz insalling tomcat 7 in eclipse became a nightmare. what should i do ? should i switch to netbeans ?

Tim Holloway wrote:Actually, I just download and use the sysdeo Tomcat plugin and ignore the WTP stuff. Like I said, I really, really, really don't like WTP.

hi Tim.
following your path i downloaded and installed sysdeo tomcat plugin. i have got three buttons viz start, stop, restart on eclipse toolbar. i am also able to start server from those buttons. my problem is how do i deploy my project on tomcat ?

when i right click on project and choose run on server, it says that ports are occupied by some other running server instance(i know those are taken by sysdeo plugin). but how do i deploy the project ? there is no option of deploy in sysdeo tomcat manager plugin. i do not want to create war file and deploy . please help ?

I'm afraid that all that "run on server" stuff is part of WTP and doesn't work with the sysdeo plugin. What the sysdeo system effectively does is launch an independent Tomcat but allow you to control it from within Eclipse (and write the console to Eclipse).

The easiest way to test a webapp using sysdeo in Eclipse is to ensure that your project creates either a WAR or an exploded WAR. You should be doing that anyway, because it's not a "real" webapp until it's in WAR form, so no loss there. An exploded WAR is usually sufficient, since you create a WAR file by simply zipping it. And tools such as Maven can make building an exploded WAR with Eclipse a simple task.

Tomcat's deployment system does not require actually copying a WAR (or exploded WAR) into the TOMCAT_HOME/webapps directory. You can reference the exploded WAR that's in your Eclipse project build. Just create a Context file to describe the WAR and its codebase and copy it to the TOMCAT_HOME/conf/Catalina/localhost directory.

Important Tomcat's technique for handling "damaged" webapps is to delete the context file, so keep a master copy in your project!

Here's a sample xml file that I use:

Because I'm using Maven (and m2eclipse) to build the WAR image, the exploded WAR is created in the project's "target" directory and I simply aim Tomcat at it.