Hi Tim and John, Thanks very much for your help chaps. I now have my servlet working (and it's only taken me 2 days!). Curiously, the only way it worked was by doing the 'quick and dirty' method of un-commenting the servlet-mapping for invoker. Before this, with the servlet mapping added to my app's web.xml file, it still didn't work. It's evening here, so I think I'll go out and celebrate with a 'golden gallon'...
Cheers Andy Wickson ----- Original Message ----- From: "Tim Moore" <[EMAIL PROTECTED]> To: "Tomcat Users List" <[EMAIL PROTECTED]> Sent: Friday, October 18, 2002 7:08 PM Subject: RE: Beginner's config problem with TomCat 4.1.12 on Win2K The servlet-mapping element needs to go after the servlet element, not inside of it. -- Tim Moore / Blackboard Inc. / Software Engineer 1899 L Street, NW / 5th Floor / Washington, DC 20036 Phone 202-463-4860 ext. 258 / Fax 202-463-4863 > -----Original Message----- > From: Andy Wickson [mailto:andy@;awtech.co.uk] > Sent: Friday, October 18, 2002 1:56 PM > To: Tomcat Users List > Subject: Re: Beginner's config problem with TomCat 4.1.12 on Win2K > > > Hi Tim, > > Thanks for your input. > When I try the added lines to the web.xml file I get the > following exception when re-starting TC: > > 18-Oct-2002 18:51:58 org.apache.commons.digester.Digester error > SEVERE: Parse Error at line 12 column -1: Element "servlet" > does not allow "serv let-mapping" here. > org.xml.sax.SAXParseException: Element "servlet" does not > allow "servlet-mapping " here. > at org.apache.crimson.parser.Parser2.error(Parser2.java:3160) > at > org.apache.crimson.parser.ValidatingParser$ChildrenValidator.consume( > ValidatingParser.java:349) > at > org.apache.crimson.parser.Parser2.maybeElement(Parser2.java:1317) > at > org.apache.crimson.parser.Parser2.content(Parser2.java:1779) > at > org.apache.crimson.parser.Parser2.maybeElement(Parser2.java:1507) > > Here is the web.xml file in case I've messed that up. > > <?xml version="1.0" encoding="ISO-8859-1"?> > <!DOCTYPE web-app > PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN" > "http://java.sun.com/j2ee/dtds/web-app_2.2.dtd"> > > <web-app> > <servlet> > <!-- Servlet alias --> > <servlet-name>Registration</servlet-name> > <!-- Fully qualified Servlet class--> > <servlet-class>GreetingServlet</servlet-class> > <servlet-mapping> > <servlet-name>GreetingServlet</servlet-name> > <url-pattern>/GreetingServlet</url-pattern> > </servlet-mapping> > </servlet> > </web-app> > > > Regards > Andy Wickson > > ----- Original Message ----- > From: "Tim Moore" <[EMAIL PROTECTED]> > To: "Tomcat Users List" <[EMAIL PROTECTED]> > Sent: Friday, October 18, 2002 6:27 PM > Subject: RE: Beginner's config problem with TomCat 4.1.12 on Win2K > > > What URL are you trying to load? > > If it's something like http://server/myDir/servlet/myClass, > then that won't work in an out-of-the-box Tomcat 4.1.12. The > servlet that handles requests with /servlet in the path > (called the "invoker" servlet) is disabled by default due to > potential security issues. You'll need to map your servlet to a URL. > > For example, add this to your web.xml: > <servlet-mapping> > <servlet-name>myClass</servlet-name> > <url-pattern>/myClass</url-pattern> > </servlet-mapping> > > And then go to http://server/myDir/myClass > > Assuming that your servlet is declared correctly in web.xml > and is named "myClass" this should work. > > -- > Tim Moore / Blackboard Inc. / Software Engineer > 1899 L Street, NW / 5th Floor / Washington, DC 20036 > Phone 202-463-4860 ext. 258 / Fax 202-463-4863 > > > > -----Original Message----- > > From: Andy Wickson [mailto:andy@;awtech.co.uk] > > Sent: Friday, October 18, 2002 1:17 PM > > To: [EMAIL PROTECTED] > > Subject: RE: Beginner's config problem with TomCat 4.1.12 on Win2K > > > > > > Hi, > > > > Thanks for the quick response. > > I tried putting the following code into server.xml and re-started > > TomCat: > > > > <Context path="/myDirectory" docBase="myDirectory" debug="0" > > reloadable="true" crossContext="true"/> > > > > but I still get the same thing (Http Status 404). > > > > To re-iterate, I have the following code set up: > > > > %CATALINA_HOME%\webapps\myDir\index.html > > %CATALINA_HOME%\webapps\myDir\WEB-INF\classes\myClass.class > > %CATALINA_HOME%\webapps\myDir\WEB-INF\web.xml > > > > The html file is served correctly when viewed from a browser. The > > CATALINA_HOME environment variable is set correctly. > > > > With reference to the docs they seem to give a mixed message. > > > > The link you gave me about Auto Deploy leads to 'The Host > Container' > > page . Under the 'Automatic Application Deployment' (apparently > > default) section, the third bullet point implies that this context > > stuff takes place automatically. > > > > Also, on the 'Deployment' page, under the 'Deployment with > TomCat 4' > > section, the first bullet point relates to the approach I am > > attempting and yet it doesn't mention the need to alter the > server.xml > > file. > > > > I'd be grateful for any ideas you may have... > > > > Regards > > > > Andy Wickson > > > > > > > > > > > > > > -- > To unsubscribe, e-mail: > <mailto:tomcat-user-> [EMAIL PROTECTED]> > For > additional commands, > e-mail: <mailto:tomcat-user-help@;jakarta.apache.org> > > > > > > -- > To unsubscribe, e-mail: > <mailto:tomcat-user-> [EMAIL PROTECTED]> > For > additional commands, > e-mail: <mailto:tomcat-user-help@;jakarta.apache.org> > > -- To unsubscribe, e-mail: <mailto:tomcat-user-unsubscribe@;jakarta.apache.org> For additional commands, e-mail: <mailto:tomcat-user-help@;jakarta.apache.org> -- To unsubscribe, e-mail: <mailto:tomcat-user-unsubscribe@;jakarta.apache.org> For additional commands, e-mail: <mailto:tomcat-user-help@;jakarta.apache.org>
