Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Tomcat error : missing application web.xml

 
Balaji Londhe
Ranch Hand
Posts: 100
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ranchers,

I am getting error on the Tomcat console "info : missing application web.xml...." for the webapplication named demoservlet I have created, while starting the server.
And while running this webapp,I am getting error "demoservlet/as not found"
('/as' is the url-pattern for the servlet in the web app).

Could anybody please help?
Thanks in advance....
 
Gowher Naik
Ranch Hand
Posts: 643
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Check following
1.web.xml should be inside WEB-INF folder
Example-: tomcat/webapps/mywebapp/WEB-INF
2. For each tag opening tag there should be closing tag
Example
<web-apps...>opening tag
</web-apps> closing tag
3. For servlet mapping use following tags
[code]
<we-app...>
<servlet>
<servlet-name>myservlet</servlet-name>
<servlet-class>pack.com.myservlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>myservlet</servlet-name>
<url-pattern>/as.do</url-pattern>
</servlet-mapping>
</web-app>
 
Balaji Londhe
Ranch Hand
Posts: 100
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks.. But I think I have used same DD that is specified in above post & still I am getting the same error.
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you sure you have the following : /webapps/demoservlet/WEB-INF/web.xml ?
 
Balaji Londhe
Ranch Hand
Posts: 100
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes... I am very sure that web.xaml is present at 'webapps/demoservlet/WEB-INF/web.xml'
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
please post your web.xml
 
Balaji Londhe
Ranch Hand
Posts: 100
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It looks like:

<?xml version="1.0" encoding="UTF-8"?>
<!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 id="WebApp">
<display-name>demoservlet</display-name>
<servlet>
<servlet-name>demo</servlet-name>
<display-name>demoservlet</display-name>
<servlet-class>servletdemo</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>demo</servlet-name>
<url-pattern>/as</url-pattern>
</servlet-mapping>
</web-app>
 
atul mistry
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please use this type of url-pattern.

<servlet-mapping> <servlet-name>MyOwnDefaultServlet</servlet-name><url-pattern>/myservlet/*(</url-pattern></servlet-mapping>
 
Balaji Londhe
Ranch Hand
Posts: 100
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Then what should be my full URL for web browser?
 
Dinuka Arsakularatne
Ranch Hand
Posts: 198
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
put this fragment at the top of your web.xml file and check if it works...


<?xml version="1.0" encoding="ISO-8859-1"?>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
version="2.4">
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic