Saqib Ullah

BootStrapper Know How

  Home  |   Contact  |   Syndication    |   Login
  93 Posts | 1 Stories | 341 Comments | 15 Trackbacks

News



Article Categories

Archives

Post Categories

Blogging websites

Favourite Blogs

Private Links

Sites

This is a very common error in Crystal Report when its give this following message.
"The maximum report processing jobs limit configured by your system administrator has been reached."
I have been read about its on lot forums and new groups. Its actually means that Crystal Report print job limit has been reached and you should handle this problem by increasing the job limit in the registry. The basic reason of this problem is Garbag Collector (GC) cannot clear the reference of report document in their collection process its only clear report viewer.
HKEY_LOCAL_MACHINE\SOFTWARE\CRYSTAL DECISIONS\10.0\REPORT APPLICATION SERVER\SERVER\PrintJobLimit
Yesterday we also facing this problem in our application and after lot of discussion in the team we find out a good solution of this problem in the form following factory class because we not facing this problem in whole application.

using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using CrystalDecisions;
using CrystalDecisions.CrystalReports;
using CrystalDecisions.CrystalReports.Engine;

namespace Test.Utilities
{
    public class ReportFactory
    {
        protected static Queue reportQueue = new Queue();

        protected static ReportClass CreateReport(Type reportClass)
        {
            object report = Activator.CreateInstance(reportClass);
            reportQueue.Enqueue(report);
            return (ReportClass)report;
        }

        public static ReportClass GetReport(Type reportClass)
        {

            //75 is my print job limit.
            if (reportQueue.Count > 75) ((ReportClass)reportQueue.Dequeue()).Dispose();
            return CreateReport(reportClass);
        }
    }
}


You can use this ReportFactory class for creating ReportClass object and don’t need to call explicitly dispose method on the page because ReportFactory class will automatically dispose it when count reach to 75.
posted on Tuesday, July 17, 2007 6:42 PM

Feedback

# re: Maximum report processing jobs limit issue in Crystal Report 7/18/2007 7:43 PM CoolDB
am also facing this problm in my application, and i guess ur code will solve my problem, but i didnt understand some of ur code, could u add comments in the code so it can be more clearer to us,,,,
ur effort is highly appreciated

TQ

# re: Maximum report processing jobs limit issue in Crystal Report 7/20/2007 12:06 AM Mohd Marzuq Ikram
Greetings,

I'm facing the same problem over and over and have no idea on how to use the code..Care to give more details on how should I implement it my application?

# re: Maximum report processing jobs limit issue in Crystal Report 7/23/2007 5:59 AM HMS
Thanks for the post. We have the same problem in an ASP.NET application. Can this code be used in .NET to clean-up. We have increased the registry setting and this helped tremendously but we still have too many open database connections. Fortunately the database connections to eventually close on their own.

# re: Maximum report processing jobs limit issue in Crystal Report 8/2/2007 9:53 PM Ganesh
Nice Post. I think I will have big relief how to Implement this code in my Page. I need to open two reports in the same .aspx page. How to handle it with the code.?

Thanks

# re: Maximum report processing jobs limit issue in Crystal Report 8/29/2007 8:10 AM halsa
Hi,

Nice Post, I have a quick questions where should we call this in application.

Thanks
halsa

# re: Maximum report processing jobs limit issue in Crystal Report 9/20/2007 5:08 PM Tanveer Ahmed Asim
Nice effort.In all feed backs replying persons demanded the way to utilize this class in their code.So plz include a sample code to utilize this class also in your post.
Thanx Tanveer Ahmed Asim


# re: Maximum report processing jobs limit issue in Crystal Report 10/2/2007 9:47 PM Yogesh
I guess, this approach has a flaw... It will get your server to utilize memory for 75 reports and then dispose everything.

Instead, in the page unload method, ensure to call Close() and Dispose() method on the ReportDocument object.

Do not expect a reply from me as i am a passer-by.

# re: Maximum report processing jobs limit issue in Crystal Report 10/23/2007 9:56 AM Paul
This code doesn't make any sense. Why don't you just Dispose() the object after you are done with it. You are basically creating a GC class because the rest of your code is not coded correctly.

After you have created the ReportDocument and are done using it ensure that you Close the object and Dispose the object then this error will go away. If you never Dispose of it, Crystal will keep it around for ever and you will get this error.


# re: Maximum report processing jobs limit issue in Crystal Report 10/23/2007 10:20 AM Paul
The more I think about it there is one case where this code would work and that is if you are using a call like crDocument.ExportToHTTPResponse. Since this call does not return if are directing it to the Window and not as an attachment. The code after it will never get called (IE the Dispose() or Close() calls) and you will run into this problem. There is really only one way around this.

