Solved

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

Posted on 2004-04-28
4
7,793 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
  • 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
String format issue 13 90
Clear browser cache on site login, is it possible? 3 24
JSONSerializer.toJSON in JSP generating error 8 64
maven j2ee examles 2 49
Scenario: Your operations manager has discovered an anomaly in your security system. The business will start to suffer within 15 minutes if it is a major IT incident. What should she do? We have 6 recommendations for managing major incidents (https:…
In 2017, ransomware will become so virulent and widespread that if you aren’t a victim yourself, you will know someone who is.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

919 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now