aspose file tools
The moose likes Servlets and the fly likes Multiple Servlet Configuration in web.xml Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Servlets
Reply Bookmark "Multiple Servlet Configuration in web.xml" Watch "Multiple Servlet Configuration in web.xml" New topic
Author

Multiple Servlet Configuration in web.xml

Supraja Kannaiyan
Ranch Hand

Joined: Mar 09, 2007
Posts: 41
How to configure multiple Servlets in web.xml.Bcoz i am getting an error like

org.xml.sax.SAXParseException: The content of element type "web-app" must match
"(icon?,display-name?,description?,distributable?,context-param*,servlet*,servl
t-mapping*,session-config?,mime-mapping*,welcome-file-list?,error-page*,taglib*
resource-ref*,security-constraint*,login-config?,security-role*,env-entry*,ejb-
ef*)".
at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(U
known Source)
at org.apache.xerces.util.ErrorHandlerWrapper.error(Unknown Source)
at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
at org.apache.xerces.impl.dtd.XMLDTDValidator.handleEndElement(Unknown
ource)
at org.apache.xerces.impl.dtd.XMLDTDValidator.endElement(Unknown Source

at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanEndElement
Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentConten
Dispatcher.dispatch(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(U
known Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.DTDConfiguration.parse(Unknown Source)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
at org.apache.commons.digester.Digester.parse(Digester.java:1548)
at org.apache.catalina.startup.ContextConfig.applicationConfig(ContextC
nfig.java:282)
at org.apache.catalina.startup.ContextConfig.start(ContextConfig.java:6
9)
at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConf
g.java:243)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(Lifecyc
eSupport.java:166)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:
587)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1188

at org.apache.catalina.core.StandardHost.start(StandardHost.java:754)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1188

at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:36
)
at org.apache.catalina.core.StandardService.start(StandardService.java:
97)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:21
0)
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
java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcce
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:203)
Raghavan Muthu
Ranch Hand

Joined: Apr 20, 2006
Posts: 3327

You can very well do it with individual <servlet> and its appropriate <servlet-mapping> elements.

By looking at the error, i could presume you may NOT have properly nested or closed the xml elements in the web.xml file. Just recheck the web.xml file.

If you have an XML-aware editor like XMLSpy or something, try to open the xml file in that editor. That may help.


Everything has got its own deadline including one's EGO!
[CodeBarn] [Java Concepts-easily] [Corey's articles] [SCJP-SUN] [Servlet Examples] [Java Beginners FAQ] [Sun-Java Tutorials] [Java Coding Guidelines]
Deepak Bala
Bartender

Joined: Feb 24, 2006
Posts: 6588
    
    1

Are you able to open the XML in IE or firefox ? That will check if the XML is well formed. You can map each servlet to a URL pattern using the method mentioned above.


SCJP 6 articles - SCJP 5/6 mock exams - SCJP Mocks - SCJP 5 Mock exam (Word document ) - SCJP 5 Mock exam in Java.Inquisition format
Rahul Bhattacharjee
Ranch Hand

Joined: Nov 29, 2005
Posts: 2300
The validation of the web.xml is failing.Check the web.xml's DTD to find the exact structure of the xml that the container is expecting.


Rahul Bhattacharjee
LinkedIn - Blog
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 56179
    
  13

Originally posted by Supraja Kannaiyan:
Bcoz i am getting an error like ...


"Bcoz" is not a real word. Please use real words when posting to the forums. Abbreviations such as "bcoz" in place of "because" only serve to make your posts more difficult to read and less likely to generate useful responses.

Please read this for more information.

thanks,
bear
JavaRanch sheriff


[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Multiple Servlet Configuration in web.xml
 
Similar Threads
Unwanted error messages on Tomcat 4.1 Catalina Window
Tomcat problem while reading Data from Xml file
*listener* *listener-class*
Problem in BeerAdvice
Error while running tomcat