Yes, the problem had been the wrong URL, misconfigured web.xml!
I should have written "/MyTestServlet2", sorry for having taken your time with a dumb question. ;-)
However, the class is available without being packaged.
Cheers, -- Vlad.
David Smith wrote:
That's most likely a problem. You need to package your classes which has been a requirement since at least Tomcat 4 and I believe even back into the later Tomcat 3 versions.
Also, the url pattern is relative to the webapp, not tomcat. As written, you'd have to use this URL to get the page:
http://outpost:8080/mytest2/mytest2/MyTestServlet2
--David
Vladislav Y. Ryabyshkin wrote:
Thank you for reply!
I want to have access to the servlet via "http://outpost:8080/mytest2/MyTestServlet2".
The servlet is compiled on the local machine, in that very directory where it is stored and it is not part of any package.
Below are the contents of webapps/mytest2/WEB-INF/web.xml: <?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<display-name>My Test Servlet2</display-name> <description> My Test Servlet2 </description>
<servlet> <servlet-name>MyTestServlet2</servlet-name> <servlet-class>MyTestServlet2</servlet-class> </servlet>
<servlet-mapping> <servlet-name>MyTestServlet2</servlet-name> <url-pattern>/mytest2/MyTestServlet2</url-pattern> </servlet-mapping>
</web-app> .
Best regards, Vlad.
Schalk Neethling wrote:
What is the URL by which you are trying to call up the servlet?
Vladislav Y. Ryabyshkin wrote:
Hello!
Hope I am not sending a faq.
I run Tomcat 4.1.18, JVM 1.4.1_02-b06. It works, I can view examples servlets.
But I cannot make a hand-made Hello World servlet available via URL!
I created a directory webapps/mytest2/WEB-INF/classes, containing the MyTestServlet2.class (it is this Hello World class) and I have the webapps/mytest2/WEB-INF/web.xml file and an entry in conf/server.xml.
Still this is what I get from the logs:
...
2004-07-29 12:52:54 StandardContext[/mytest2]: Mapping contextPath='/mytest2' with requestURI='/mytest2/MyTestServlet2' and relativeURI='/MyTestServlet2'
2004-07-29 12:52:54 StandardContext[/mytest2]: Trying exact match
2004-07-29 12:52:54 StandardContext[/mytest2]: Trying prefix match
2004-07-29 12:52:54 StandardContext[/mytest2]: Trying extension match
2004-07-29 12:52:54 StandardContext[/mytest2]: Trying default match
2004-07-29 12:52:54 StandardContext[/mytest2]: Mapped to servlet 'default' with servlet path '/MyTestServlet2' and path info 'null' and update=true
...
And a 404-Error.
There is a mystery though.
If I construct an index.jsp with a
<jsp:forward page="/mytest2/MyTestServlet2"/>, I get it working ('extension match' in the log succeeds). But I don't want a JSP, I need a servlet directly-mapped!
Can anyone please suggest what do I do wrong? Something silly perhaps, but it took plenty of time, and I am at a loss.
I'd appreciate any help, good luck, Vlad.
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
