Solved

Parsing exception with <global-exceptions> in struts-config.xml

Posted on 2004-04-28
4
7,867 Views
Last Modified: 2011-08-20
Hi Whenever i Add the global-exception handler to struts-config.xml,the application deployment gives a parsing exception.Though the application seems to be working normal i would like to know why that parsing exception is thrown

I have the following declaration in struts-config.xml
<global-exceptions>
    <exception
      key="qams.exception"
      type="java.lang.Exception"
      handler="com.qas.exceptions.QAMSExceptionHandler"/>
</global-exceptions>

The exception thrown during deployment of application is(the first few lines only)

[ERROR] Digester - -Parse Error at line 701 column 17: The content of element type "struts-config" must match "(data-sources?,form-beans?,global-exceptions?,global-forwards?,action-mappings?,controller?,message-resources*,plug-in*)". <org.xml.sax.SAXParseException: The content of element type "struts-config" must match "(data-sources?,form-beans?,global-exceptions?,global-forwards?,action-mappings?,controller?,message-resources*,plug-in*)".>org.xml.sax.SAXParseException: The
content of element type "struts-config" must match "(data-sources?,form-beans?,global-exceptions?,global-forwards?,action-mappings?,controller?,message-resource
s*,plug-in*)".
        at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Un
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 S
ource)
        at org.apache.xerces.impl.dtd.XMLDTDValidator.endElement(Unknown Source)

        at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanEndElement(Unknow
n Source)
        at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContent
Dispatcher.dispatch(Unknown Source)
        at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Un
known Source)


Any suggestions please
Regards
Dheeraj Bhat
0
Comment
Question by:dheerajbhat
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
4 Comments
 
LVL 7

Expert Comment

by:searlas
ID: 10937669
Does it appear in the correct place in your struts-config?

After form-beans and before global-forwards (or before action-mappings if you have no global-forwards)
0
 
LVL 7

Accepted Solution

by:
searlas earned 250 total points
ID: 10937788
To empahsize, the contents of the struts-config must appear in the correct order:

data-sources?,
form-beans?,
global-exceptions?,
global-forwards?,
action-mappings?,
controller?,
message-resources*,
plug-in*

(? means an item appears 0 or once, * means it can appear any number of times - including 0)
0
 
LVL 1

Author Comment

by:dheerajbhat
ID: 10947149
Hi,
  That worked.
   But is there any documentation which mentions that.I wasnt aware of that there were some ordering of elements in struts-config.Can you specify the URL of the document.

Regards
Dheeraj Bhat
0
 
LVL 7

Expert Comment

by:searlas
ID: 10947249
Sure... you should have a DOCTYPE in your struts-config.xml, as below:

<!DOCTYPE struts-config PUBLIC
          "-//Apache Software Foundation//DTD Struts Configuration 1.1//EN"
          "http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd">


The struts-config.xml must conform to the specification given in the dtd file:
http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd

This is common for XML files, and is worth learning about (a decent XML editor would automatically download the mentioned DTD and highlight any errors for you...)
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Sometimes clients can lose connectivity with the Lotus Notes Domino Server, but there's not always an obvious answer as to why it happens.   Read this article to follow one of the first experiences I had with Lotus Notes on a client's machine, my…
Article by: Justin
In light of the WannaCry ransomware attack that affected millions of Windows machines, you might wonder if your Mac needs protecting. Yes, it does and here is how to do it.
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question