Results 1 to 10 of 10
  1. #1
    voipp is offline Member
    Join Date
    Oct 2013
    Posts
    51
    Rep Power
    0

    Unhappy developing servlets in "Eclipse for ee"

    Hello!
    I have made simple servlet called FooServ in Eclipse for ee. It runs well in both ide built-in browser and chrome. But i'm confused about the way it works : no file FooServ found in Tomcat 7.0/webapps directory. So, how does Tomcat able to run my servlet(when i run servlet in chrome not ide) ?
    Last edited by voipp; 12-02-2013 at 08:17 PM.

  2. #2
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    4,280
    Rep Power
    6

    Default Re: developing servlets in "Eclipse for ee"

    A servlet is a class, so it would be in WEB-INF/classes somewhere.

    You know basic Java I hope, such as what the classpath is. Otherwise web development is going to be one huge frustrating mystery to you.
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

  3. #3
    voipp is offline Member
    Join Date
    Oct 2013
    Posts
    51
    Rep Power
    0

    Default Re: developing servlets in "Eclipse for ee"

    Quote Originally Posted by gimbal2 View Post
    A servlet is a class, so it would be in WEB-INF/classes somewhere.

    You know basic Java I hope, such as what the classpath is. Otherwise web development is going to be one huge frustrating mystery to you.
    yes, my servlet class is in WEB-INF/classes in project directory.
    Java interpreter uses classpath to find classes to run, by theirs paths, lol. How does Tomcat do that?
    Perhaps IDE wrote parametrs to Tomcat so it knows paths

  4. #4
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,185
    Rep Power
    20

    Default Re: developing servlets in "Eclipse for ee"

    Is the webapp being deployed to the tomcat/webapps directory?
    If not then how are you launching your web app?

    If it is through Eclipse then the default (IIRC) is to use a deployment directory somewhere inside your workspace, with a fairly obscure path.
    You can find out by right clicking on the webapp in the servers tab and selecting to open the directory it's in.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  5. #5
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    4,280
    Rep Power
    6

    Default Re: developing servlets in "Eclipse for ee"

    Quote Originally Posted by Tolls View Post
    Is the webapp being deployed to the tomcat/webapps directory?
    If not then how are you launching your web app?

    If it is through Eclipse then the default (IIRC) is to use a deployment directory somewhere inside your workspace, with a fairly obscure path.
    That's specific to the built-in Tomcat deployer though ;) By default Eclipse will "hijack" a Tomcat installation and update its configuration files to point to an external directory somewhere. Not the most understandable way, but it works and doesn't damage existing webapps that may be there if you make the mistake of using a Tomcat installation that was already used for other purposes.


    Quote Originally Posted by voipp View Post
    yes, my servlet class is in WEB-INF/classes in project directory.
    Java interpreter uses classpath to find classes to run, by theirs paths, lol. How does Tomcat do that?
    It follows the Java Enterprise Edition standard for web application deployment, which you should know about if you are doing the smart thing and studying a book or at least read the Tomcat manual (you know - know how the tools you're using work?). WEB-INF/classes and all libraries in WEB-INF/lib will be on the application's classpath.
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

  6. #6
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,185
    Rep Power
    20

    Default Re: developing servlets in "Eclipse for ee"

    Quote Originally Posted by gimbal2 View Post
    That's specific to the built-in Tomcat deployer though ;) By default Eclipse will "hijack" a Tomcat installation and update its configuration files to point to an external directory somewhere. Not the most understandable way, but it works and doesn't damage existing webapps that may be there if you make the mistake of using a Tomcat installation that was already used for other purposes.
    Well, yes, but I got the impression the OP was actually looking for the class file that Tomcat was using and, because there was nothing in the webapps directory, was getting confused. If it was launched through a basic Eclipse server setup then it wouldn't be in there, it would be in this other directory, which is what is used for that purpose.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  7. #7
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    4,280
    Rep Power
    6

    Default Re: developing servlets in "Eclipse for ee"

    I quote: "yes, my servlet class is in WEB-INF/classes in project directory." I interpreted that myself as that the class file was already found, but it wouldn't be the first time that there are mixed signals :)
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

  8. #8
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,185
    Rep Power
    20

    Default Re: developing servlets in "Eclipse for ee"

    I interpreted that as "in the project directory in Eclipse"...:)
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  9. #9
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    4,280
    Rep Power
    6

    Default Re: developing servlets in "Eclipse for ee"

    *facepalm*

    Of course, the build artifacts created BEFORE deployment! Jebus I'm an idiot. Methinks the only answer here is "actually read the tomcat manual and learn how it all works".
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

  10. #10
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,185
    Rep Power
    20

    Default Re: developing servlets in "Eclipse for ee"

    I don't know, because when you said that you thought they meant "in the tomcat webapps directory" I thought I was the idiot...:)
    Please do not ask for code as refusal often offends.

    ** This space for rent **

Similar Threads

  1. Servlets/JSP Tomcat Eclipse
    By rookiecoder in forum Java Servlet
    Replies: 1
    Last Post: 11-05-2012, 11:52 AM
  2. Servlets class not teaching servlets
    By tsky in forum Java Servlet
    Replies: 5
    Last Post: 04-26-2011, 11:47 PM
  3. servlets in eclipse webxml
    By simo_mon in forum Java Servlet
    Replies: 1
    Last Post: 11-07-2009, 01:26 AM
  4. servlets in eclipse
    By simo_mon in forum Java Servlet
    Replies: 1
    Last Post: 10-04-2009, 12:30 PM
  5. Developing for Mac
    By jmds in forum NetBeans
    Replies: 0
    Last Post: 11-25-2007, 08:55 PM

Posting Permissions

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