Results 1 to 4 of 4
  1. #1
    s3ib is offline Member
    Join Date
    Dec 2010
    Posts
    18
    Rep Power
    0

    Default How eclipse and Tomcat work together?

    I have a problem understanding the concepts of how Eclipse and Tomcat work together.
    Let's say I have managed to get Tomcat into servers in my eclipse and its up and running. Now I make a new Dynamic Web Project and make only one servlet in it(no jsp-s, html-s, databases or anything else).
    First question: I'm not able to find a web.xml file anywhere on the left pane when i explore my project. Should I create it manually or is it somewhere? Anyway when i run my web project through eclipse it opens an integrated browser window that says Error 404.

    Second question: Where does eclipse but the class files and what kind of a structure Eclipse uses?
    When I manually make a web app i make folder under web apps and in this folder there will be the web-inf folder and classes folder and so on. When i do a project in eclipse then nothing will apear in tomcat webapps folder. Files all appear in my workspace folder but the structure how they are put there is not like that. And how will Tomcat find the files in my workproject. Is there an extra file somewhere that leads Tomcat to my workspace?

    In conclusion i have a real hard time understanding the concept of how Eclipse and Tomcat work together, how much is done automatically and how much do I have to do manually. I havent found a source that would explain all this so that I could understand.

  2. #2
    go4soumya is offline Member
    Join Date
    Oct 2010
    Posts
    32
    Rep Power
    0

    Default

    hello s3ib,

    I've been working with eclipse and tomcat for quite a long time and I find my web.xml in the WEB-INF sub-folder of the WebContent folder.

    When you are running your web project through eclipse it'll show Error 404, because in the web.xml file, the welcome files are usually set to some default names like index.html, home.html, etc which is definitely not what you are running!

  3. #3
    s3ib is offline Member
    Join Date
    Dec 2010
    Posts
    18
    Rep Power
    0

    Default

    I got it working now and i'm not sure what I did. More precisely i'm not sure what i did wrong before.
    Even if i make a windows search in my workspace there is no web.xml file.

    But as I can understand(i might be wrong and correct me if I am) i dont really need web.xml when i have correct annotations on my servlets that do the url mapping(for example @WebServlet("/subscriber")). And Eclipse puts those annotations there itself.

    Still, thanks for your reply :)

  4. #4
    go4soumya is offline Member
    Join Date
    Oct 2010
    Posts
    32
    Rep Power
    0

    Post

    hi s3ib,

    Good to hear that u got it working now...

    But as I can understand(i might be wrong and correct me if I am) i dont really need web.xml when i have correct annotations on my servlets that do the url mapping(for example @WebServlet("/subscriber")). And Eclipse puts those annotations there itself.
    You are very correct, but sometimes you may need to change the contents of web.xml manually, like setting the welcome page, that apart sometimes refactoring of servlets doesnot reflect in web.xml, and in those cases you may need to do certain mappings manually. Anyways, keep working...there's a lot u'll learn!

Similar Threads

  1. Tomcat does not work with my applications
    By pjava in forum Java Servlet
    Replies: 0
    Last Post: 12-31-2010, 12:23 PM
  2. tomcat & eclipse
    By waqar100 in forum Eclipse
    Replies: 2
    Last Post: 06-26-2010, 02:39 AM
  3. Eclipse and Tomcat
    By kendan in forum Eclipse
    Replies: 4
    Last Post: 04-03-2009, 01:59 PM
  4. eclipse with tomcat
    By nileshchavan in forum Eclipse
    Replies: 2
    Last Post: 06-23-2008, 12:25 PM
  5. Tomcat In Eclipse - Sysdeo Tomcat Plug-in
    By JavaForums in forum Eclipse
    Replies: 1
    Last Post: 02-13-2008, 10:33 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
  •