Nov 18

Quick Tip: When Eclipse just won’t clean up the Tomcat Working Directory

Tag: eclipse, java, tomcatpmularien @ 8:41 pm

I use Eclipse 3.3.x and WTP 2.x for most of my web development. Recently, I’ve been using an Eclipse-managed Tomcat 6 server for running and deploying web applications.

I’ve run into the problem several times when “Clean Tomcat Work Directory…” just doesn’t work. Fortunately, you can manually find the deployment directory and blow away your deployed web application – if you know where to look.

For Eclipse-managed Tomcat installs, look in the following directory to find the Tomcat setup for your workspace:

.metadata\.plugins\org.eclipse.wst.server.core\tmp0

You’ll see the usual conf, logs, temp, webapps directories. Your web application is most likely deployed in the “wtpwebapps” directory – look for it there and remove (delete) it. Tomcat will be happy once again.

Note that the “tmp0″ designation may differ depending on how many servers you have configured in your workspace.

Further Reading

Web Tools Platform 2.0 “New & Noteworthy” discusses the use of these new WTP 2.0 features in more detail.

Similar Posts:

4 Responses to “Quick Tip: When Eclipse just won’t clean up the Tomcat Working Directory”

  1. lumpynose says:

    I’ve made it a point to always click on the servers tab and delete any of my projects from the tomcat server and then after that delete the tomcat server instances, and then add them again. Only takes a few moments but has saved me from the huge irritation of having things not be deployed properly; changes don’t take some times.

  2. mathias says:

    Hi,

    you mentioned that the eclipse server workspace directory “tmp0″ may be different.
    This could also be a “tmp1″, right?

    My problem is: How can I create another second server instance, for example “tmp1″ in Eclipse?
    If you also have a quick tip for this, I would be very happy :-)

  3. pmularien says:

    @Mathias,

    Yes, the number after ‘tmp’ is incremented as you add servers to a particular workspace. There’s nothing preventing you from adding 10 different server instances to a single workspace – just right click on the Servers view and select New > Server.

    Now the obvious question is – how to figure out which server instance matches with which directory? Some server plugins will show the temporary deploymnent directory on the server configuration page (Tomcat, for example, shows the directory path in the ‘Server path’ text box). For most other servers, you have to correlate 2 files located in the org.eclipse.wst.server.core directory: tmp-data.xml and servers.xml.

    tmp-data.xml will contain something like the following:
    <temp-directory age="1" key="4_2_08_3_33_PM1" path="tmp3"/>

    You match the key in there: 4_2_08_3_33_PM1 with the server configuration in the servers.xml file:

    <server hostname="localhost" id="4_2_08_3_33_PM1" name="GlassFish V2" runtime-id="GlassFish V2 Java EE 5" server-type=
    "com.sun.enterprise.jst.server.sunappsrv91" server-type-id="com.sun.enterprise.jst.server.sunappsrv91" timestamp="3">

    Hope that helps!

  4. Eric says:

    HI,
    I have met the problem of the number of tmp**.You are so kind to write the words above.I am using the websphere(in IBM RAD) now.The server has 2 server_instances. First one is itb_obj,and the other is ita_obj. The ita_obj is now running. And ita_obj’s files are in the directory “tmp1″.How can I make them in the directory tmp0? I have tried to uninstalled the itb_obj,I think the tmp0 belongs to itb_obj.But the text of servers.xml and tmp-data.xml can not be modified automaticlly.Could you tell me some detail?

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="">