aspose file tools
The moose likes IDEs, Version Control and other tools and the fly likes Servlet not running in eclipse Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Engineering » IDEs, Version Control and other tools
Reply Bookmark "Servlet not running in eclipse" Watch "Servlet not running in eclipse" New topic
Author

Servlet not running in eclipse

thejwal pavithran
Ranch Hand

Joined: Feb 11, 2012
Posts: 113
Hi,

I just started basic servlet programming. i am using tomcat and eclipse indigo.

I have created a dynamic web project and added a new servlet with name NewServlet to the project and copied the servlet-api.jar to the lib in the WEB-INF folder. and created a an html file named c.html in the WEB-INF folder. I have edited the web.xml and made the welcome file value c.html. now when i run using run on server option, the c.html file is not getting displayed the url is http://localhost:8080/p3/NewServlet. what might be the mistake?


on job hunt
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 35224
    
    7
and created a an html file named c.html in the WEB-INF folder.

That's your problem - nothing that is inside WEB-INF will ever be served to the client directly. You need to move the file one directory level up (which is the root of web app's directory hierarchy).


Android appsImageJ pluginsJava web charts
thejwal pavithran
Ranch Hand

Joined: Feb 11, 2012
Posts: 113
Sorry my mistake. It is inside the folder called web content. which now has META-INF,WEB-INF and NewFile.html
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 35224
    
    7
Some more points:
and added a new servlet with name NewServlet to the project

http://localhost:8080/p3/NewServlet looks like it should run this servlet. The URL for having the welcome file served would be http://localhost:8080/p3/ (assuming that "p3" is somehow the name of the web app, which I have no idea about how that works in Eclipse).

and copied the servlet-api.jar to the lib in the WEB-INF folder

You should not do that. The Servlet API jar files are part of the servlet container; they must not be part of the web app as well.
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Servlet not running in eclipse
 
Similar Threads
HTTP Status 404 The requested resource is not available
Run Servlet In Eclipse
JBOSS 6.0 Error While Starting Up..
Need Help On A Maven WAR Build Issue
unable to start servlet