• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Multiple Servlet Configuration in web.xml

 
Supraja Kannaiyan
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • 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)
 
Raghavan Muthu
Ranch Hand
Posts: 3381
Mac MySQL Database Tomcat Server
  • Mark post as helpful
  • send pies
  • 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.
 
Deepak Bala
Bartender
Posts: 6663
5
Firefox Browser Linux MyEclipse IDE
  • Mark post as helpful
  • send pies
  • 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.
 
Rahul Bhattacharjee
Ranch Hand
Posts: 2308
  • Mark post as helpful
  • send pies
  • 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.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64958
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • 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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic