XML Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreXML Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
  #1  
Old September 3rd, 2003, 10:50 PM
violaplayer violaplayer is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Posts: 24 violaplayer User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Unhappy <listener> problem

Hello all

I am new to XML, so sorry for this silly post. I am trying to use the <listener> to call my Servlet, which has implemented ServletContextListener and saved in ROOT/WEB-INF/classes, when the Tomcat server starts.

However, Tomcat gave me these errors when it's starting:
--------------------------------------------------------------------------------
org.xml.sax.SaxParseException: Element type "listener" must be declared.
[ERROR] Digester -- Parse Error at line 10 column 12: Element type "listener" must be declared
[ERROR] Digester -- Parse Error at line 11 column 12: Element type "listener" must be declared
[ERROR] Digester -- Parse Error at line 45 column 11: The content of Element type "web-app" must match "<icon?, display name?, description?, distributable?, content param*. servlet*, servlet-mapping, session-config*, mime-mapping*, welcome-file-list*, error-page*, taglib*, resource-ref*, security-constraint*, login-config*, security-role*, env-entry*, ejb-ref*>".>
--------------------------------------------------------------------------------
This is my web.xml:

<?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>

<!-- Listeners -->
<listener>
<listener-class>
InterestCounter
</listener-class>
</listener>

<security-constraint>
<web-resource-collection>
<web-resource-name>Security</web-resource-name>
<url-pattern>/client/*</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>administrator</role-name>
<role-name>client</role-name>
</auth-constraint>
</security-constraint>

<security-constraint>
<web-resource-collection>
<web-resource-name>Security</web-resource-name>
<url-pattern>/administrator/*</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>administrator</role-name>
</auth-constraint>
</security-constraint>

<login-config>
<auth-method>FORM</auth-method>
<form-login-config>
<form-login-page>/login.html</form-login-page>
<form-error-page>/login_error.html</form-error-page>
</form-login-config>
</login-config>

</web-app>
--------------------------------------------------------------------------------
Please anyone tell me what thing goes wrong with my code. Many many thanks!!

Viola

Reply With Quote
  #2  
Old September 5th, 2003, 04:33 PM
bricker42 bricker42 is offline
Moderator =(8^(|)
Dev Shed Intermediate (1500 - 1999 posts)
 
Join Date: Feb 2002
Location: Sacramento, CA
Posts: 1,710 bricker42 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 20 m 38 sec
Reputation Power: 8
Send a message via AIM to bricker42
Try throwing this on the top of your file. Replace the part you have that's similar to it.

<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">

The problem is you're trying to use an out of date version of the DTD. Be sure you're using Tomcat 4.0 or better, though.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreXML Programming > <listener> problem


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway