wood burning stoves 2.0*
The moose likes Tomcat and the fly likes configuring servlets on  tomcat4 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Products » Tomcat
Bookmark "configuring servlets on  tomcat4" Watch "configuring servlets on  tomcat4" New topic
Author

configuring servlets on tomcat4

prasad hagargi
Ranch Hand

Joined: Oct 21, 2002
Posts: 36
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
have you configured the url pattern for servlets
in web.xml??
prasad hagargi
Ranch Hand

Joined: Oct 21, 2002
Posts: 36
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
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 ?
prabhat kumar
Ranch Hand

Joined: Apr 11, 2001
Posts: 114
yes,
suppose you want to call ur servlets like:
http://servername/myapp/servlet/mypackage.myservlet
then you should uncomment the servlet maaping for "invoker" servlet in web.xml in tomcat/conf directory
Mike Curwen
Ranch Hand

Joined: Feb 20, 2001
Posts: 3695

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
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
i am using tomcat4.0.6 on win nt,
heys guys help me out.
srinivasan ganesan
Ranch Hand

Joined: Mar 09, 2001
Posts: 54
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: configuring servlets on tomcat4
 
Similar Threads
Different ways for Contex
tomcat4
SEVERE: Can't create apr error
Servlet: Initialization parameters
configuring servlets on tomcat4