You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Satheesh Kannan A B <sa...@hcl.com> on 2010/09/02 15:24:04 UTC

org.xml.sax.SAXParseException: The content of element type "package" must match

Hi,

I think it's a existing and resolved issues in struts 2.1.8, since I have googled and searched here but am not able to resolve this.

Currently am configuring interceptors in my struts 2.1.8 application using websphere 6.0.1.
What I have coded is right I think so  and u all please verify it and suggest me the thing to resolve this.
In the below if I remove the interceptors and global exceptions mapping my application working fine.
Am using struts 2.1.8, jdk 6, websphere 6.0.1, xercesImpl-2.8.1

The exception am getting is   give below .........................
[9/2/10 18:41:56:113 IST] 0000002c SystemOut     O 2010-09-02 18:41:56,082 [WebContainer : 0] ERROR com.opensymphony.xwork2.util.DomHelper - The content of element type "package" must match "(result-types?,interceptors?,default-interceptor-ref?,default-action-ref?,default-class-ref?,global-results?,global-exception-mappings?,action*)". at (null:103:12)
org.xml.sax.SAXParseException: The content of element type "package" must match "(result-types?,interceptors?,default-interceptor-ref?,default-action-ref?,default-class-ref?,global-results?,global-exception-mappings?,action*)".
      at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown 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 Source)
      at org.apache.xerces.impl.dtd.XMLDTDValidator.endElement(Unknown Source)
      at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanEndElement(Unknown Source)
      at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
      at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
      at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
      at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
      at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
      at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
      at org.apache.xerces.jaxp.SAXParserImpl.parse(Unknown Source)
      at com.opensymphony.xwork2.util.DomHelper.parse(DomHelper.java:113)
etc..

and my code wat I have implemented given below ........

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC
    "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
    "http://struts.apache.org/dtds/struts-2.0.dtd">
<struts>
      <constant name="struts.objectFactory" value="spring" />
      <constant name="struts.devMode" value="false" />
      <package name="KEW" extends="struts-default" >



            <global-results>
            <result name="ldaperror">/search/ldaperror.jsp</result>
        </global-results>

             <interceptors>
                        <interceptor name="authenticationInterceptor" class="com.aegon.capitalexpiry.web.util.AuthenticationInterceptor"/>
                        <interceptor name="execAndWait" class="org.apache.struts2.interceptor.ExecuteAndWaitInterceptor"/>
                        <interceptor name="fileUpload" class="org.apache.struts2.interceptor.FileUploadInterceptor"/>
                        <interceptor name="i18n" class="com.opensymphony.xwork2.interceptor.I18nInterceptor"/>
                        <interceptor name="logger" class="com.opensymphony.xwork2.interceptor.LoggingInterceptor"/>
                        <interceptor name="modelDriven" class="com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor"/>
                        <interceptor name="scope" class="org.apache.struts2.interceptor.ScopeInterceptor"/>
                        <interceptor name="params" class="com.opensymphony.xwork2.interceptor.ParametersInterceptor"/>
                        <interceptor name="prepare" class="com.opensymphony.xwork2.interceptor.PrepareInterceptor"/>
                        <interceptor name="static-params" class="com.opensymphony.xwork2.interceptor.StaticParametersInterceptor"/>
                        <interceptor name="servlet-config" class="com.opensymphony.xwork2.interceptor.ServletConfigInterceptor"/>
                        <interceptor name="sessionAutowiring" class="com.opensymphony.xwork2.interceptor.SessionContextAutowiringInterceptor"/>
                        <interceptor name="timer" class="com.opensymphony.xwork2.interceptor.TimerInterceptor"/>
                        <interceptor name="token" class="com.opensymphony.xwork2.interceptor.TokenInterceptor"/>
                        <interceptor name="token-session" class="com.opensymphony.xwork2.interceptor.TokenSessionStoreInterceptor" />
                        <interceptor name="validation" class="com.opensymphony.xwork2.interceptor.ValidationInterceptor " />
                        <interceptor name="workflow" class="com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor"/>

                     <interceptor-stack name="defaultStack">
                              <interceptor-ref name="authenticationInterceptor"/>
                                    <interceptor-ref name="fileUpload"/>
                                    <interceptor-ref name="i18n"/>
                                    <interceptor-ref name="logger"/>
                                    <interceptor-ref name="modelDriven"/>
                                    <interceptor-ref name="params"/>
                                    <interceptor-ref name="prepare"/>
                                    <interceptor-ref name="servlet-config"/>
                                    <interceptor-ref name="sessionAutowiring"/>
                                    <interceptor-ref name="timer"/>
                                    <interceptor-ref name="token"/>
                                    <interceptor-ref name="token-session"/>
                                    <interceptor-ref name="validation"/>
                                    <interceptor-ref name="workflow"/>
                                    <interceptor-ref name="static-params"/>
                 </interceptor-stack>
         </interceptors>

            <default-interceptor-ref name="authenticationInterceptor"/>

