tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sudhir Movva <SMo...@acninc.com>
Subject RE: Servlet Context Listener problem...
Date Tue, 15 Jul 2003 16:35:42 GMT
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:tomcat-user@johnturner.com] 
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 <mufaddal@wmotion.com> 
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:mufaddal@wmotion.com]
>> 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)
>> 	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 190 column 11: The content of element type
>> "web-app" must match
>> "(icon?,display-name?,description?,distributable?,context-
>> 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*)".
>> org.xml.sax.SAXParseException: The content of element type "web-app"
>> must match
>> "(icon?,display-name?,description?,distributable?,context-
>> 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*)".
>> 	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.handleEndElement(XMLDTDValid 
>> a
>> tor.java:1918)
>> 	at
>> org.apache.xerces.impl.dtd.XMLDTDValidator.endElement(XMLDTDValidator.j 
>> a
>> va:851)
>> 	at
>> org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanEndElement(XM 
>> L
>> DocumentFragmentScannerImpl.java:1008)
>> 	at
>> org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDi 
>> s
>> patcher.dispatch(XMLDocumentFragmentScannerImpl.java:1469)
>> 	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)
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
>



-- 
Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message