Up and running with tomcat and a hello world servlet

Hey everyone,

I am trying to familiarize myself with tomcat and servlets by writing and running a hello world servlet.

I am having a little trouble getting things set up, however. I have a dedicated server, with a virtual host within which I have a public html document directory. Within that directory I have WEB-INF/classes/test.class installed.

So the dir to my servlet is (from root) /home/betaflea/public_html/WEB-INF/classes/test.class

I also have a web.xml file in the WEB-INF directory, the contents of which are:

<web-app>

<servlet>

<servlet-name>test</servlet-name>

<servlet-class>test</servlet-class>

</servlet>

<servlet-mapping>

<servlet-name>test</servlet-name>

<url-pattern>/test</url-pattern>

</servlet-mapping>

</web-app>

Unfortunately, when I go to www.betaflea.com/servlet/test I get a 404 error.

What else do I need to do?

Thanks for any help.

Rye

[1069 byte] By [ryeterrella] at [2007-11-26 15:58:01]
# 1
Is it not possible to install a servlet inside a virtual host directory? Do I *have* to put it inside /usr/java/tomcat-5.5/server/webapps/?Thanks for any tips, I am so lost. :p
ryeterrella at 2007-7-8 22:19:00 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2
Check out your url-pattern<url-pattern>/test</url-pattern>You use /servlet/test, which does not match your url pattern. Change the value in the web.xml to this:<url-pattern>/servlet/test</url-pattern>(or use the url
gimbal2a at 2007-7-8 22:19:00 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...