Results 1 to 6 of 6
  1. #1
    SiliconWolf is offline Member
    Join Date
    Sep 2010
    Posts
    6
    Rep Power
    0

    Default Tomcat autoDeploy problem

    I'm a longtime PHP developer just getting started with JSP, and I seem to be spending only 10% of my time writing code and the other 90% messing around with Tomcat's configuration files.

    I want to have a single web application on my site, with lots of directories inside it:

    /dir1
    /dir1/subdir1
    /dir1/subdir2
    /dir2

    etc.

    I need these to all be part of the SAME application. However, when I first got started, I had < Host ... autoDeploy="true" > set in server.xml. Tomcat then tried to be helpful and created new applications for each of my subdirectories, which is not what I wanted. Now I can't, e.g., include a file from /dir1 in /dir2/index.jsp because Tomcat thinks they're separate applications.

    I turned autoDeploy off for all my sites once I figured this out, but it was too late for some of them. They're already "deployed" (though they really weren't applications, just dirs I created and put an index.jsp into).

    The question is, how do I merge all these applications back into one? I can't find any settings in any of the config files (server.xml, context.xml, etc.) that tells Tomcat that these are separate applications. I tried deleting everything in Tomcat 6.0/work and that didn't help. It must be saving this information somewhere, but where?

    FYI, I tried using the Tomcat Manager app to fix this, and can't get that to work either (separate issue related to the fact that I'm using a few different virtual hosts). Is there any way to undo what autoDeploy did without having to use the Manager?

  2. #2
    travishein's Avatar
    travishein is offline Senior Member
    Join Date
    Sep 2009
    Location
    Canada
    Posts
    684
    Rep Power
    6

    Default

    in tomcat, every folder within the TOMCAT_HOME/webapps folder is its own individual web application usually. These are accessed via a 'context' path. For example, if you have /dir1/ then YOURSERVER:8080/dir1/* is going to get routed to the dir1/ webapp.

    Now, there is an implicit "/" application context. this is the webapp folder named "ROOT"

    so if you were to shut off your tomcat, then use a file explorer to relocate the dir1/folder1, dir2/ etc from the webapps folder into the ROOT/dir1 and so on, and then make it so that the only folder in the webapps folder was ROOT and then adopt the convention of creating all future folders and files inside this webapps/ROOT/ folder, then this should achieve what it is you are looking to do ,where every path is mapped into the same webapp.

  3. #3
    SiliconWolf is offline Member
    Join Date
    Sep 2010
    Posts
    6
    Rep Power
    0

    Default

    I did move all my subdirectories into ROOT, but they don't work. The autoDeploy feature saw them in a previous location and created some behind-the-scenes Context entries for them. Now, when I try to access something like http://www.example.com.local/dir1 * it gives a 404, even though there is a directory ROOT/dir1. Pages like ROOT/xyz.jsp work fine when I run http://www.example.com.local/xyz.jsp, but any subdirectories give 404s if I accessed their URLs before I turned off the auto-deploy. If I create a new directory with a name I never used before, like ROOT/newdir, it works when accessed at http://www.example.com.local/newdir/.

    How can I find the hidden Context entries and get rid of them, so Tomcat will consider these directories to be part of the ROOT webapp? I don't see these Context entries anywhere in any of the files in the Tomcat install directory or in my WEB-INF or META-INF. It's like it remembers them by magic, even when I shut down Tomcat and restart it.

    * I'm using virtual hosts, with URLs like www.somesite.com.local instead of localhost, and my files are in different places on my hard drive, outside the usual TOMCAT_HOME/webapps.

  4. #4
    travishein's Avatar
    travishein is offline Senior Member
    Join Date
    Sep 2009
    Location
    Canada
    Posts
    684
    Rep Power
    6

    Default

    oh, these context.xml files get placed into the TOMCAT_BASE/conf/Catalina/$VIRTUALHOSTNAME

    for example, dir1/ webapp on the default 'localhost' virtaualhost would be conf/Catalina/localhost/dir1.xml

  5. #5
    SiliconWolf is offline Member
    Join Date
    Sep 2010
    Posts
    6
    Rep Power
    0

    Default

    I don't have any files like that. The only files in TOMCAT_BASE/conf/Catalina/(site_name)/ are manager.xml and host-manager.xml which I put there when I was trying to get the Tomcat Manager to work. Tomcat hasn't ever created any files in that directory on its own since I've been using it.

    The only files I can find which Tomcat has created are in the TOMCAT_BASE/work/ directory, and deleting those has no effect on the deployment status of any applications. If I delete them, they just come right back when I restart Tomcat.

  6. #6
    SiliconWolf is offline Member
    Join Date
    Sep 2010
    Posts
    6
    Rep Power
    0

    Default

    UPDATE:

    I never did figure out how to get rid of the hidden context elements. It seems they're supposed to go into conf/Catalina/<vhost_name> but they weren't in there, so I couldn't delete them.

    I ended up having to reinstall Tomcat to fix it. I made sure to keep autoDeploy set to false this time to avoid a repeat of the problem.

Similar Threads

  1. tomcat problem.....
    By munish in forum NetBeans
    Replies: 2
    Last Post: 09-03-2009, 12:49 PM
  2. Tomcat Problem
    By sanjeevtarar in forum Java Servlet
    Replies: 3
    Last Post: 04-16-2008, 12:53 PM
  3. tomcat problem
    By osval in forum New To Java
    Replies: 2
    Last Post: 07-29-2007, 09:13 PM
  4. Tomcat problem
    By Peter in forum Advanced Java
    Replies: 2
    Last Post: 06-29-2007, 11:43 AM
  5. Problem with tomcat and jboss
    By Alan in forum Eclipse
    Replies: 3
    Last Post: 05-08-2007, 07:18 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •