Jump to content
Changes to the Jaspersoft community edition download ×

Unable to run two JSPs one after the other...


2005 IR Help

Recommended Posts

By: yelena - yelena13

Unable to run two JSPs one after the other...

2001-12-19 17:12

 

Hi,

 

Now I have two JSPs (based on

your JSP example) that

generates reports.

 

I'm can run the first report

multiple time and it is okay...

 

But when I try to bring up the

second JSP (right after the first

one) and it blows up.

 

I'm on a Sun Environment with

Tomcat.

 

It's seems like it is not flushing

properly (I'm doing both

outStream.flush();

outStream.close();)

because sometimes it will

give me a pop up error "File

does not begin with '%PDF'

 

Also I believe it dies during the filling

of the second report...

 

I get the following error:

 

javax.servlet.ServletException: Error evaluating expression value : variableInitialValue_PAGE_NUMBER

at java.lang.Throwable.fillInStackTrace(Native Method)

at java.lang.Throwable.fillInStackTrace(Compiled Code)

at java.lang.Throwable.(Compiled Code)

at java.lang.Exception.(Compiled Code)

at javax.servlet.ServletException.(ServletException.java:161)

at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:459)

at jsp.agentaccount._0002fjsp_0002fagentaccount_0002fsalesReport_0002ejspsalesReport_jsp_0._jspService(_0002fjsp_0002fagentaccount_0002fsalesReport_0002ejspsalesReport_jsp_0.java:210)

at org.apache.jasper.runtime.HttpJspBase.service(Compiled Code)

at javax.servlet.http.HttpServlet.service(Compiled Code)

at org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(Compiled Code)

at org.apache.jasper.servlet.JspServlet.serviceJspFile(Compiled Code)

at org.apache.jasper.servlet.JspServlet.service(Compiled Code)

at javax.servlet.http.HttpServlet.service(Compiled Code)

at org.apache.tomcat.core.ServletWrapper.doService(Compiled Code)

at org.apache.tomcat.core.Handler.service(Compiled Code)

at org.apache.tomcat.core.ServletWrapper.service(Compiled Code)

at org.apache.tomcat.core.ContextManager.internalService(Compiled Code)

at org.apache.tomcat.core.ContextManager.service(Compiled Code)

at org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(Compiled Code)

at org.apache.tomcat.service.TcpWorkerThread.runIt(Compiled Code)

at org.apache.tomcat.util.ThreadPool$ControlRunnable.run(Compiled Code)

at java.lang.Thread.run(Thread.java:479)

 

Root cause:

java.lang.ArrayIndexOutOfBoundsException: 19329024

at dori.jasper.engine.JRCalculator.evaluate(Compiled Code)

at dori.jasper.engine.JRCalculator.initializeVariable(Compiled Code)

at dori.jasper.engine.JRCalculator.initializeVariables(Compiled Code)

at dori.jasper.engine.JRHorizontalFiller.fillReportStart(Compiled Code)

at dori.jasper.engine.JRHorizontalFiller.fillReport(Compiled Code)

at dori.jasper.engine.JRFiller.fillReport(Compiled Code)

at dori.jasper.engine.JasperManager.fillReport(Compiled Code)

at dori.jasper.engine.JasperManager.fillReport(Compiled Code)

 

 

 

 

By: Eric Chan - ericchan001

RE: Unable to run two JSPs one after the other...

2001-12-19 19:37

Hi,

 

I added the outStream.close() call to my JSP and found the same "not begin with %PDF" error. I don't think the call is correct because the log of Tomcat shows that the JSP Servlet engine could not compile the page.

 

Tomcat also shows that the response.getOutputStream() should not be called more than once. This can be done by keeping the outStream as a session data.

 

HTH

 

-- Eric

 

 

 

By: Teodor Danciu - teodord

RE: Unable to run two JSPs one after the other...

2001-12-19 23:47

 

Hi,

 

This seems to be a more complex problem.

 

I don't exactly understand what do you mean by

"running two JSPs one after another".

These two JSPs are similar and differ only by

the fact that they run two different reports?

 

What if you run the second JSP first?

Would the first one still work?

 

If you could send me your JSP code maybe

I'll be able to help or at least identify

the problem.

 

The exception message:

"Error evaluating expression value : variableInitialValue_PAGE_NUMBER"

looks interesting.

 

Thanks,

Teodor

 

 

 

By: yelena - yelena13

RE: Unable to run two JSPs one after the other...

2001-12-20 02:02

 

These are two different JSPs that reads different .jasper files. It doesnt matter

if I run the JSP A or JSP B first. I'm able to

view the first JSP's generated PDF file but

when I try to run the second JSP it

will display the message

above...

 

However...if I just run one JSP...it

will work find no matter how many time

I bring it up.

 

I'm also on a Solaris environment...does

that make any difference???

 

Thanks for your help

 

The code is similar to you example...

 

<%@ page import="dori.jasper.engine.*" %>

<%@ page import="java.util.*" %>

<%@ page import="java.io.*" %>

<%@ page import="java.sql.*" %>

<%@ page import="java.awt.*" %>

 

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<HTML>

<HEAD><TITLE>MOSES</TITLE>

<META CONTENT="text/html; charset=windows-1252" HTTP-EQUIV=CONTENT-TYPE>

<LINK HREF="../jsp/mefngenrl_style.css" REL=STYLESHEET TYPE=TEXT/CSS>

<META CONTENT="MSHTML 5.00.2919.6307" NAME=GENERATOR>

</HEAD>

<%

Calendar rightNow = Calendar.getInstance();

int year = rightNow.get(rightNow.YEAR);

String yearS= String.valueOf(year);

 

String start = request.getParameter("start_date4");

String end = request.getParameter("end_date4");

if((start.equals("") && end.equals(""))

|| (start.equals("") && !end.equals(""))){

start="01/01/".concat(yearS);

end="12/31/".concat(yearS);

}else if(!start.equals("") && end.equals("")){

end="12/31/".concat(yearS);

}

 

JasperReport jasperReport = null;

String fileName = "paymentReport.jasper";

fileName = application.getRealPath(fileName);

jasperReport = JasperManager.loadReport(fileName);

 

 

Map parameters = new HashMap();

parameters.put("ReportTitle1", "MOSES");

parameters.put("ReportTitle2", "Payments Report");

parameters.put("Start", start);

parameters.put("End", end);

parameters.put("Date", new java.util.Date());

 

 

JasperPrint jasperPrint = JasperManager.fillReport(jasperReport, parameters, conn);

 

ByteArrayOutputStream baos = JasperManager.printReportToPdf(jasperPrint);

 

response.setContentType("application/pdf");

response.setContentLength(baos.size());

ServletOutputStream outStream = response.getOutputStream();

baos.writeTo(outStream);

outStream.flush();

outStream.close();

%>

</HTML>

 

 

By: Teodor Danciu - teodord

Try recompile the report

2001-12-20 04:20

 

Hi,

 

I was not able to reproduce your problem.

 

I'm running tomcat 3.2.3 on Windows 2000 and

everything seems to be OK.

I have duplicated the sample report and I have

made a slightly different report called

SecondJasper.jasper. I can run both reports

no matter how many times and no matter

in which order.

 

I suggest you try to recompile your XML and

use the new .jasper file. I suspect there is

a problem with the compiled report file.

 

Maybe you could send me your XML report.

 

Thanks,

Teodor

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...