MemoryStream oStream;
Response.Clear();
Response.Buffer = true;

ReportDocument crReportDocument = new ReportDocument();
crReportDocument.Load("c:\\Inetpub\\wwwroot\\ContainerRepair\\EstimateOfRepairs.rpt");
crReportDocument.SetParameterValue(0, eirID);
crReportDocument.SetDatabaseLogon("xxx", "xxx", "xxx", "xxx");
oStream = (MemoryStream)crReportDocument.ExportToStream(ExportFormatType.PortableDocFormat);
(ExportFormatType.PortableDocFormat, Response, false, "");
Response.ContentType = "application/pdf";
crReportDocument.Close();
crReportDocument.Dispose();
try
{
Response.BinaryWrite(oStream.ToArray());
Response.End();
}
catch (Exception)
{
}
finally
{
oStream.Flush();
oStream.Close();
oStream.Dispose();
}

Hopefully this will help someone out!

# re: Maximum report processing jobs limit issue in Crystal Report 10/23/2007 10:21 AM Paul
Oops remove this line:

(ExportFormatType.PortableDocFormat, Response, false, "");


# re: Maximum report processing jobs limit issue in Crystal Report 12/12/2007 10:32 PM Mohammad Rizwan
call the method of Dispose and Close of ReportDocument Object in Page Unload Method

# re: Maximum report processing jobs limit issue in Crystal Report 1/10/2008 6:08 AM Hugo Riquelme
Estimados yo tengo una solucion a este problema, el reporte se deberia limpiar de la siguiente manera.

I HAVE THIS SOLUTION!!!


using System;
using CrystalDecisions.CrystalReports.Engine;
using CrystalDecisions.Shared;
using System.Configuration;

public partial class ShowReport : System.Web.UI.Page{

ReportDocument myReportDocument = new ReportDocument();

protected void Page_Load(object sender, EventArgs e){

myReportDocument.Load(Server.MapPath("valida_statement.rpt"));
CrystalReportViewer1.ReportSource = myReportDocument;
CrystalReportViewer1.DataBind();
}

protected void CrystalReportViewer1_Unload(object sender, EventArgs e){
myReportDocument.Close();
myReportDocument.Dispose();
}
}

# re: Maximum report processing jobs limit issue in Crystal Report 2/7/2008 7:31 AM SrI
Try this one it worked for me .......n is easy to implement

go to run:

type : regedit

HKEY_LOCAL_MACHINE/SOftware/Crystal Decisions/Report Application Server/InprocServer/ReportDocument

Change the value of the field MaxNumOfRecords to -1(For Unlimited No. of records)

The Crystal Reports registry path may vary with the version so change accordingly

# re: Maximum report processing jobs limit issue in Crystal Report 2/8/2008 3:48 AM Paulo Gonçaves
Great article!
Based in your article I constructed a more extense report factory, that keeps ReportDocuments in ASP cache and dispose them when necessary.
I can show the code if anyone wants.

# re: Maximum report processing jobs limit issue in Crystal Report 2/8/2008 8:49 AM Chad Christiansen
Paulo, I vote for showing the code. :)

# re: Maximum report processing jobs limit issue in Crystal Report 2/13/2008 4:02 AM John Thalluri
Please do send me the code to the following address above. Your messages where really good.

# re: Maximum report processing jobs limit issue in Crystal Report 2/19/2008 3:52 AM Paulo Gonçaves
Hi,
Sorry about the elapsed time.
Here is the code:
http://download.yousendit.com/9CFF26CF50753ED3

I tested it and the job limit isn't a problem now, the reports go to the cache enabling fast report preview, and when the print job limit is reached the old reports are disposed, or when the server needs to clean the cache.

# re: Maximum report processing jobs limit issue in Crystal Report 2/26/2008 10:25 AM Kevin
I took Paul's code translated it to VB.net and put it in a sub. Works, we'll see if it handles the problem going forward on the production box. See code below:

Private Sub BetterExportToHTTPResponse(ByRef crReportDocument As ReportDocument)
Dim oStream As MemoryStream

Response.Clear()
Response.Buffer = True


oStream = CType(crReportDocument.ExportToStream(ExportFormatType.PortableDocFormat), MemoryStream)
Response.ContentType = "application/pdf"

crReportDocument.Close()
crReportDocument.Dispose()

Try
Response.BinaryWrite(oStream.ToArray())
Response.End()
Catch ex As Exception

Finally
oStream.Flush()
oStream.Close()
oStream.Dispose()
End Try

End Sub

# re: Maximum report processing jobs limit issue in Crystal Report 3/5/2008 9:57 PM Ashish
Gr8 article....I am getting the same error ..will try the soluitons mentioned above.

