Hi,
I have a problem running the exception handler in struts 1.3 .
I am using struts modules config/useraccount, config/blogdigest ..etc
defined in web.xml duly.
I have set an exception Handler for java.lang.Exception
<!-- FRAMEWORK CODE Needs to be there in all module. -->
<exception key="error.generalexception"
type="java.lang.Exception"
handler="com.mobchannel.common.exceptionhandlers.GeneralExceptionHandler"
path="/home.jsp"/>
<!-- FRAMEWORK CODE ENDS -->
And In the exception handler I wrote
public class GeneralExceptionHandler
{
public ActionForward execute(Exception arg0, ExceptionConfig arg1,
ActionMapping mapping, ActionForm arg3, HttpServletRequest request,
HttpServletResponse response) throws ServletException {
SecurityContext securityConfig = (SecurityContext)
ConfiguredObjectsFactory.createConfiguredObject(
ConfiguredObjectName.securityContext);
// try {
// response.sendRedirect(request.getContextPath
()+securityConfig.getUserLoginPage());
// }
// catch (IOException e) {
// //LOGGER.error("An Exception occurred", e);
// }
ActionForward forward = new ActionForward();
forward.setRedirect(true);
forward.setPath(securityConfig.getUserLoginPage());
return forward;
// return null;
}
}
If I do this what I got was
http://localhost:8080/mobchannelWEB/adpartner/useraccount/signonflow.do?dispatch=signon
The value of securityConfig.getUserLoginPage() =
useraccount/signonflow.do?dispatch=signon
The action I hit is in adpartner module, which throws an exception. This
then calls the
GeneralExceptionHandler class.
If I use forward.setRedirect(true) I get an InvalidPathException.
SEVERE: Servlet.service() for servlet action threw exception
org.apache.struts.chain.commands.InvalidPathException: No action config
found for the specified url.
There is actionconfig for the path, but is in a different modules' struts
config path.
Please help me. I just need to forward to signon page which is in
useraccount module, whenver an exception occurs. This does not seems to work
for me. What is the reason.
--
Thanks
Arun George