ktrinad Posted August 20, 2006 Share Posted August 20, 2006 By: Javed Momin - javedmomin want a solution for this error 2004-07-28 07:26java.net.ProtocolException: Exceeded stated content-length of: '21885' bytes at weblogic.servlet.internal.ServletOutputStreamImpl.checkCL(ServletOutputStreamImpl.java:219) at weblogic.servlet.internal.ServletOutputStreamImpl.write(ServletOutputStreamImpl.java:170) at javelin.jsp.InterceptingOutputStream.write(InterceptingOutputStream.java:128) at jsp_servlet._resources._jsp.__cpeamanualtaskreport._jspService(CpeaManualTaskReport.jsp:66) at weblogic.servlet.jsp.JspBase.service(JspBase.java:33) at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(ServletStubImpl.java:1053) at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:387) at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:28) at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:27) at com.bea.wlw.netui.pageflow.PageFlowJspFilter.doFilter(PageFlowJspFilter.java:190) at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:27) at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:6316) at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:317) at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:118) at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:3622) at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2569) at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:197) at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:170) By: Chuck Deal - cdeal RE: want a solution for this error 2004-07-28 07:44It looks like you've called setContentLength on the ServletOutputStream and supplied the wrong value. Or perhaps, you didn't call it at all and you should have. By: Mykel Alvis - evilarchitect RE: want a solution for this error 2004-07-28 11:50http://sourceforge.net/forum/forum.php?thread_id=1117740&forum_id=113530 By: Javed Momin - javedmomin RE: want a solution for this error 2004-07-29 06:51In TomCat same code running fine but in weblogic i got this error. So i am not able to get output. So whats the problem with content-length. Is there any setting? By: Mykel Alvis - evilarchitect RE: want a solution for this error 2004-07-29 07:49Post CpeaManualTaskReport.jsp By: Javed Momin - javedmomin RE: want a solution for this error 2004-07-30 03:40<%@page contentType="text/html"%> <html> <head><title>JSP Page</title></head> <body> <%-- <jsp:useBean id="beanInstanceName" scope="session" class="package.class" /> --%> <%-- <jsp:getProperty name="beanInstanceName" property="propertyName" /> --%> <%@ page errorPage="error.jsp" %> <%@ page import="datasource.*" %> <%@ page import="dori.jasper.engine.*" %> <%@ page import="dori.jasper.engine.data.*" %> <%@ page import="java.util.*" %> <%@ page import="java.io.*" %> <%@ page import ="java.sql.*" %> <%@ page import = "java.sql.Timestamp" %> <%@ page import = "java.text.DateFormat" %> <% ServletContext context = config.getServletContext(); String url1 = (String) context.getInitParameter("url"); String driver = (String) context.getInitParameter("driver"); String user = (String) context.getInitParameter("username"); String password = (String) context.getInitParameter("password"); String scheme = request.getScheme(); // http String serverName = request.getServerName(); // hostname.com int serverPort = request.getServerPort(); // 80 String url = scheme+"://"+serverName+":"+serverPort; out.print(url + "<br>"); %> <% String a_start_date = request.getParameter("start_date"); %> <%= a_start_date %> <% String a_end_date = request.getParameter("end_date"); %> <% String from_date = getMyFormatDate(a_start_date); String till_date = getMyFormatDate(a_end_date); %> <br> <%= from_date %> <% File reportFile = new File(application.getRealPath("/Reports/CPEA_ACT_MANUAL.jasper")); Map parameters = new HashMap(); parameters.put("ReportTitle", "Address Report"); parameters.put("BaseDir", reportFile.getParentFile()); parameters.put("url",url); byte[] bytes = JasperRunManager.runReportToPdf(reportFile.getPath(),parameters,new JRCustomDataSource(from_date,till_date,url1,driver,user,password)); response.setContentType("application/pdf"); response.setContentLength(bytes.length); ServletOutputStream ouputStream = response.getOutputStream(); ouputStream.write(bytes, 0, bytes.length); ouputStream.flush(); ouputStream.close(); %> By: Mykel Alvis - evilarchitect RE: want a solution for this error 2004-07-30 07:05Remove the <HTML>,<BODY>, and <HEAD> tags There shouldn't be HTML on this page except the java scriptlet By: Javed Momin - javedmomin RE: want a solution for this error 2004-07-30 07:25I remove all HTML tag then still not get result By: Mykel Alvis - evilarchitect RE: want a solution for this error 2004-07-30 07:32ummm.... out.print(url + "<br>"); Your scriptlet is writing to out. Out is a JspWriter that's using the OutputStream. Stop writing stuff to your output stream that isn't an element of the pdf. By: Javed Momin - javedmomin RE: want a solution for this error 2004-07-30 22:26<% ServletContext context = config.getServletContext(); String url1 = (String) context.getInitParameter("url"); String driver = (String) context.getInitParameter("driver"); String user = (String) context.getInitParameter("username"); String password = (String) context.getInitParameter("password"); String scheme = request.getScheme(); // http String serverName = request.getServerName(); // hostname.com int serverPort = request.getServerPort(); String appname = request.getContextPath(); String url = scheme+"://"+serverName+":"+serverPort; String a_start_date = request.getParameter("start_date"); String a_end_date = request.getParameter("end_date"); String from_date = getMyFormatDate(a_start_date); String till_date = getMyFormatDate(a_end_date); File reportFile = new File(application.getRealPath("//resources//reports//CPEA_ACT_MANUAL.jasper")); Map parameters = new HashMap(); parameters.put("ReportTitle", "Address Report"); parameters.put("BaseDir", reportFile.getParentFile()); parameters.put("url",url); byte[] bytes = JasperRunManager.runReportToPdf( reportFile.getPath(), parameters,new JRCustomDataSource(from_date,till_date,url1,driver,user,password) ); response.setContentType("application/pdf"); response.setContentLength(bytes.length); ServletOutputStream ouputStream = response.getOutputStream(); ouputStream.write(bytes, 0, bytes.length); ouputStream.flush(); ouputStream.close(); %> Still I am getting the same error. I remove all html tag and out.println also By: Mykel Alvis - evilarchitect RE: want a solution for this error 2004-07-31 12:30Make sure the jsp files are deleted. Sometimes (like with Jboss) a redeploy doesn't always delete the java files and the class file that is generated by a jsp compile Otherwise, I'd call it a real problem. Not having access to weblogic, I can't really help much more than that. By: Chuck Deal - cdeal RE: want a solution for this error 2004-08-10 06:25See if you can find the java file that was created from this JSP. Take a look at it and make sure that the generated code is what you expect. From my own experieince, I switched from a JSP to a servlet for this type of task and (even though my JSP worked fine) I "feel" better about the servlet solution. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now