jQuery in Action, 2nd edition*
The moose likes Servlets and the fly likes Multiple Servlet Configuration in web.xml Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Servlets
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: 3344

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: 6661
    
    5

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 - More SCJP Mocks
Rahul Bhattacharjee
Ranch Hand

Joined: Nov 29, 2005
Posts: 2308
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: 61310
    
  66

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


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Multiple Servlet Configuration in web.xml