Servlet Context Listener problem
I am using tomcat 5.0.19 and am experiencing different behavior from a servlet context listener than what is outlined in the servlet spec. My expectation is that the listener methods contextInitialized() and contextDestroyed() should be called respectively each time the application is undeployed and redeployed. However, in practice it appears the methods are only called once per tomcat session. I have a class that implements Servlet context listener and the methods contextInitialized() and contextDestroyed() are only called once and not on subsequent undeploys and redeploys. However, restarting tomcat causes the methods to be called again, but only for a single deployment of the application. Those methods are not called again unless tomcat is restarted (I have also tried the reload task, start and stop all with no success). That is, if the application is deployed and tomcat is restarted, the method contextInitialized() is called, and if the app is undelpoyed the method contextDestroyed() is also correctly called. On any subsequent deployments or undeployments the servlet context listener methods are not called. Restarting tomcat always results in the methods being called again on the first deployment or undeployment after the restart. First, is the witnessed behavior the way context listeners are supposed behave? If not, do you have any suggestions on where I might look to correct the problem. For completeness, I am including my listener tag from web.xml file and the source of the class that implements ServletContextListener. In my web.xml file I have registered the listener as follows: listener listener class scs.reaction.common.init.ReactionInitialization /listener-class /listener And here is my implementation: package scs.reaction.common.init; import java.io.IOException; import java.util.logging.*; import javax.servlet.*; public class ReactionInitialization implements ServletContextListener { Logger logger = null; public ReactionInitialization(){} public void contextInitialized(ServletContextEvent arg0){ // Check to see if the root log manager for this application exists if // not initialize it and set its default atributes if(LogManager.getLogManager().getLogger(scs.reaction)== null) { //Call the supers initialization first // we will name all loggers after thier fully qaulified class name logger = Logger.getLogger(scs.reaction); FileHandler fileHandler = null; //creare our own file handler // the file handler will cycle through 2 files // files are limited in size to 100KB and sessions are appended try { fileHandler = new FileHandler(System.getProperty(catalina.home)+ /logs/ + scs.reaction.log,100,2,true); } catch (SecurityException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } // use a standard text formatter for the file output fileHandler.setFormatter(new SimpleFormatter()); //attach the handler logger.addHandler(fileHandler); //Set the level to all messages logger.setLevel(Level.FINEST); logger.finer(Context Intitalized); } } public void contextDestroyed(ServletContextEvent arg0) { logger.finer(Context Destroyed); } } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Servlet Context Listener problem
Hi, A couple of quick notes as I have to run to a meeting: - I think your understanding of the spec is correct - What happens if you reload the app (not undeploy and redeploy, but reload) via the manager webapp? - Are you sure the undeploy is COMPLETELY done cleanly, and no threads from your own webapp are left behind? For example, do you have to shutdown your log manager? Yoav Shapira Millennium Research Informatics -Original Message- From: Jason Bucholtz [mailto:[EMAIL PROTECTED] Sent: Monday, April 05, 2004 3:04 PM To: Tomcat Users List Subject: Servlet Context Listener problem I am using tomcat 5.0.19 and am experiencing different behavior from a servlet context listener than what is outlined in the servlet spec. My expectation is that the listener methods contextInitialized() and contextDestroyed() should be called respectively each time the application is undeployed and redeployed. However, in practice it appears the methods are only called once per tomcat session. I have a class that implements Servlet context listener and the methods contextInitialized() and contextDestroyed() are only called once and not on subsequent undeploys and redeploys. However, restarting tomcat causes the methods to be called again, but only for a single deployment of the application. Those methods are not called again unless tomcat is restarted (I have also tried the reload task, start and stop all with no success). That is, if the application is deployed and tomcat is restarted, the method contextInitialized() is called, and if the app is undelpoyed the method contextDestroyed() is also correctly called. On any subsequent deployments or undeployments the servlet context listener methods are not called. Restarting tomcat always results in the methods being called again on the first deployment or undeployment after the restart. First, is the witnessed behavior the way context listeners are supposed behave? If not, do you have any suggestions on where I might look to correct the problem. For completeness, I am including my listener tag from web.xml file and the source of the class that implements ServletContextListener. In my web.xml file I have registered the listener as follows: listener listener class scs.reaction.common.init.ReactionInitialization /listener-class /listener And here is my implementation: package scs.reaction.common.init; import java.io.IOException; import java.util.logging.*; import javax.servlet.*; public class ReactionInitialization implements ServletContextListener { Logger logger = null; public ReactionInitialization(){} public void contextInitialized(ServletContextEvent arg0){ // Check to see if the root log manager for this application exists if // not initialize it and set its default atributes if(LogManager.getLogManager().getLogger(scs.reaction)== null) { //Call the supers initialization first // we will name all loggers after thier fully qaulified class name logger = Logger.getLogger(scs.reaction); FileHandler fileHandler = null; //creare our own file handler // the file handler will cycle through 2 files // files are limited in size to 100KB and sessions are appended try { fileHandler = new FileHandler(System.getProperty(catalina.home)+ /logs/ + scs.reaction.log,100,2,true); } catch (SecurityException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } // use a standard text formatter for the file output fileHandler.setFormatter(new SimpleFormatter()); //attach the handler logger.addHandler(fileHandler); //Set the level to all messages logger.setLevel(Level.FINEST); logger.finer(Context Intitalized); } } public void contextDestroyed(ServletContextEvent arg0) { logger.finer(Context Destroyed); } } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system
RE: Servlet Context Listener problem - Solved
Yoav, Thanks for the quick response- Found my error, and embarrassingly it was a simple logic problem. My logger was only being initialized if it had not been previously initialized by the JVM. As such, within that logic block the log messages were only being output the very first time the app started in a tomcat session. So, it appeared that the listener wasn't being called, but in actuality it was doing exactly as it should. Jason Jason A. Bucholtz [EMAIL PROTECTED] SCS Computer Center 152 Noyes Lab 4-0560 On Mon, 5 Apr 2004, Shapira, Yoav wrote: Hi, A couple of quick notes as I have to run to a meeting: - I think your understanding of the spec is correct - What happens if you reload the app (not undeploy and redeploy, but reload) via the manager webapp? - Are you sure the undeploy is COMPLETELY done cleanly, and no threads from your own webapp are left behind? For example, do you have to shutdown your log manager? Yoav Shapira Millennium Research Informatics -Original Message- From: Jason Bucholtz [mailto:[EMAIL PROTECTED] Sent: Monday, April 05, 2004 3:04 PM To: Tomcat Users List Subject: Servlet Context Listener problem I am using tomcat 5.0.19 and am experiencing different behavior from a servlet context listener than what is outlined in the servlet spec. My expectation is that the listener methods contextInitialized() and contextDestroyed() should be called respectively each time the application is undeployed and redeployed. However, in practice it appears the methods are only called once per tomcat session. I have a class that implements Servlet context listener and the methods contextInitialized() and contextDestroyed() are only called once and not on subsequent undeploys and redeploys. However, restarting tomcat causes the methods to be called again, but only for a single deployment of the application. Those methods are not called again unless tomcat is restarted (I have also tried the reload task, start and stop all with no success). That is, if the application is deployed and tomcat is restarted, the method contextInitialized() is called, and if the app is undelpoyed the method contextDestroyed() is also correctly called. On any subsequent deployments or undeployments the servlet context listener methods are not called. Restarting tomcat always results in the methods being called again on the first deployment or undeployment after the restart. First, is the witnessed behavior the way context listeners are supposed behave? If not, do you have any suggestions on where I might look to correct the problem. For completeness, I am including my listener tag from web.xml file and the source of the class that implements ServletContextListener. In my web.xml file I have registered the listener as follows: listener listener class scs.reaction.common.init.ReactionInitialization /listener-class /listener And here is my implementation: package scs.reaction.common.init; import java.io.IOException; import java.util.logging.*; import javax.servlet.*; public class ReactionInitialization implements ServletContextListener { Logger logger = null; public ReactionInitialization(){} public void contextInitialized(ServletContextEvent arg0){ // Check to see if the root log manager for this application exists if // not initialize it and set its default atributes if(LogManager.getLogManager().getLogger(scs.reaction)== null) { //Call the supers initialization first // we will name all loggers after thier fully qaulified class name logger = Logger.getLogger(scs.reaction); FileHandler fileHandler = null; //creare our own file handler // the file handler will cycle through 2 files // files are limited in size to 100KB and sessions are appended try { fileHandler = new FileHandler(System.getProperty(catalina.home)+ /logs/ + scs.reaction.log,100,2,true); } catch (SecurityException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } // use a standard text formatter for the file output fileHandler.setFormatter(new SimpleFormatter()); //attach the handler logger.addHandler(fileHandler); //Set the level to all messages logger.setLevel(Level.FINEST); logger.finer(Context Intitalized); } } public void contextDestroyed(ServletContextEvent arg0
RE: Servlet Context Listener problem - Solved
hehe, that kind of thing happens(speaking from experience) Glad you found the problem. At first glance, I thought you found a bug in tomcat 5:). -Original Message- From: Jason Bucholtz [mailto:[EMAIL PROTECTED] Sent: Monday, April 05, 2004 2:57 PM To: Tomcat Users List Subject: RE: Servlet Context Listener problem - Solved Yoav, Thanks for the quick response- Found my error, and embarrassingly it was a simple logic problem. My logger was only being initialized if it had not been previously initialized by the JVM. As such, within that logic block the log messages were only being output the very first time the app started in a tomcat session. So, it appeared that the listener wasn't being called, but in actuality it was doing exactly as it should. Jason Jason A. Bucholtz [EMAIL PROTECTED] SCS Computer Center 152 Noyes Lab 4-0560 On Mon, 5 Apr 2004, Shapira, Yoav wrote: Hi, A couple of quick notes as I have to run to a meeting: - I think your understanding of the spec is correct - What happens if you reload the app (not undeploy and redeploy, but reload) via the manager webapp? - Are you sure the undeploy is COMPLETELY done cleanly, and no threads from your own webapp are left behind? For example, do you have to shutdown your log manager? Yoav Shapira Millennium Research Informatics -Original Message- From: Jason Bucholtz [mailto:[EMAIL PROTECTED] Sent: Monday, April 05, 2004 3:04 PM To: Tomcat Users List Subject: Servlet Context Listener problem I am using tomcat 5.0.19 and am experiencing different behavior from a servlet context listener than what is outlined in the servlet spec. My expectation is that the listener methods contextInitialized() and contextDestroyed() should be called respectively each time the application is undeployed and redeployed. However, in practice it appears the methods are only called once per tomcat session. I have a class that implements Servlet context listener and the methods contextInitialized() and contextDestroyed() are only called once and not on subsequent undeploys and redeploys. However, restarting tomcat causes the methods to be called again, but only for a single deployment of the application. Those methods are not called again unless tomcat is restarted (I have also tried the reload task, start and stop all with no success). That is, if the application is deployed and tomcat is restarted, the method contextInitialized() is called, and if the app is undelpoyed the method contextDestroyed() is also correctly called. On any subsequent deployments or undeployments the servlet context listener methods are not called. Restarting tomcat always results in the methods being called again on the first deployment or undeployment after the restart. First, is the witnessed behavior the way context listeners are supposed behave? If not, do you have any suggestions on where I might look to correct the problem. For completeness, I am including my listener tag from web.xml file and the source of the class that implements ServletContextListener. In my web.xml file I have registered the listener as follows: listener listener class scs.reaction.common.init.ReactionInitialization /listener-class /listener And here is my implementation: package scs.reaction.common.init; import java.io.IOException; import java.util.logging.*; import javax.servlet.*; public class ReactionInitialization implements ServletContextListener { Logger logger = null; public ReactionInitialization(){} public void contextInitialized(ServletContextEvent arg0){ // Check to see if the root log manager for this application exists if // not initialize it and set its default atributes if(LogManager.getLogManager().getLogger(scs.reaction)== null) { //Call the supers initialization first // we will name all loggers after thier fully qaulified class name logger = Logger.getLogger(scs.reaction); FileHandler fileHandler = null; //creare our own file handler // the file handler will cycle through 2 files // files are limited in size to 100KB and sessions are appended try { fileHandler = new FileHandler(System.getProperty(catalina.home)+ /logs/ + scs.reaction.log,100,2,true); } catch (SecurityException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } // use a standard text formatter for the file output fileHandler.setFormatter(new SimpleFormatter()); //attach the handler
Re: Servlet Context Listener problem...
Have a look at one of the latest Enterprise Java Tech Tip on Servlet Life Cycle Listeners: http://developer.java.sun.com/developer/EJTechTips/2003/tt0626.html#2 Zach. [EMAIL PROTECTED] wrote: Hi: I implemented ServletContextListener in my class. I then wrote the xml in the web.xml file and started tomcat. The error tomcat threw tells me that it did not recognize the listener and listener-class elements ?? i have them declared in the web.xml as: web-app !-- ServletContextListener -- listener listener-class com.wavesinmotion.cw.classes.jsphelpers.CourseWizardContextListener /listener-class /listener /web-app Any ideas where I am going wrong ? Thanks. Tomcat threw this error below: SEVERE: Parse Error at line 10 column 12: Element type listener must be declared. org.xml.sax.SAXParseException: Element type listener must be declared. at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Error HandlerWrapper.java:232) at org.apache.xerces.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.jav a:173) at org.apache.xerces.impl.XMLErrorReporter.reportError(XMLErrorReporter.jav a:371) at org.apache.xerces.impl.XMLErrorReporter.reportError(XMLErrorReporter.jav a:305) at org.apache.xerces.impl.dtd.XMLDTDValidator.handleStartElement(XMLDTDVali dator.java:1833) at org.apache.xerces.impl.dtd.XMLDTDValidator.startElement(XMLDTDValidator. java:724) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanStartElement(X MLDocumentFragmentScannerImpl.java:759) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDis patcher.dispatch(XMLDocumentFragmentScannerImpl.java:1477) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDo cumentFragmentScannerImpl.java:329) at org.apache.xerces.parsers.DTDConfiguration.parse(DTDConfiguration.java:5 25) at org.apache.xerces.parsers.DTDConfiguration.parse(DTDConfiguration.java:5 81) at org.apache.xerces.parsers.XMLParser.parse(XMLParser.java:152) at org.apache.xerces.parsers.AbstractSAXParser.parse(AbstractSAXParser.java :1175) at org.apache.commons.digester.Digester.parse(Digester.java:1495) at org.apache.catalina.startup.ContextConfig.applicationConfig(ContextConfi g.java:282) at org.apache.catalina.startup.ContextConfig.start(ContextConfig.java:639) at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.j ava:243) at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSu pport.java:166) at org.apache.catalina.core.StandardContext.start(StandardContext.java:3567 ) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1188) at org.apache.catalina.core.StandardHost.start(StandardHost.java:738) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1188) at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:347) at org.apache.catalina.core.StandardService.start(StandardService.java:497) at org.apache.catalina.core.StandardServer.start(StandardServer.java:2189) at org.apache.catalina.startup.Catalina.start(Catalina.java:512) at org.apache.catalina.startup.Catalina.execute(Catalina.java:400) at org.apache.catalina.startup.Catalina.process(Catalina.java:180) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav a:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor Impl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:203) Jul 14, 2003 3:56:11 PM org.apache.commons.digester.Digester error SEVERE: Parse Error at line 11 column 19: Element type listener-class must be declared. org.xml.sax.SAXParseException: Element type listener-class must be declared. at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Error HandlerWrapper.java:232) at org.apache.xerces.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.jav a:173) at org.apache.xerces.impl.XMLErrorReporter.reportError(XMLErrorReporter.jav a:371) at org.apache.xerces.impl.XMLErrorReporter.reportError(XMLErrorReporter.jav a:305) at org.apache.xerces.impl.dtd.XMLDTDValidator.handleStartElement(XMLDTDVali dator.java:1833) at org.apache.xerces.impl.dtd.XMLDTDValidator.startElement(XMLDTDValidator. java:724) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanStartElement(X MLDocumentFragmentScannerImpl.java:759) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDis patcher.dispatch(XMLDocumentFragmentScannerImpl.java:1477) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDo cumentFragmentScannerImpl.java:329) at org.apache.xerces.parsers.DTDConfiguration.parse(DTDConfiguration.java:5
Re: Servlet Context Listener problem...
Is that the entirety of your web.xml? The error looks like the parser can't find the definition of the listener element, it hasn't even got to the point of worrying about element order yet. Have you got an xml prolog and a doctype at the top of the file? eg: ?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; (Apologies for line-wrap) Jon Mufaddal Khumri wrote: Hi: I implemented ServletContextListener in my class. I then wrote the xml in the web.xml file and started tomcat. The error tomcat threw tells me that it did not recognize the listener and listener-class elements ?? i have them declared in the web.xml as: web-app !-- ServletContextListener -- listener listener-class com.wavesinmotion.cw.classes.jsphelpers.CourseWizardContextListener /listener-class /listener /web-app Any ideas where I am going wrong ? Thanks. Tomcat threw this error below: SEVERE: Parse Error at line 10 column 12: Element type listener must be declared. org.xml.sax.SAXParseException: Element type listener must be declared. at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Error HandlerWrapper.java:232) at org.apache.xerces.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.jav a:173) at org.apache.xerces.impl.XMLErrorReporter.reportError(XMLErrorReporter.jav a:371) at org.apache.xerces.impl.XMLErrorReporter.reportError(XMLErrorReporter.jav a:305) at org.apache.xerces.impl.dtd.XMLDTDValidator.handleStartElement(XMLDTDVali dator.java:1833) at org.apache.xerces.impl.dtd.XMLDTDValidator.startElement(XMLDTDValidator. java:724) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanStartElement(X MLDocumentFragmentScannerImpl.java:759) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDis patcher.dispatch(XMLDocumentFragmentScannerImpl.java:1477) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDo cumentFragmentScannerImpl.java:329) at org.apache.xerces.parsers.DTDConfiguration.parse(DTDConfiguration.java:5 25) at org.apache.xerces.parsers.DTDConfiguration.parse(DTDConfiguration.java:5 81) at org.apache.xerces.parsers.XMLParser.parse(XMLParser.java:152) at org.apache.xerces.parsers.AbstractSAXParser.parse(AbstractSAXParser.java :1175) at org.apache.commons.digester.Digester.parse(Digester.java:1495) at org.apache.catalina.startup.ContextConfig.applicationConfig(ContextConfi g.java:282) at org.apache.catalina.startup.ContextConfig.start(ContextConfig.java:639) at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.j ava:243) at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSu pport.java:166) at org.apache.catalina.core.StandardContext.start(StandardContext.java:3567 ) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1188) at org.apache.catalina.core.StandardHost.start(StandardHost.java:738) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1188) at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:347) at org.apache.catalina.core.StandardService.start(StandardService.java:497) at org.apache.catalina.core.StandardServer.start(StandardServer.java:2189) at org.apache.catalina.startup.Catalina.start(Catalina.java:512) at org.apache.catalina.startup.Catalina.execute(Catalina.java:400) at org.apache.catalina.startup.Catalina.process(Catalina.java:180) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav a:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor Impl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:203) Jul 14, 2003 3:56:11 PM org.apache.commons.digester.Digester error SEVERE: Parse Error at line 11 column 19: Element type listener-class must be declared. org.xml.sax.SAXParseException: Element type listener-class must be declared. at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Error HandlerWrapper.java:232) at org.apache.xerces.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.jav a:173) at org.apache.xerces.impl.XMLErrorReporter.reportError(XMLErrorReporter.jav a:371) at org.apache.xerces.impl.XMLErrorReporter.reportError(XMLErrorReporter.jav a:305) at org.apache.xerces.impl.dtd.XMLDTDValidator.handleStartElement(XMLDTDVali dator.java:1833) at org.apache.xerces.impl.dtd.XMLDTDValidator.startElement(XMLDTDValidator. java:724) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanStartElement(X MLDocumentFragmentScannerImpl.java:759) at
Re: Servlet Context Listener problem...
Yes , my listener has been declared before anything else under web-app .. the problem persists .. any clues ? On Tuesday, July 15, 2003, at 07:00 AM, Januski, Ken wrote: Listeners must be declared before any servlets in web.xml. I'd check that first. -Original Message- From: Mufaddal Khumri [mailto:[EMAIL PROTECTED] Sent: Monday, July 14, 2003 6:41 AM To: Tomcat List Subject: Servlet Context Listener problem... Hi: I implemented ServletContextListener in my class. I then wrote the xml in the web.xml file and started tomcat. The error tomcat threw tells me that it did not recognize the listener and listener-class elements ?? i have them declared in the web.xml as: web-app !-- ServletContextListener -- listener listener-class com.wavesinmotion.cw.classes.jsphelpers.CourseWizardContextListener /listener-class /listener /web-app Any ideas where I am going wrong ? Thanks. Tomcat threw this error below: SEVERE: Parse Error at line 10 column 12: Element type listener must be declared. org.xml.sax.SAXParseException: Element type listener must be declared. at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Erro r HandlerWrapper.java:232) at org.apache.xerces.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.ja v a:173) at org.apache.xerces.impl.XMLErrorReporter.reportError(XMLErrorReporter.ja v a:371) at org.apache.xerces.impl.XMLErrorReporter.reportError(XMLErrorReporter.ja v a:305) at org.apache.xerces.impl.dtd.XMLDTDValidator.handleStartElement(XMLDTDVal i dator.java:1833) at org.apache.xerces.impl.dtd.XMLDTDValidator.startElement(XMLDTDValidator . java:724) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanStartElement( X MLDocumentFragmentScannerImpl.java:759) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDi s patcher.dispatch(XMLDocumentFragmentScannerImpl.java:1477) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLD o cumentFragmentScannerImpl.java:329) at org.apache.xerces.parsers.DTDConfiguration.parse(DTDConfiguration.java: 5 25) at org.apache.xerces.parsers.DTDConfiguration.parse(DTDConfiguration.java: 5 81) at org.apache.xerces.parsers.XMLParser.parse(XMLParser.java:152) at org.apache.xerces.parsers.AbstractSAXParser.parse(AbstractSAXParser.jav a :1175) at org.apache.commons.digester.Digester.parse(Digester.java:1495) at org.apache.catalina.startup.ContextConfig.applicationConfig(ContextConf i g.java:282) at org.apache.catalina.startup.ContextConfig.start(ContextConfig.java:639) at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig. j ava:243) at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleS u pport.java:166) at org.apache.catalina.core.StandardContext.start(StandardContext.java:356 7 ) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1188) at org.apache.catalina.core.StandardHost.start(StandardHost.java:738) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1188) at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:347) at org.apache.catalina.core.StandardService.start(StandardService.java:497 ) at org.apache.catalina.core.StandardServer.start(StandardServer.java:2189) at org.apache.catalina.startup.Catalina.start(Catalina.java:512) at org.apache.catalina.startup.Catalina.execute(Catalina.java:400) at org.apache.catalina.startup.Catalina.process(Catalina.java:180) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.ja v a:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccesso r Impl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:203) Jul 14, 2003 3:56:11 PM org.apache.commons.digester.Digester error SEVERE: Parse Error at line 11 column 19: Element type listener-class must be declared. org.xml.sax.SAXParseException: Element type listener-class must be declared. at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Erro r HandlerWrapper.java:232) at org.apache.xerces.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.ja v a:173) at org.apache.xerces.impl.XMLErrorReporter.reportError(XMLErrorReporter.ja v a:371) at org.apache.xerces.impl.XMLErrorReporter.reportError(XMLErrorReporter.ja v a:305) at org.apache.xerces.impl.dtd.XMLDTDValidator.handleStartElement(XMLDTDVal i dator.java:1833) at org.apache.xerces.impl.dtd.XMLDTDValidator.startElement(XMLDTDValidator . java:724) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanStartElement( X MLDocumentFragmentScannerImpl.java:759) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDi s patcher.dispatch(XMLDocumentFragmentScannerImpl.java:1477
RE: Servlet Context Listener problem...
Make sure your DTD is the correct servlet 2.3 DTD. The listener element was introduced in version 2.3 of the servlet spec. -Original Message- From: Mufaddal Khumri [mailto:[EMAIL PROTECTED] Sent: 15 July 2003 04:58 To: Tomcat Users List Subject: Re: Servlet Context Listener problem... Yes , my listener has been declared before anything else under web-app .. the problem persists .. any clues ? On Tuesday, July 15, 2003, at 07:00 AM, Januski, Ken wrote: Listeners must be declared before any servlets in web.xml. I'd check that first. -Original Message- From: Mufaddal Khumri [mailto:[EMAIL PROTECTED] Sent: Monday, July 14, 2003 6:41 AM To: Tomcat List Subject: Servlet Context Listener problem... Hi: I implemented ServletContextListener in my class. I then wrote the xml in the web.xml file and started tomcat. The error tomcat threw tells me that it did not recognize the listener and listener-class elements ?? i have them declared in the web.xml as: web-app !-- ServletContextListener -- listener listener-class com.wavesinmotion.cw.classes.jsphelpers.CourseWizardContextListener /listener-class /listener /web-app Any ideas where I am going wrong ? Thanks. Tomcat threw this error below: SEVERE: Parse Error at line 10 column 12: Element type listener must be declared. org.xml.sax.SAXParseException: Element type listener must be declared. at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Erro r HandlerWrapper.java:232) at org.apache.xerces.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.ja v a:173) at org.apache.xerces.impl.XMLErrorReporter.reportError(XMLErrorReporter.ja v a:371) at org.apache.xerces.impl.XMLErrorReporter.reportError(XMLErrorReporter.ja v a:305) at org.apache.xerces.impl.dtd.XMLDTDValidator.handleStartElement(XMLDTDVal i dator.java:1833) at org.apache.xerces.impl.dtd.XMLDTDValidator.startElement(XMLDTDValidator . java:724) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanStartElement( X MLDocumentFragmentScannerImpl.java:759) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDi s patcher.dispatch(XMLDocumentFragmentScannerImpl.java:1477) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLD o cumentFragmentScannerImpl.java:329) at org.apache.xerces.parsers.DTDConfiguration.parse(DTDConfiguration.java: 5 25) at org.apache.xerces.parsers.DTDConfiguration.parse(DTDConfiguration.java: 5 81) at org.apache.xerces.parsers.XMLParser.parse(XMLParser.java:152) at org.apache.xerces.parsers.AbstractSAXParser.parse(AbstractSAXParser.jav a :1175) at org.apache.commons.digester.Digester.parse(Digester.java:1495) at org.apache.catalina.startup.ContextConfig.applicationConfig(ContextConf i g.java:282) at org.apache.catalina.startup.ContextConfig.start(ContextConfig.java:639) at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig. j ava:243) at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleS u pport.java:166) at org.apache.catalina.core.StandardContext.start(StandardContext.java:356 7 ) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1188) at org.apache.catalina.core.StandardHost.start(StandardHost.java:738) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1188) at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:347) at org.apache.catalina.core.StandardService.start(StandardService.java:497 ) at org.apache.catalina.core.StandardServer.start(StandardServer.java:2189) at org.apache.catalina.startup.Catalina.start(Catalina.java:512) at org.apache.catalina.startup.Catalina.execute(Catalina.java:400) at org.apache.catalina.startup.Catalina.process(Catalina.java:180) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.ja v a:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccesso r Impl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:203) Jul 14, 2003 3:56:11 PM org.apache.commons.digester.Digester error SEVERE: Parse Error at line 11 column 19: Element type listener-class must be declared. org.xml.sax.SAXParseException: Element type listener-class must be declared. at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Erro r HandlerWrapper.java:232) at org.apache.xerces.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.ja v a:173) at org.apache.xerces.impl.XMLErrorReporter.reportError
Re: Servlet Context Listener problem...
Is declared before anything else a literal statement? Are you following the DTD? listener comes after several other elements, it can't come first unless you don't use any of the preceeding elements at all. John On Tue, 15 Jul 2003 09:27:39 +0530, Mufaddal Khumri [EMAIL PROTECTED] wrote: Yes , my listener has been declared before anything else under web-app .. the problem persists .. any clues ? On Tuesday, July 15, 2003, at 07:00 AM, Januski, Ken wrote: Listeners must be declared before any servlets in web.xml. I'd check that first. -Original Message- From: Mufaddal Khumri [mailto:[EMAIL PROTECTED] Sent: Monday, July 14, 2003 6:41 AM To: Tomcat List Subject: Servlet Context Listener problem... Hi: I implemented ServletContextListener in my class. I then wrote the xml in the web.xml file and started tomcat. The error tomcat threw tells me that it did not recognize the listener and listener-class elements ?? i have them declared in the web.xml as: web-app !-- ServletContextListener -- listener listener-class com.wavesinmotion.cw.classes.jsphelpers.CourseWizardContextListener /listener-class /listener /web-app Any ideas where I am going wrong ? Thanks. Tomcat threw this error below: SEVERE: Parse Error at line 10 column 12: Element type listener must be declared. org.xml.sax.SAXParseException: Element type listener must be declared. at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Erro r HandlerWrapper.java:232) at org.apache.xerces.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.ja v a:173) at org.apache.xerces.impl.XMLErrorReporter.reportError(XMLErrorReporter.ja v a:371) at org.apache.xerces.impl.XMLErrorReporter.reportError(XMLErrorReporter.ja v a:305) at org.apache.xerces.impl.dtd.XMLDTDValidator.handleStartElement(XMLDTDVal i dator.java:1833) at org.apache.xerces.impl.dtd.XMLDTDValidator.startElement(XMLDTDValidator . java:724) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanStartElement( X MLDocumentFragmentScannerImpl.java:759) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDi s patcher.dispatch(XMLDocumentFragmentScannerImpl.java:1477) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLD o cumentFragmentScannerImpl.java:329) at org.apache.xerces.parsers.DTDConfiguration.parse(DTDConfiguration.java: 5 25) at org.apache.xerces.parsers.DTDConfiguration.parse(DTDConfiguration.java: 5 81) at org.apache.xerces.parsers.XMLParser.parse(XMLParser.java:152) at org.apache.xerces.parsers.AbstractSAXParser.parse(AbstractSAXParser.jav a :1175) at org.apache.commons.digester.Digester.parse(Digester.java:1495) at org.apache.catalina.startup.ContextConfig.applicationConfig(ContextConf i g.java:282) at org.apache.catalina.startup.ContextConfig.start(ContextConfig.java:639) at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig. j ava:243) at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleS u pport.java:166) at org.apache.catalina.core.StandardContext.start(StandardContext.java:356 7 ) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1188) at org.apache.catalina.core.StandardHost.start(StandardHost.java:738) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1188) at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:347) at org.apache.catalina.core.StandardService.start(StandardService.java:497 ) at org.apache.catalina.core.StandardServer.start(StandardServer.java:2189) at org.apache.catalina.startup.Catalina.start(Catalina.java:512) at org.apache.catalina.startup.Catalina.execute(Catalina.java:400) at org.apache.catalina.startup.Catalina.process(Catalina.java:180) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.ja v a:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccesso r Impl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:203) Jul 14, 2003 3:56:11 PM org.apache.commons.digester.Digester error SEVERE: Parse Error at line 11 column 19: Element type listener-class must be declared. org.xml.sax.SAXParseException: Element type listener-class must be declared. at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Erro r HandlerWrapper.java:232) at org.apache.xerces.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.ja v a:173) at org.apache.xerces.impl.XMLErrorReporter.reportError(XMLErrorReporter.ja v a:371) at org.apache.xerces.impl.XMLErrorReporter.reportError(XMLErrorReporter.ja v a:305) at org.apache.xerces.impl.dtd.XMLDTDValidator.handleStartElement(XMLDTDVal i dator.java:1833) at org.apache.xerces.impl.dtd.XMLDTDValidator.startElement(XMLDTDValidator . java:724
Resolved Re: Servlet Context Listener problem...
CHANGED the reference to the dtd and it worked. That was the error because I was referencing the old dtd which does not recognize listener or listener-class. I had: ?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; Changed it to: ?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;
RE: Servlet Context Listener problem...
If you are using ant, this target can validate your web.xml and see if the listener is in the right place according to the 2.3 specification. Run the target and check it out. target name=validate-web-xml description=validates the web.xml file xmlvalidate file=WEB-INF/web.xml warn=true dtd publicid=-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN location=http://java.sun.com/dtd/web-app_2_3.dtd; / /xmlvalidate /target -Sudhir. -Original Message- From: John Turner [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 15, 2003 12:27 PM To: Tomcat Users List Subject: Re: Servlet Context Listener problem... Is declared before anything else a literal statement? Are you following the DTD? listener comes after several other elements, it can't come first unless you don't use any of the preceeding elements at all. John On Tue, 15 Jul 2003 09:27:39 +0530, Mufaddal Khumri [EMAIL PROTECTED] wrote: Yes , my listener has been declared before anything else under web-app .. the problem persists .. any clues ? On Tuesday, July 15, 2003, at 07:00 AM, Januski, Ken wrote: Listeners must be declared before any servlets in web.xml. I'd check that first. -Original Message- From: Mufaddal Khumri [mailto:[EMAIL PROTECTED] Sent: Monday, July 14, 2003 6:41 AM To: Tomcat List Subject: Servlet Context Listener problem... Hi: I implemented ServletContextListener in my class. I then wrote the xml in the web.xml file and started tomcat. The error tomcat threw tells me that it did not recognize the listener and listener-class elements ?? i have them declared in the web.xml as: web-app !-- ServletContextListener -- listener listener-class com.wavesinmotion.cw.classes.jsphelpers.CourseWizardContextListener /listener-class /listener /web-app Any ideas where I am going wrong ? Thanks. Tomcat threw this error below: SEVERE: Parse Error at line 10 column 12: Element type listener must be declared. org.xml.sax.SAXParseException: Element type listener must be declared. at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Erro r HandlerWrapper.java:232) at org.apache.xerces.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.ja v a:173) at org.apache.xerces.impl.XMLErrorReporter.reportError(XMLErrorReporter.ja v a:371) at org.apache.xerces.impl.XMLErrorReporter.reportError(XMLErrorReporter.ja v a:305) at org.apache.xerces.impl.dtd.XMLDTDValidator.handleStartElement(XMLDTDVal i dator.java:1833) at org.apache.xerces.impl.dtd.XMLDTDValidator.startElement(XMLDTDValidator . java:724) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanStartElement( X MLDocumentFragmentScannerImpl.java:759) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDi s patcher.dispatch(XMLDocumentFragmentScannerImpl.java:1477) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLD o cumentFragmentScannerImpl.java:329) at org.apache.xerces.parsers.DTDConfiguration.parse(DTDConfiguration.java: 5 25) at org.apache.xerces.parsers.DTDConfiguration.parse(DTDConfiguration.java: 5 81) at org.apache.xerces.parsers.XMLParser.parse(XMLParser.java:152) at org.apache.xerces.parsers.AbstractSAXParser.parse(AbstractSAXParser.jav a :1175) at org.apache.commons.digester.Digester.parse(Digester.java:1495) at org.apache.catalina.startup.ContextConfig.applicationConfig(ContextConf i g.java:282) at org.apache.catalina.startup.ContextConfig.start(ContextConfig.java:639) at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig. j ava:243) at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleS u pport.java:166) at org.apache.catalina.core.StandardContext.start(StandardContext.java:356 7 ) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1188) at org.apache.catalina.core.StandardHost.start(StandardHost.java:738) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1188) at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:347) at org.apache.catalina.core.StandardService.start(StandardService.java:497 ) at org.apache.catalina.core.StandardServer.start(StandardServer.java:2189) at org.apache.catalina.startup.Catalina.start(Catalina.java:512) at org.apache.catalina.startup.Catalina.execute(Catalina.java:400) at org.apache.catalina.startup.Catalina.process(Catalina.java:180) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.ja v a:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccesso r Impl.java:25
Servlet Context Listener problem...
Hi: I implemented ServletContextListener in my class. I then wrote the xml in the web.xml file and started tomcat. The error tomcat threw tells me that it did not recognize the listener and listener-class elements ?? i have them declared in the web.xml as: web-app !-- ServletContextListener -- listener listener-class com.wavesinmotion.cw.classes.jsphelpers.CourseWizardContextListener /listener-class /listener /web-app Any ideas where I am going wrong ? Thanks. Tomcat threw this error below: SEVERE: Parse Error at line 10 column 12: Element type listener must be declared. org.xml.sax.SAXParseException: Element type listener must be declared. at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Error HandlerWrapper.java:232) at org.apache.xerces.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.jav a:173) at org.apache.xerces.impl.XMLErrorReporter.reportError(XMLErrorReporter.jav a:371) at org.apache.xerces.impl.XMLErrorReporter.reportError(XMLErrorReporter.jav a:305) at org.apache.xerces.impl.dtd.XMLDTDValidator.handleStartElement(XMLDTDVali dator.java:1833) at org.apache.xerces.impl.dtd.XMLDTDValidator.startElement(XMLDTDValidator. java:724) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanStartElement(X MLDocumentFragmentScannerImpl.java:759) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDis patcher.dispatch(XMLDocumentFragmentScannerImpl.java:1477) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDo cumentFragmentScannerImpl.java:329) at org.apache.xerces.parsers.DTDConfiguration.parse(DTDConfiguration.java:5 25) at org.apache.xerces.parsers.DTDConfiguration.parse(DTDConfiguration.java:5 81) at org.apache.xerces.parsers.XMLParser.parse(XMLParser.java:152) at org.apache.xerces.parsers.AbstractSAXParser.parse(AbstractSAXParser.java :1175) at org.apache.commons.digester.Digester.parse(Digester.java:1495) at org.apache.catalina.startup.ContextConfig.applicationConfig(ContextConfi g.java:282) at org.apache.catalina.startup.ContextConfig.start(ContextConfig.java:639) at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.j ava:243) at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSu pport.java:166) at org.apache.catalina.core.StandardContext.start(StandardContext.java:3567 ) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1188) at org.apache.catalina.core.StandardHost.start(StandardHost.java:738) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1188) at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:347) at org.apache.catalina.core.StandardService.start(StandardService.java:497) at org.apache.catalina.core.StandardServer.start(StandardServer.java:2189) at org.apache.catalina.startup.Catalina.start(Catalina.java:512) at org.apache.catalina.startup.Catalina.execute(Catalina.java:400) at org.apache.catalina.startup.Catalina.process(Catalina.java:180) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav a:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor Impl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:203) Jul 14, 2003 3:56:11 PM org.apache.commons.digester.Digester error SEVERE: Parse Error at line 11 column 19: Element type listener-class must be declared. org.xml.sax.SAXParseException: Element type listener-class must be declared. at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Error HandlerWrapper.java:232) at org.apache.xerces.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.jav a:173) at org.apache.xerces.impl.XMLErrorReporter.reportError(XMLErrorReporter.jav a:371) at org.apache.xerces.impl.XMLErrorReporter.reportError(XMLErrorReporter.jav a:305) at org.apache.xerces.impl.dtd.XMLDTDValidator.handleStartElement(XMLDTDVali dator.java:1833) at org.apache.xerces.impl.dtd.XMLDTDValidator.startElement(XMLDTDValidator. java:724) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanStartElement(X MLDocumentFragmentScannerImpl.java:759) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDis patcher.dispatch(XMLDocumentFragmentScannerImpl.java:1477) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDo cumentFragmentScannerImpl.java:329) at org.apache.xerces.parsers.DTDConfiguration.parse(DTDConfiguration.java:5 25) at org.apache.xerces.parsers.DTDConfiguration.parse(DTDConfiguration.java:5 81) at org.apache.xerces.parsers.XMLParser.parse(XMLParser.java:152) at
RE: Servlet Context Listener problem...
Listeners must be declared before any servlets in web.xml. I'd check that first. -Original Message- From: Mufaddal Khumri [mailto:[EMAIL PROTECTED] Sent: Monday, July 14, 2003 6:41 AM To: Tomcat List Subject: Servlet Context Listener problem... Hi: I implemented ServletContextListener in my class. I then wrote the xml in the web.xml file and started tomcat. The error tomcat threw tells me that it did not recognize the listener and listener-class elements ?? i have them declared in the web.xml as: web-app !-- ServletContextListener -- listener listener-class com.wavesinmotion.cw.classes.jsphelpers.CourseWizardContextListener /listener-class /listener /web-app Any ideas where I am going wrong ? Thanks. Tomcat threw this error below: SEVERE: Parse Error at line 10 column 12: Element type listener must be declared. org.xml.sax.SAXParseException: Element type listener must be declared. at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Error HandlerWrapper.java:232) at org.apache.xerces.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.jav a:173) at org.apache.xerces.impl.XMLErrorReporter.reportError(XMLErrorReporter.jav a:371) at org.apache.xerces.impl.XMLErrorReporter.reportError(XMLErrorReporter.jav a:305) at org.apache.xerces.impl.dtd.XMLDTDValidator.handleStartElement(XMLDTDVali dator.java:1833) at org.apache.xerces.impl.dtd.XMLDTDValidator.startElement(XMLDTDValidator. java:724) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanStartElement(X MLDocumentFragmentScannerImpl.java:759) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDis patcher.dispatch(XMLDocumentFragmentScannerImpl.java:1477) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDo cumentFragmentScannerImpl.java:329) at org.apache.xerces.parsers.DTDConfiguration.parse(DTDConfiguration.java:5 25) at org.apache.xerces.parsers.DTDConfiguration.parse(DTDConfiguration.java:5 81) at org.apache.xerces.parsers.XMLParser.parse(XMLParser.java:152) at org.apache.xerces.parsers.AbstractSAXParser.parse(AbstractSAXParser.java :1175) at org.apache.commons.digester.Digester.parse(Digester.java:1495) at org.apache.catalina.startup.ContextConfig.applicationConfig(ContextConfi g.java:282) at org.apache.catalina.startup.ContextConfig.start(ContextConfig.java:639) at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.j ava:243) at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSu pport.java:166) at org.apache.catalina.core.StandardContext.start(StandardContext.java:3567 ) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1188) at org.apache.catalina.core.StandardHost.start(StandardHost.java:738) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1188) at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:347) at org.apache.catalina.core.StandardService.start(StandardService.java:497) at org.apache.catalina.core.StandardServer.start(StandardServer.java:2189) at org.apache.catalina.startup.Catalina.start(Catalina.java:512) at org.apache.catalina.startup.Catalina.execute(Catalina.java:400) at org.apache.catalina.startup.Catalina.process(Catalina.java:180) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav a:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor Impl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:203) Jul 14, 2003 3:56:11 PM org.apache.commons.digester.Digester error SEVERE: Parse Error at line 11 column 19: Element type listener-class must be declared. org.xml.sax.SAXParseException: Element type listener-class must be declared. at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Error HandlerWrapper.java:232) at org.apache.xerces.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.jav a:173) at org.apache.xerces.impl.XMLErrorReporter.reportError(XMLErrorReporter.jav a:371) at org.apache.xerces.impl.XMLErrorReporter.reportError(XMLErrorReporter.jav a:305) at org.apache.xerces.impl.dtd.XMLDTDValidator.handleStartElement(XMLDTDVali dator.java:1833) at org.apache.xerces.impl.dtd.XMLDTDValidator.startElement(XMLDTDValidator. java:724) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanStartElement(X MLDocumentFragmentScannerImpl.java:759