Re: [S2] getOutputStream() has already been called error?

2020-04-09 Thread Burton Rhodes
Thanks Lukasz - I will give that a try!


On Sun, Mar 15, 2020 at 12:43 PM Lukasz Lenart 
wrote:

> wt., 10 mar 2020 o 15:35 Burton Rhodes 
> napisał(a):
> > 
> > 
> > 
> > 
> > 
> > true
> > ERROR
> > 
>
> I would move your "exceptionInterceptor" to be the very first
> interceptor in the stack, it looks like it catches an exception but
> redirect to error.jsp cannot be handled as some response was already
> committed.
>
>
> Regards
> --
> Łukasz
> + 48 606 323 122 http://www.lenart.org.pl/
>
> -
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
>
>


Re: [S2] getOutputStream() has already been called error?

2020-03-15 Thread Lukasz Lenart
wt., 10 mar 2020 o 15:35 Burton Rhodes  napisał(a):
> 
> 
> 
> 
> 
> true
> ERROR
> 

I would move your "exceptionInterceptor" to be the very first
interceptor in the stack, it looks like it catches an exception but
redirect to error.jsp cannot be handled as some response was already
committed.


Regards
-- 
Łukasz
+ 48 606 323 122 http://www.lenart.org.pl/

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



[S2] getOutputStream() has already been called error?

2020-03-10 Thread Burton Rhodes
I am trying to track down a bug in my Struts application and am having
difficulty understanding the cause.  Only about once per week, I get an
"getOutputStream() has already been called" error - see stack trace below.
Anyone experienced this before (and found a solution)?  I have included my
struts interceptor stack, the last "custom" interceptor that is accessed
before the error, and the actual stacktrace.  Just FYI, the
AccountInterceptor class seems to exist successfully at "line 56:  return
invocation.invoke();"

*[struts interceptor stack]*






true
ERROR












input,back,cancel,browse


input,back,cancel,browse




*[Last Interceptor Accessed]*

public class AccountInterceptor extends AbstractInterceptor {

private static final String RESULT_IN_ACTIVE_ACCOUNT = "inActiveAccount";
private static final String RESULT_PASSWORD_RESET = "passwordReset";

@Autowired
private transient AppUserGoalsDao appUserGoalsDao;

@Autowired
private transient MailChimpConnectDao mailChimpConnectDao;

@Autowired
private transient MojoConnectDao mojoConnectDao;

public String intercept(ActionInvocation invocation) throws Exception {

Map session =
invocation.getInvocationContext().getSession();
MyAppSession myAppSession = new MyAppSession(appUserGoalsDao,
mailChimpConnectDao, mojoConnectDao);
myAppSession.setSession(session);

if (myAppSession.getUser()!=null) {

// Redirect if account is "inactive" in some way
if
(!myAppSession.getUser().getTeam().getTeamHelper().getIsTeamAccessAllowed())
{
return RESULT_IN_ACTIVE_ACCOUNT;

// Redirect if password reset required
} else if (myAppSession.getUser().getPasswordChangeRequired()) {
return RESULT_PASSWORD_RESET;
}

} else {
ActionSupport actionSupport = (ActionSupport)
invocation.getAction();
actionSupport.addActionError("Your session has expired or you
are not logged in.");
return ActionSupport.LOGIN;
}

return invocation.invoke();
}

}



*[Log Error]*

Date Thread Level Logger MDC Message
2020-03-09 19:26:39,626 ajp-nio-8009-exec-7 ERROR
org.apache.struts2.dispatcher.DefaultDispatcherErrorHandler Exception
occurred during processing request: java.lang.IllegalStateException:
getOutputStream() has already been called for this response
org.apache.jasper.JasperException: java.lang.IllegalStateException:
getOutputStream() has already been called for this response
at
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:634)
at
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:509)
at
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:386)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:330)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:741)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at
org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:728)
at
org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:591)
at
org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:527)
at
org.springframework.security.web.header.HeaderWriterFilter$HeaderWriterRequestDispatcher.include(HeaderWriterFilter.java:178)
at
org.apache.struts2.result.ServletDispatcherResult.doExecute(ServletDispatcherResult.java:171)
at
org.apache.struts2.result.StrutsResultSupport.execute(StrutsResultSupport.java:206)
at
com.opensymphony.xwork2.DefaultActionInvocation.executeResult(DefaultActionInvocation.java:375)
at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:279)
at
com.afs.web.struts.interceptor.AccountInterceptor.intercept(AccountInterceptor.java:56)
at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)
at
com.afs.web.struts.interceptor.SessionInterceptor.intercept(SessionInterceptor.java:71)
at
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249)
Caused by: java.lang.IllegalStateException: getOutputStream() has already
been called for this response
at org.apache.catalina.connector.Response.getWriter(Response.java:584)
at
org.apache.catalina.connector.ResponseFacade.getWriter(Res