hi, Can anybody guide me in configuring servlets in a new context other than the examples context , on tomcat4. when i try to invoke a servlet, file not found exception is occurring. the structure of the web.xml is like this <servlet> <servlet-name> UpdateLicense </servlet-name> <servlet-class> UpdateLicense </servlet-class> </servlet>
--prasad
prabhat kumar
Ranch Hand
Joined: Apr 11, 2001
Posts: 114
posted
0
have you configured the url pattern for servlets in web.xml??
prasad hagargi
Ranch Hand
Joined: Oct 21, 2002
Posts: 36
posted
0
yes i have mapped it as <servlet-mapping> <servlet-name> UpdateLicense </servlet-name> <url-pattern> / UpdateLicense </url-pattern> </servlet-mapping> even then iam not able to invoke it it still gives me the file not found exception
prasad hagargi
Ranch Hand
Joined: Oct 21, 2002
Posts: 36
posted
0
should i be editing the web.xml or the server.xml of the D:\jakarta-tomcat-4.0.6\conf in this case. if yes then what should i edit ?
Don't bother uncommenting that servlet/* mapping. It's not a 'best practice' way of invoking servlets!
the servlet mappings for each application should be in that application's web.xml. p.s. - if you tried to put a servlet mapping in server.xml, it would throw a parsing exception. They're not allowed in this file.
Is there a space between your '/' and UpdateLicense? (there shouldn't be).
Also... moving this from Servlets -> Apache/Tomcat
prasad hagargi
Ranch Hand
Joined: Oct 21, 2002
Posts: 36
posted
0
below is the structure of the web.xml of the application,iam trying to deploy
<?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> <servlet> <servlet-name>HelloWorldExample</servlet-name> <servlet-class>test.HelloWorldExample</servlet-class> </servlet> </web-app> while invoking iam using the url http://localhost:8080/test/servlet/HelloWorldExample the context tag in server.xml is <Context path="/test" docBase="test" debug="0" reloadable="true" crossContext="true"/> i still am getting The requested resource (/test/servlet/HelloWorldExample) is not available.
prasad hagargi
Ranch Hand
Joined: Oct 21, 2002
Posts: 36
posted
0
i am using tomcat4.0.6 on win nt, heys guys help me out.
srinivasan ganesan
Ranch Hand
Joined: Mar 09, 2001
Posts: 54
posted
0
Look in your logs. Looking at your web.xml I see that some elements namely description and name are missing. I'm not sure of their order(It matters!!). I'm guessing the xml parser has thrown a parser exception during validation. If thats the case, try adding those elements in as they are mandatory and they should be in the correct order.