<default-interceptor-ref name="defaultLoginStack" />

            <default-action-ref name="start" />

            <global-results>
                  <result name="sessionerror">/html/SessionError.html</result>
            </global-results>

            <result name="sessionerror" >/html/SessionError.html</result>

            <global-exception-mappings>
            <exception-mapping exception="java.lang.Exception" result="sessionerror"/>
            </global-exception-mappings>

                  <action name="start" class="startAction">
                  <result name="success">index_kew.jsp</result>
                  </action>

      </package>
</struts>

Thanks  and Regards,

Satheesh Kannan A B


DISCLAIMER:
-----------------------------------------------------------------------------------------------------------------------

The contents of this e-mail and any attachment(s) are confidential and intended for the named recipient(s) only. 
It shall not attach any liability on the originator or HCL or its affiliates. Any views or opinions presented in 
this email are solely those of the author and may not necessarily reflect the opinions of HCL or its affiliates. 
Any form of reproduction, dissemination, copying, disclosure, modification, distribution and / or publication of 
this message without the prior written consent of the author of this e-mail is strictly prohibited. If you have 
received this email in error please delete it and notify the sender immediately. Before opening any mail and 
attachments please check them for viruses and defect.

-----------------------------------------------------------------------------------------------------------------------

RE: org.xml.sax.SAXParseException: The content of element type "package" must match

Posted by Satheesh Kannan A B <sa...@hcl.com>.
Hi,

I tried that all the things are in order and I implemented also. Now its working fine.

Mistake is not in order what they have mentioned result-types?,interceptors?,default-interceptor-ref?,default-action-ref?,default-class-ref?,global-results?,global-exception-mappings?,action.

I resolved it by in the order what they have specified.

Thanks  and Regards,

Satheesh Kannan A B




-----Original Message-----
From: Dave Newton [mailto:davelnewton@gmail.com] 
Sent: Friday, September 03, 2010 4:05 PM
To: Struts Users Mailing List
Subject: Re: org.xml.sax.SAXParseException: The content of element type "package" must match

On Thu, Sep 2, 2010 at 9:24 AM, Satheesh Kannan A B wrote:
> I think it's a existing and resolved issues in struts 2.1.8, since I have googled and searched here but am not able to resolve this.

Really?

> The content of element type "package" must match "(result-types?,interceptors?,default-interceptor-ref?,default-action-ref?,default-class-ref?,global-results?,global-exception-mappings?,action*)".
> ...
>      <package name="KEW" extends="struts-default" >
>            <global-results> ...
>             <interceptors> ...

So, you have a package.

Packages can contain all of the elements shown in the error message.

The elements must be in the order shown in the error message.

The elements in *you* package are *not* in the order shown in the error message.

Hence the error message.

Before spending too much more time on this, I'd try following the DTD
and see if that helps.

Dave

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: org.xml.sax.SAXParseException: The content of element type "package" must match

Posted by Dave Newton <da...@gmail.com>.
On Thu, Sep 2, 2010 at 9:24 AM, Satheesh Kannan A B wrote:
> I think it's a existing and resolved issues in struts 2.1.8, since I have googled and searched here but am not able to resolve this.

Really?

> The content of element type "package" must match "(result-types?,interceptors?,default-interceptor-ref?,default-action-ref?,default-class-ref?,global-results?,global-exception-mappings?,action*)".
> ...
>      <package name="KEW" extends="struts-default" >
>            <global-results> ...
>             <interceptors> ...

So, you have a package.

Packages can contain all of the elements shown in the error message.

The elements must be in the order shown in the error message.

The elements in *you* package are *not* in the order shown in the error message.

Hence the error message.

Before spending too much more time on this, I'd try following the DTD
and see if that helps.

Dave

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org