Whenever we open an HTML report from a
JSP we get the error
"Error 500 outputstream already obtained"
Initially we thought the problem was with the output buffer but it was not. Then we tried by removing the out.println statements in JSP code and replace them with simple HTML text outside the JSP tag.
Below is the code where we think the problem might be.
Also whenever the report is displayed the content is shown and the error is shown at the end of the HTML report.
/***************************** My Reports Starts Here ************************/
if (categoryType.equals("SBSCR")) {
if ( reportParameters==null || reportParameters.equals("null") ) {
%>
<script language="javascript">
self.focus();
location.href="<%=reportLocation%>";
</script>
<%
} else {
StringTokenizer st = new StringTokenizer(reportParameters,":=");
//out.println("<br> <b> Please wait while signing on to WebI.</b>");
while ( (st.countTokens() > 1) && (st.hasMoreTokens()) && ( (!WebIFlag) || (!UNEPFlag)) ) {
String key = st.nextToken();
String val = st.nextToken();
if ( (key.equalsIgnoreCase("WebIFlag")) && (val.equalsIgnoreCase("true")) ) {
WebIFlag = true;
} else WebIFlag = false;
if (val.equalsIgnoreCase("UNEPFlag")) {
UNEPFlag = true;
} else UNEPFlag = false;
} // end while
if (UNEPFlag) {
int index = reportParameters.lastIndexOf(':');
reportParameters = reportParameters.substring(0,index);
// System.out.println("Content Retriever");
pageContext.forward("/ContentRetriever?reportName="+reportName+"&reportDate="+reportDate+"&reportLocation=" + reportLocation + reportParameters);
// System.out.println("Content Retriever Out "+reportLocation + reportParameters);
} else {
if (!WebIFlag) {
%> <form name="mysubscriptions" method = "post" action = "<%=reportLocation%>" target="_self">
<input type="hidden" name=SBCUID value='<%=SBCUID.toLowerCase()%>'>
<input type="hidden" name=reportID value='<%=reportID%>'>
<input type="hidden" name=reportDate value='<%=reportDate%>'>
<input type="hidden" name=reportCategory value='<%=categoryID%>'>
<input type="hidden" name=reportParameters value='<%=reportParameters%>'>
<input type="hidden" name=reportName value='<%=reportName%>'>
</form>
<script language="javascript">
self.focus();
document.mysubscriptions.submit();
</script>
<% } else {
reportParameters = reportParameters.replace(':','&');
String plainPasswdStr = getPasswd (out, session);
if ( (plainPasswdStr!=null) && (!plainPasswdStr.equals("") ) ) {
%>
<FORM NAME = "myReportsWebIForm" METHOD = "post" ACTION="<%=reportLocation%>" target="_self">
<INPUT TYPE ="hidden" NAME=SBCUID value="<%=SBCUID.toUpperCase()%>">
<INPUT TYPE ="hidden" NAME=PASSWD value="<%=plainPasswdStr%>">
<INPUT TYPE="hidden" name=reportParameters value='<%=reportParameters%>'>
</FORM>
<script language="javascript">
self.focus();
document.myReportsWebIForm.submit();
</script>
<% } else {
out.println("ERROR: My Reports WEBI SSO - Unable to retrieve Password");
%>
<FORM NAME = "myReportsWebIFailedForm" METHOD = "post" ACTION="<%=reportLocation%>" target="_self">
<INPUT TYPE ="hidden" NAME=SBCUID value="<%=SBCUID.toUpperCase()%>">
<INPUT TYPE="hidden" name=reportParameters value='<%=reportParameters%>'>
</FORM>
<script language="javascript">
document.myReportsWebIFailedForm.submit();
</script>
<%
} // End of if ( (plainStr!=null) && (plainStr.equals("") ) )
} // End of if (!WebIFlag)
} // END of if (UNEPFlag)
} // End if ( reportParameters.equals("null") ) {
} // End of if (mysubscriptions)
/***************************** My Reports Ends *****************************/
/***************************** My Work Group Tools Starts Here ***************/
if ( categoryType.equals("DBRD") ) {
if(applParm!=null && applParm.equals("directSubmitFlag")) {
%>
<script language="javascript">
self.focus();
location.href="<%=url%>";
</script>
<% } else { %>
<form name="myWorkgrouptoolsForm1" method = "post" action="<%=url%>" target="_self"></form>
<script language="javascript">
self.focus();
document.myWorkgrouptoolsForm1.submit();
</script>
<% } //end if direct submit
}
/*************************** My Work Group Tools Ends***************************/
}
else { // else part of if(!sbcuid
%> <script language="javascript">
self.focus();
location.href="<%=url%>";
</script>
<%
} // End if (!SBCUID)
} // End if ((isLogin == null || (categoryTimeout !=0 & maxId )
%>
<%! /*VR6412 Added WEBI SSO Code for My Applications and My Reports*/
private String getPasswd(JspWriter out, HttpSession session) {
String plainStr ="";
try {
byte[] sessionPasswdBytes = (byte[]) session.getAttribute("EncryptedPasswd");
String sessionPasswdStr = new String(sessionPasswdBytes,"UTF8");
ebipCrypto priv = new ebipCrypto();
plainStr = priv.ebipDecryptmethod(sessionPasswdBytes);
} catch(Exception ex){
try {out.println("<br>WEBI Single Sign On - Error Retreiving Password. <br>"); out.println(ex);}
catch(Exception ex1) { }
}
return plainStr;
}
/*VR6412 END - Added WEBI SSO Code for My Applications and My Reports*/
%>
</BODY>
</HTML>
Thanks
Rustic