Deploy Servlet

i start to learn servlet.

i am using tomcat 6.0.

first i put a class file (Page1.class) int to ../WEB-INF/classes/directory and i created Appropriate xml file and i saved into ../WEB-INF directory.

but when i try to load using this URL: http://localhost:8080:servlet/Page1 i can't acess this thing.tomcat says object not found.

how is it?

how can i solve this problem?

-thanks-

[422 byte] By [jeyrama] at [2007-11-27 10:10:36]
# 1

> http://localhost:8080:servlet/Page1

Is this a typo or is this actually the URL? And you've not specified your webapp. Where are you putting it?

This might help: http://nogoodatcoding.googlepages.com/deployingaservletontomcat

nogoodatcodinga at 2007-7-28 15:07:34 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2

sorry small mistake:

URL: http://localhost:8080/servlet/Page1

Page1 indicate ->Page1.class

i put this servlet inside the tomcat directory

that's mean

Installation directory\webapps\ROOT\WEB-INF\classes\Page1.class

jeyrama at 2007-7-28 15:07:34 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 3

Did you see the URL to my page I posted earlier? It covers most of these issues. If you've not, please read that first before posting more queries, since you'll probably get the answer there. Don't really feel like repeating myself :)

1. Since you're putting it under ROOT ( not recommended, you should create your own webapp ), you do not need to create a web.xml, it's already present.

2. What have you entered into the web.xml you've created? Have you mapped the servlet to any URL?

3. The URL you're currently trying to access is using the Invoker servlet that is in-built and mapped to this URL. With Tomcat 5.5, it was commented out by default, so this URL wouldn't work. I dont' know about 6 but it's probably the same. You should make a mapping for the servlet.

4. Are you able to run the other servlets? The examples that are bundled with Tomcat?

nogoodatcodinga at 2007-7-28 15:07:34 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...