# re: Maximum report processing jobs limit issue in Crystal Report 3/10/2008 4:59 PM Ashish
Is there any other solutuion for this?
is the print limit editable?


# re: Maximum report processing jobs limit issue in Crystal Report 3/26/2008 4:17 PM Peter Redei
The PrintJobLimit has a good reason that is it prevents excessive memory usage in cases when the memory is not freed (disposed). I found the best solution is to keep track of the number of open documents by serializing them. Also keep track of the lowest serial number still not disposed. When the number of open documents reaches the limit in the registry close and dispose the lowest serial number document, advance the lowest serial number with one and you are fine. Most likely the document associated with the lowest serial number is no longer used, so disposing it will cause no problem.

# re: Maximum report processing jobs limit issue in Crystal Report 3/31/2008 1:07 AM Anders
Ive edited registry key and using close and dipose on the reports but still getting this error.

I want to try to use the code to dispose in the queue but i dont really get how i should use ?

Im load my report with crystal helper

# re: Maximum report processing jobs limit issue in Crystal Report 4/17/2008 9:23 PM steven lim
did any one know that other reporting software can replace the crystal report?

# re: Maximum report processing jobs limit issue in Crystal Report 4/20/2008 7:43 PM ravi
use this this will work definitely because i solve my problem with these line here is doc is document object

doc.Close();
doc.Dispose();
doc = null;
GC.Collect();
GC.WaitForPendingFinalizers();

# re: Maximum report processing jobs limit issue in Crystal Report 6/27/2008 6:25 PM santosh kumar
use this code in your.

Protected Sub CrystalReportViewer_Unload(ByVal sender As Object, ByVal e As System.EventArgs) Handles CrRptViewerPendPO.Unload

reportdocument1.Dispose()
reportdocument1.Close()


End Sub



and reset iis, using command prompt u can do this like

c:/> iisreset

now the problem should be resolved.




# re: Maximum report processing jobs limit issue in Crystal Report 7/17/2008 5:49 PM Peeyush
sir Pls hep me how to use this code

# re: Maximum report processing jobs limit issue in Crystal Report 7/27/2008 10:03 PM Aaron
Quick Q - If the user closes the web page, the 'CrystalReportViewer_Unload' is NOT raised...therefore the dispose/close methods of the report document are not performed - is this statement correct??

# re: Maximum report processing jobs limit issue in Crystal Report 7/29/2008 3:41 PM Greg
Has anyone found a complete code example that works or have you been successful using the following code in the Page_Unload or CrystalReportsViewer_Unload Events

reportdocument1.Dispose()
reportdocument1.Close()

when you have a post-back due to user entered parameters from controls (e.g. Date from Calendar control)

I am getting an Object reference not set to an instance of an object because my reportdocument object is gone.

Any help is greatly appreciated



# re: Maximum report processing jobs limit issue in Crystal Report 8/5/2008 2:10 AM Rajesh
Has anyone found a complete code example that works or have you been successful using the following code in the Page_Unload or CrystalReportsViewer_Unload Events

reportdocument1.Dispose()
reportdocument1.Close()

when you have a post-back due click record (page ) navigation , I am getting an Object reference not set to an instance of an object because my reportdocument object is gone.

Any one got solution for this please reply.

# re: Maximum report processing jobs limit issue in Crystal Report 8/7/2008 9:01 PM Rajesh
any one got latest update on this plz..

# re: Maximum report processing jobs limit issue in Crystal Report 9/8/2008 8:30 PM Paulo Gonçalves
You can dispose document if you generate a pdf for example, in this case you don't need to keep de reportDocument in use. If you dispose the document theres no problem.

But if you need to use crystal previewer you should keep the reportDocument to make the navigation fast in the viewer, like on changing page.
In this case you should keep track of open documents and when crystal limit is reached you must dispose reportDocuments to make possible the processement of new ones.


# re: Maximum report processing jobs limit issue in Crystal Report 9/11/2008 1:49 AM pintu
Paulo,
Can you provide the code example for tracking open documeng?

Thanks

# re: Maximum report processing jobs limit issue in Crystal Report 9/14/2008 10:06 PM Paulo Gonçalves
I created a class ReportInfo that contains a Report and creation Date, I put this in an HashTable with a GUI key, and keep it in .Net Cache.
When cache is clean all reports are disposed, or when the crystal limit is reached, the old report is disposed.
I don't have the code in this moment, I will put it later.

# re: Maximum report processing jobs limit issue in Crystal Report 10/2/2008 9:32 AM BobH
Rajesh, This is how I'm doing it.

