tags:

views:

223

answers:

1

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>
        </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>

Let me know the problem.Please help on this its very urgent.

A: 

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>
Pat
Thanks its working. If the error message is proper means i could able to understand better.
Jothi