开发者

Global Exception in struts2

I am trying to configure Global exceptions in struts.xml. when I include the global-exception mapping tag, the project is not getting start. I am getting the following message in log,

Jul 27, 2010 6:33:07 PM org.apache.catalina.core.StandardContext start
SEVERE: Error filterStart
Jul 27, 2010 6:33:07 PM org.apache.catalina.core.StandardContext start
SEVERE: Context [/ehspreg2] startup failed due to previous errors
log4j:ERROR LogMananger.repositorySelector was null likely due to error in class reloading, using NOPLoggerRepository.

Struts.xml file is,

<package name="default" extends="struts-default">

        <result-types>
            <result-type name="tiles"
                class="org.apache.struts2.views.tiles.TilesResult" />
        </result-types>

        <interceptors>
            <interceptor-stack name="ehspre2stack">
                <interceptor-ref name="paramsPrepareParamsStack">
                    <param name="validation.excludeMethods">
                        list,loadedit,remove,execute,reset
                    </param>
                    <param name="exception.logEnabled">true</param>
                    <param name="exception.logLevel">ERROR</param>
                </interceptor-ref>
            </interceptor-stack>
        </interceptors>


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

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

        <global-results>
            <result name="exception">jsp/common/error.jsp</result>
开发者_如何学Python        </global-results>


        <action name="home">
            <result type="tiles" name="success">showHome</result>
        </action>

        <action name="login"
            class="com.mmm.ehspreg2.web.action.WelcomeAction">
            <result type="tiles" name="local">showLogin</result>
        </action>
</package>


Your <global-exception-mappings> needs to be defined after your <global-results> according to the struts.xml dtd.

    <global-results>
        <result name="exception">jsp/common/error.jsp</result>
    </global-results>

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

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