Private Sub PayStub1_Unload(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Unload
If oRpt IsNot Nothing Then
If oRpt.IsLoaded Then
oRpt.Close()
End If
oRpt.Dispose()
End If
End Sub

# re: Maximum report processing jobs limit issue in Crystal Report 10/10/2008 9:49 PM rajasaravanan
hi,
i am facing the same problem i enclose my coding pl help me

page_load
dim absrpt as report document
dim str as string
str = server.mappath("ReportName.rpt")
absrpt.load(str)
crystalreportviewer1.reportsource = absrpt

page_unload
absrpt.close()
absrpt.dispose()

it will not working pl tell me any other solution

Regards,
RAJASARAVANAN


# re: Maximum report processing jobs limit issue in Crystal Report 10/14/2008 8:38 PM çağlar akbıyık
hi. I do not use crystalreport on page load. Used it under Button1_Click.
so how can I use rp.close() and rp.dispose() functions ?
Or how can I define CrystalReportViewer1 on page unload ?


# re: Maximum report processing jobs limit issue in Crystal Report 10/15/2008 1:03 AM çağlar akbıyık
protected void CrystalReportViewer1_Unload(object sender, EventArgs e)
{

rp.Close();

rp.Dispose(); protected void Page_Load(object sender, EventArgs e)
{

DataSet dsCrystal = new DataSet();
WebProcess.Service Rapor = new WebProcess.Service();
dsCrystal = Rapor.getRapor(plaka, Convert.ToDateTime("01.01.2000"), Convert.ToDateTime("2008-10-20"));

rp.Load(Server.MapPath("../deneme.rpt"));
rp.Database.Tables[0].SetDataSource(dsCrystal.Tables["Table"]);
CrystalReportViewer1.ReportSource = rp;

}

protected void CrystalReportViewer1_Unload(object sender, EventArgs e)
{
rp.Close();
rp.Dispose();
}

}

this is my code. But code gives the same error."Maximum report processing jobs .."
dispose doesnt work or other problem ?



çağlar



# re: Maximum report processing jobs limit issue in Crystal Report 10/16/2008 10:25 PM Nalaka
How to use this...
Please help...

# re: Maximum report processing jobs limit issue in Crystal Report 10/22/2008 10:55 AM Dimitri
I appreciate all the code, as I too have had the same problem. I am using the built in function to export to PDF, so therefore, I cannot have any code following the Export call. It just wont ever get to it. Paul presents a nice solution to work around this issue, but I did not want to add complexity.
I came up with the following solution

public partial class Default2 : System.Web.UI.Page
{
private ReportDocument myReportDocument;

protected void Page_Load(object sender, EventArgs e)
{
myReportDocument = new ReportDocument();
}
...
protected void Page_Unload(object sender, EventArgs e)
{
myReportDocument.Close();
myReportDocument.Dispose();
}

...

As you can see, I took out all the local reportdocuments that I had, and the local constructors. Just have the class variable, and the constructor in Page_Load. And then the Close and Dispose in the Page_Unload.

I tested this with the PrintLimit set to 1. So that the first report would print, and the second one would fail. With this solution, it worked way past the limit.

Good Luck, and thank you all again for your suggestions
-Dimitri


# re: Maximum report processing jobs limit issue in Crystal Report 11/6/2008 8:53 PM AreYouMe
The only thing that i affair would this report factory kill out my unreleased job together with my completed job?

#  Maximum report processing jobs limit issue in Crystal Report 11/12/2008 8:39 AM tubax
protected void Page_Load(object sender, EventArgs e)
{
con = new SqlConnection(str);
con.Open();
report.Load(Server.MapPath("CrystalReport2.rpt"));
CrystalReportViewer1.ReportSource = report;
CrystalReportViewer1.DataBind();
}
protected void ddl_report_SelectedIndexChanged(object sender, EventArgs e)
{
string dt = ddl_report.SelectedValue;
report.SetParameterValue("chkdate", dt);
//CrystalReportViewer1.ReportSource = report;
}
protected void CrystalReportViewer1_Unload(object sender, EventArgs e)
{
report.Close();
report.Dispose();
}

hai i used like above but the error repeat what can i do?

# re: Maximum report processing jobs limit issue in Crystal Report 12/4/2008 12:44 AM Çağlar Akbıyık


use it ;

protected void CrystalReportViewer1_Unload(object sender, EventArgs e)
{
rp.Close();
rp.Dispose();
}

But DONT FORGET-> open the Unload mode from properties..

# re: Maximum report processing jobs limit issue in Crystal Report 12/16/2008 2:17 AM Manivelan
HI Guys,
I have a simple solution just 3 simple steps

this works even if you provide parameter values with controls
and post back the data .


1)declare the reportdocument object as private
2)code in page_load
3)free the reportdocument's resource in page_unload

