• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Multiple Servlet Configuration in web.xml

 
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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)
 
Ranch Hand
Posts: 3389
Mac MySQL Database Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Bartender
Posts: 6663
5
MyEclipse IDE Firefox Browser Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 2308
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Sheriff
Posts: 67747
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
 
When people don’t understand what you are doing they call you crazy. But this tiny ad just doesn't care:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic