Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Dont know how to run servlet from eclipse

843842Oct 16 2008 — edited Nov 5 2008
I am using Eclipse3.4 and Tomcat6.0.18. I use Sysdeo Eclipse Tomcat Launcher plugin. Tomcat working fine in Eclipse.
I put eclipse in D drive and Tomcat is in C drive and workspace for Eclipse is in D drive named JWorks.

Then created new Dynamic Web Project called MyFirstWeb in eclipse.
Then I created one Servlet named Servlet1 in Java Resouce:src folder.

I then saw that in web.xml file has been updated in WebContent->WEB-INF folder for Servlet1 mapping automatically so I did not change it.

My web.xml file is as follows:

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5">
<display-name>MitFirstWeb</display-name>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
<welcome-file>default.html</welcome-file>
<welcome-file>default.htm</welcome-file>
<welcome-file>default.jsp</welcome-file>
</welcome-file-list>
<servlet>
<description></description>
<display-name>Servlet1</display-name>
<servlet-name>Servlet1</servlet-name>
<servlet-class>Servlet1</servlet-class>
</servlet>

<servlet-mapping>
<servlet-name>Servlet1</servlet-name>
<url-pattern>MitFirstWeb/Servlet1</url-pattern>
</servlet-mapping>
</web-app>



Then I started Tomcat server inside the Eclipse and try to open http://localhost:8080/MitFirstWeb/Servlet1
but it shows error

HTTP Status 404 -

--------------------------------------------------------------------------------

type Status report

message

description The requested resource () is not available.

I think I am not running my servlet under webapp of tomcat so it hppens or what?
I dont want to move everthing under webapp folder so is there any way to run my servlet from Eclipse ?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 3 2008
Added on Oct 16 2008
11 comments
252 views