1)Private repdoc As New ReportDocument


2)Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

''your code to manipulate the reportdocument goes here

End Sub



3)Protected Sub Page_Unload(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Unload
Try

If Page.IsPostBack Then

If repdoc IsNot Nothing Then
If repdoc.IsLoaded Then
repdoc.Close()
End If
repdoc.Dispose()
End If

End If

Catch ex As Exception
Throw New Exception(ex.ToString)
Finally
GC.Collect()
End Try

End Sub


# re: Maximum report processing jobs limit issue in Crystal Report 1/12/2009 4:44 AM declan calpin
i am getting an error which is saying object is not set to an instance of an objec. this happens on the page.unload event. here is the code.

Partial Class idocsreports
Inherits System.Web.UI.Page
Private myReportDocument As New CrystalDecisions.CrystalReports.Engine.ReportDocument

Protected Sub display_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles ButtonDisplay.Click
Try
myCrystalReportViewer.Visible = True
myCrystalReportViewer.ParameterFieldInfo.Clear()
myReportDocument = New CrystalDecisions.CrystalReports.Engine.ReportDocument
myReportDocument.Load(Server.MapPath("Reports/").ToString + reportsDropDownList.SelectedItem.Text + ".rpt")
myReportDocument.FileName = (Server.MapPath("Reports/").ToString + reportsDropDownList.SelectedItem.Text + ".rpt")
Session("myReportDocument") = myReportDocument
ConfigureCrystalReports()

Catch ex As Exception

End Try
End Sub
Private Sub ConfigureCrystalReports()
Dim myConnectionInfo As ConnectionInfo = New ConnectionInfo()
myConnectionInfo.ServerName = "test"
myConnectionInfo.DatabaseName = "test"
myConnectionInfo.UserID = "test"
myConnectionInfo.Password = "test"
SetDBLogonForReport(myConnectionInfo, myReportDocument)

myCrystalReportViewer.ReportSource = myReportDocument
End Sub
Private Sub SetDBLogonForReport(ByVal myConnectionInfo As ConnectionInfo, ByVal myReportDocument As ReportDocument)
Dim myTables As Tables = myReportDocument.Database.Tables

For Each myTable As CrystalDecisions.CrystalReports.Engine.Table In myTables
Dim myTableLogonInfo As TableLogOnInfo = myTable.LogOnInfo
myTableLogonInfo.ConnectionInfo = myConnectionInfo
myTable.ApplyLogOnInfo(myTableLogonInfo)
Next
End Sub
Protected Sub Page_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Init
myReportDocument = CType(Session("myReportDocument"), CrystalDecisions.CrystalReports.Engine.ReportDocument)
myCrystalReportViewer.ReportSource = myReportDocument
End Sub
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Not Page.IsPostBack Then
myCrystalReportViewer.Visible = False
End If
End Sub

'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

Protected Sub Page_Unload(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Unload
' myReportDocument = New ReportDocument
myReportDocument.Close()
myReportDocument.Dispose()
'Try
' If Page.IsPostBack Then
' If Not (myReportDocument Is Nothing) Then
' If myReportDocument.IsLoaded Then

' End If

' End If
' End If
'Catch extest As Exception

'Finally
' GC.Collect()
'End Try
End Sub

End Class

# re: Maximum report processing jobs limit issue in Crystal Report 1/19/2009 10:12 PM declan calpin
Partial Class test
Inherits System.Web.UI.Page
Private myReportDocument As New CrystalDecisions.CrystalReports.Engine.ReportDocument

Protected Sub display_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles ButtonDisplay.Click
Try
ButtonDisplay.Enabled = False
myCrystalReportViewer.Visible = True
myCrystalReportViewer.ParameterFieldInfo.Clear()
myReportDocument = New CrystalDecisions.CrystalReports.Engine.ReportDocument
myReportDocument.Load(Server.MapPath("Reports/").ToString + reportsDropDownList.SelectedItem.Text + ".rpt")
myReportDocument.FileName = (Server.MapPath("Reports/").ToString + reportsDropDownList.SelectedItem.Text + ".rpt")
Session("myReportDocument") = myReportDocument
ConfigureCrystalReports()

Catch ex As Exception

End Try
End Sub
Private Sub ConfigureCrystalReports()
Dim myConnectionInfo As ConnectionInfo = New ConnectionInfo()
myConnectionInfo.ServerName = "test"
myConnectionInfo.DatabaseName = "test"
myConnectionInfo.UserID = "test"
myConnectionInfo.Password = "test"
SetDBLogonForReport(myConnectionInfo, myReportDocument)

myCrystalReportViewer.ReportSource = myReportDocument

End Sub
Private Sub SetDBLogonForReport(ByVal myConnectionInfo As ConnectionInfo, ByVal myReportDocument As ReportDocument)
Dim myTables As Tables = myReportDocument.Database.Tables

For Each myTable As CrystalDecisions.CrystalReports.Engine.Table In myTables
Dim myTableLogonInfo As TableLogOnInfo = myTable.LogOnInfo
myTableLogonInfo.ConnectionInfo = myConnectionInfo
myTable.ApplyLogOnInfo(myTableLogonInfo)
Next
End Sub
Protected Sub Page_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Init
If Not myReportDocument Is Nothing Then
myReportDocument.Close()
myReportDocument.Dispose()
GC.Collect()
End If
myReportDocument = CType(Session("myReportDocument"), CrystalDecisions.CrystalReports.Engine.ReportDocument)
myCrystalReportViewer.ReportSource = myReportDocument

End Sub
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Not Page.IsPostBack Then
myCrystalReportViewer.Visible = False
End If
End Sub

Protected Sub reportsDropDownList_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles reportsDropDownList.SelectedIndexChanged
ButtonDisplay.Enabled = True
End Sub
End Class

here is the code which i finally got to work. i was not using page load for my report but a button click so i had to modify mine a bit. hope this helps someone.

# re: Maximum report processing jobs limit issue in Crystal Report 2/4/2009 6:33 PM Mayank
hi,
i am facing the same problem please help me
problem

This is my code

myReportDocument.SetDataSource(oDt);
MemoryStream oStream;
oStream = (MemoryStream)myReportDocument.ExportToStream(CrystalDecisions.Shared.ExportFormatType.Excel);
Response.AddHeader("Content-Disposition", "attachment; filename=" + "Report.xls");
Response.Buffer = true;
Response.ContentType = "application/Excel";
Response.BinaryWrite(oStream.ToArray());
Response.End();

oStream.Dispose();
oDt.Dispose();
myReportDocument.Close();
myReportDocument.Dispose();

# re: Maximum report processing jobs limit issue in Crystal Report 2/4/2009 6:33 PM Mayank
hi,
i am facing the same problem please help me
problem

This is my code

myReportDocument.SetDataSource(oDt);
MemoryStream oStream;
oStream = (MemoryStream)myReportDocument.ExportToStream(CrystalDecisions.Shared.ExportFormatType.Excel);
Response.AddHeader("Content-Disposition", "attachment; filename=" + "Report.xls");
Response.Buffer = true;
Response.ContentType = "application/Excel";
Response.BinaryWrite(oStream.ToArray());
Response.End();
oStream.Dispose();
oDt.Dispose();
myReportDocument.Close();
myReportDocument.Dispose();

# re: Maximum report processing jobs limit issue in Crystal Report 2/10/2009 8:31 PM Thant Zin
Hi,

I also accept the idea of your post. I just changed a little as the following. Thanks.

using System;
using System.Data;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using CrystalDecisions;
using CrystalDecisions.CrystalReports;
using CrystalDecisions.CrystalReports.Engine;


public class ReportFactory
{
protected static Queue reportQueue = new Queue();
protected static int iMaxCount = 5;

protected static ReportDocument CreateReport(Type reportClass)
{
object report = Activator.CreateInstance(reportClass);
reportQueue.Enqueue(report);
return (ReportDocument)report;
}

public static ReportDocument GetReport(Type reportClass)
{
if (reportQueue.Count > iMaxCount)
{
((ReportDocument)reportQueue.Dequeue()).Close();
((ReportDocument)reportQueue.Dequeue()).Dispose();
GC.Collect();
}
return CreateReport(reportClass);
}
}

//The following is to call the function.
CrystalDecisions.CrystalReports.Engine.ReportDocument crReportDocument = new ReportDocument();
crReportDocument = new ReportDocument();
crReportDocument = ReportFactory.GetReport(crReportDocument.GetType());

Hope this helps some one.

Rgds,
Thant Zin

# re: Maximum report processing jobs limit issue in Crystal Report 2/11/2009 3:10 AM Dan Pearce
Here is what you do.

1. Create a sub that displays a report in the viewer.
2. When you call that sub save a copy of the reportfile name to a session variable.

pn_SortOptions.Visible = False
cr_Rpt.Load(AppPath & "/rptPastDue.rpt")
cr_Rpt.SetParameterValue("resort", strLocation)
Session("objCurReport") = cr_Rpt
CRViewer.ReportSource = cr_Rpt
Session("RptName") = RPTPASTDUE

3. Page_unload event should look like this:

Protected Sub Page_Unload(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Unload
Try
cr_Rpt.Close()
cr_Rpt.Dispose()
GC.WaitForPendingFinalizers()
GC.Collect()
Catch ex As Exception
Throw ex
End Try
End Sub

4. in Page load you will need to test for postback and session expiration:

If IsPostBack Then
If Session("rptname") IsNot Nothing Then
ReportDisp(Session("rptname"))
Else
'session has timed out and we lost which report we were using.
mbox.Alert("Your session has timed out please click the REPORT button to restart.")
End If
End If


So what you do is create and destroy the report and viewer on every load and all postbacks. This will keep the stack and memory clear and prevent the -75 limit error. This is the only method I have found to work.


HTH,
Dan...

# re: Maximum report processing jobs limit issue in Crystal Report 2/11/2009 8:33 PM mexdu
i am just try the above comments but still my session timeout problem is exist.please any one who can tell me what i have to do please.

# re: Maximum report processing jobs limit issue in Crystal Report 2/11/2009 8:34 PM mexdu
please any one who can tell me what i have to do please.i am just try the above comments but still my session timeout problem is exist.

# re: Maximum report processing jobs limit issue in Crystal Report 3/16/2009 11:35 PM Er.Bipin Kumar
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

Dim CRept As New ReportDocument 'CrystalDecisions.CrystalReports.Engine.ReportDocument

CrystalReportViewer1.SelectionFormula = "{FeeStructure.Correspondence}=" & Varcrid & " And {FeeStructure.Sessionid} =" & Varsid

CRept.Load(Server.MapPath("FeeStructure.rpt"))

For Each myTable In CRept.Database.Tables
myLogin = myTable.LogOnInfo
myLogin.ConnectionInfo.ServerName = strServer
myLogin.ConnectionInfo.DatabaseName = strDatabase
myLogin.ConnectionInfo.Password = strPWD
myLogin.ConnectionInfo.UserID = strUID
myTable.ApplyLogOnInfo(myLogin)
Next

CrystalReportViewer1.ReportSource = CRept
CrystalReportViewer1.RefreshReport()

End Sub

Protected Sub Page_Unload(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Unload
CRept.Close()
CRept.Dispose()
End Sub

Protected Sub CrystalReportViewer1_Unload(ByVal sender As Object, ByVal e As System.EventArgs) Handles CrystalReportViewer1.Unload
CRept.Close()
CRept.Dispose()
End Sub




# re: Maximum report processing jobs limit issue in Crystal Report 3/16/2009 11:59 PM Er.Bipin Kumar
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

Dim CRept As New ReportDocument 'CrystalDecisions.CrystalReports.Engine.ReportDocument

CrystalReportViewer1.SelectionFormula = "{FeeStructure.Correspondence}=" & Varcrid & " And {FeeStructure.Sessionid} =" & Varsid

CRept.Load(Server.MapPath("FeeStructure.rpt"))

For Each myTable In CRept.Database.Tables
myLogin = myTable.LogOnInfo
myLogin.ConnectionInfo.ServerName = strServer
myLogin.ConnectionInfo.DatabaseName = strDatabase
myLogin.ConnectionInfo.Password = strPWD
myLogin.ConnectionInfo.UserID = strUID
myTable.ApplyLogOnInfo(myLogin)
Next

CrystalReportViewer1.ReportSource = CRept
CrystalReportViewer1.RefreshReport()

End Sub

Protected Sub Page_Unload(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Unload
CRept.Close()
CRept.Dispose()
End Sub

Protected Sub CrystalReportViewer1_Unload(ByVal sender As Object, ByVal e As System.EventArgs) Handles CrystalReportViewer1.Unload
CRept.Close()
CRept.Dispose()
End Sub



# re: Maximum report processing jobs limit issue in Crystal Report 3/20/2009 2:18 AM Doug Morton
Hi - I have added this to my report but am STILL getting the error:

protected void Page_Unload(object sender, EventArgs e)
{
crDocument.Close();
crDocument.Dispose();
//initiate the garbage collector
GC.Collect();
GC.WaitForPendingFinalizers();
}

Has anyone got a clue what else could be causing it?

# re: Maximum report processing jobs limit issue in Crystal Report 4/26/2009 7:29 PM Suresh
Try this one it worked for me and it is easy to implement

go to run:

type : regedit

HKEY_LOCAL_MACHINE/SOftware/Crystal Decisions/Report Application Server/Server

Select Server ----> Right Side shows the Print Job Limit. No w you have to Modify the Value.



# re: Maximum report processing jobs limit issue in Crystal Report 4/28/2009 10:58 AM John Stevens
Using this method:

using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using CrystalDecisions;
using CrystalDecisions.CrystalReports;
using CrystalDecisions.CrystalReports.Engine;

namespace Test.Utilities
{
public class ReportFactory
{
protected static Queue reportQueue = new Queue();

protected static ReportClass CreateReport(Type reportClass)
{
object report = Activator.CreateInstance(reportClass);
reportQueue.Enqueue(report);
return (ReportClass)report;
}

public static ReportClass GetReport(Type reportClass)
{

//75 is my print job limit.
if (reportQueue.Count > 75) ((ReportClass)reportQueue.Dequeue()).Dispose();
return CreateReport(reportClass);
}
}
}


I receive this error: Unable to cast object of type 'CrystalDecisions.CrystalReports.Engine.ReportDocument' to type 'CrystalDecisions.CrystalReports.Engine.ReportClass'.


# re: Maximum report processing jobs limit issue in Crystal Report 5/20/2009 6:02 AM Mike Smotkin
Replace ReportClass with your Report Object (Class) name.

# re: Maximum report processing jobs limit issue in Crystal Report 7/1/2009 5:59 AM Erisa Dervishi
Hello,
I'm facing the same problem. I have developed an Asp.NET application in Visual Studio 2005. The reports are built in crystal reports XI. I have a lot of reports and each report have many subreports. That's why that very often i get the error mentioned here (Maximum report processing jobs limit issue ). I tried to add the ReportFactory class, I even close and dispose the reports and I also changed the value of the registry key, print job limit to 400, but none of those methods works. I'm really desperate now.
Did any of you find the appropriate solution after writing here? If so, can you send me any suggestion?

PS: To Paulo Gonçalves : You have written here that you found a different solution, but the link you provided isn't available anymore. Can you send me your solution?

Thanks to all!

# re: Maximum report processing jobs limit issue in Crystal Report 8/20/2009 5:43 AM Pashtet
Hi, all.
I just rewrite ExportToHttpResponse method:
private void MyExportToHttpResponse(ReportDocument AReport, ExportFormatType AFormatType, HttpResponse AResponse, string AAttachmentName)
{
try
{
Stream inputStream = AReport.ExportToStream(AFormatType);
AReport.Close();
AReport.Dispose();
AResponse.Clear();
SharedUtils.SetResponseContent(AResponse, AFormatType, true, AAttachmentName);
SharedUtils.WriteToResponse(AResponse, inputStream, true);
}
catch (Exception ex)
{
throw ex;
}
}

# re: Maximum report processing jobs limit issue in Crystal Report 9/30/2009 1:59 AM Rahul
Hi,
do we have to create a class for the above code & if we prepare class for that then how to access that class in aspx page. please help me out to solve this problem.

# re: Maximum report processing jobs limit issue in Crystal Report 10/5/2009 6:40 AM çağlar akbıyık
use it ;

protected void CrystalReportViewer1_Unload(object sender, EventArgs e)
{
rp.Close();
rp.Dispose();
}

But DONT FORGET-> open the Unload mode from events..

# re: Maximum report processing jobs limit issue in Crystal Report 10/13/2009 9:15 AM Eugenio
You have to make sure your disposal code has a chance to execute. If your code catches an error your disposal code may never be executed, use wisely the try-catch-finalize blocks. Sometimes the Page_unload event is not applicable, in example if you are generating the report from a Generic Handler (ashx). You just have to destroy the objects in a finalize block at the end of your code. Just make sure to check if the object you are disposing are set. An error cound be thrown before the objects got initialized and you will try to dispose an unexisting object.
RESTART IIS. If you already got the error, your counters are already at the limit, restarting IIS you'll force the disposal of any previous object to be performed and the counters will start from zero.

# re: Maximum report processing jobs limit issue in Crystal Report 11/13/2009 5:36 PM charlie
hey guys, I have implemented some of the ideas presented here, and they look great, the memory of the RAS (for crystal XI R2) is behaving cool, because of the close() dispose() etc...

however, I tried stressing my RAS by means of running multiple reports from different computers (9 computers, 3 reports each)...as I stated before the memory usage in the RAS is not the issue...

but an error keeps showing (after runing it around 5 minutes):

system.runtime.interopservices.comexception server agent has timed out

I have my PrintJobLimit set to -1...I have the condition to when deQueue when the queue.count is > 250....

but I keep getting this error...

has anyone seen that error before?
any idea of how to fix it?


P.S. I dont have to do an IIS RESET or restar the service in the RAS server...I just refresh the page and I can keep on running the reports...until once again I get the error....



# davetiyedavetiye sözleri 11/20/2009 3:10 AM davetiyeci
düğün davetiyesi ve davetiye sözleri

Post A Comment
Title:
Name:
Email:
Website:
Comment:
Verification: