cancel
Showing results for 
Search instead for 
Did you mean: 

Cannot delete reports, unless I close and open Eclipse/Tomcat

Former Member
0 Kudos

Please can someone help me.

I cannot delete reports. I have not worked out all the details yet but this is what I got so far...

First I thought it was a problem with my tomcat setup, I would deploy my WAR and run the app. After

viewing the report and closing the browser. I would not beable to delete the rpt file until I close Tomcat.

I have now got a similar problem within Eclipse. (as far as I can tell its the same problem but even worse)

If i create any report and design it or even a new blank report. And not do anything to it, just save it as a blank report. I then try delete the

report. Right click and then delete.

After a few seconds Eclipse brings up an error and says it cant delete the file, the reason it gives is


Problems encountered while deleting resources.
  Could not delete 'C:\WorkSpace\Project\WebContent\Report1.rpt'.
    Problems encountered while deleting files.
      Could not delete: C:\WorkSpace\Project\WebContent\Report1.rpt.

I have tried creating a fresh new project and only one report. And I still get the error.

If I try delete the whole project perminatly it also gives the same error. (But deletes the default crystal report)

I have to close Eclipse and then open it again before I can delete the rpt files properly.

I have not always had this problem. It used to work fine (dont ask what I have done since

cause I would not beable to tell, sorry)

Hopefully someone can help me, as this is driving me insane, and having to stop and start Tomcat every

time I want to deploy a new test version is not really an option.

Cheers

Darren

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Thanks Jitan Vyas for inadvertantly giving me the solution

Former Member
0 Kudos

This is a known issue in earlier versions of Crystal Reports for Eclipse. Part of the requirements of changing a report in Eclipse was that you had to stop Tomcat before doing so, clean the project cache, and restart Tomcat. This was more to do with the Eclipse project than with the JRC itself.

If you are finding that you are unable to delete the report after viewing it, the application server probably still has a handle to the report source. Do you put your report source in session? If so, make sure you kill and clean up the session when you are done viewing the report.

That all being said, I have found that if I am going to redeploy a report in my JRC app, it is best to stop Tomcat before I do. This cleans up all of the report source objects in memory, and ensures that when the new report is added and the application is started that it will grab the latest version of the report.

Former Member
0 Kudos

Hi Merry,

Thanks for getting back to me.

My reports within Eclipse seem to be behaving themselves now and dying gracefully without and hassles,

so I dont know what fixed that problem as I have not made any changes or done any updates. One of

those things I guess.

With regards to TOMCAT still having a handle on the reports, As far as I am aware I am putting the

report source in session

Below is my JSP that loads the report

I store report name in session via a servlet and set all the DB connection details in the servlet also.


imports....

try {

   String reportName = session.getAttribute("Report").toString();
   ReportClientDocument clientDoc = (ReportClientDocument) session.getAttribute(reportName);

   if (clientDoc == null) {
      clientDoc = new ReportClientDocument();
			
      // Open report
      clientDoc.open(reportName, OpenReportOptions._openAsReadOnly);
		
      // ****** BEGIN LOGON DATASOURCE SNIPPET ****************  
      {
         //Call the process to set all the database detail retrieved from web.xml
         // Custom function to set the connection details
         ReportFunctions.setConnection(clientDoc); 
      }
      // ****** END LOGON DATASOURCE SNIPPET **************** 		

      // Store the report document in session
      session.setAttribute(reportName, clientDoc);
   }
				
   // ****** BEGIN CONNECT CRYSTALREPORTPAGEVIEWER SNIPPET ****************  
   {
      // Create the CrystalReportViewer object
      CrystalReportViewer crystalReportPageViewer = new CrystalReportViewer();

      //set the reportsource property of the viewer
      IReportSource reportSource = clientDoc.getReportSource();				
      crystalReportPageViewer.setReportSource(reportSource);

      // set viewer attributes
      crystalReportPageViewer.setOwnPage(true);
      crystalReportPageViewer.setOwnForm(true);
      crystalReportPageViewer.setDisplayGroupTree(false);
      crystalReportPageViewer.setHasToggleGroupTreeButton(false);
      crystalReportPageViewer.setHasPrintButton(false);
      crystalReportPageViewer.setEnableDrillDown(false);

      // Process the report
      crystalReportPageViewer.processHttpRequest(request, response, application, null); 

   }
   // ****** END CONNECT CRYSTALREPORTPAGEVIEWER SNIPPET ****************		
		

   } catch (ReportSDKExceptionBase e) {
    out.println(e);
}

So far its very basic.

How best can I kill and clean up once the web page is closed. I have tried a few options but dont seem to

know the best way,

I tried "onbeforeunload" but I dont know if this is the best practice,

I have a session listener with sessionDestroyed but have not learnt how to envoke this correctly, or atleast when to correctly call it. And then I dont know how to clean out any loaded reports from here.

I have used

request.getSession().invalidate();

at the end of my JSP but that destoys everything everytime a user does anything on the page, (selecting any of the buttons on the report)

I am still learning everyday, and so I appoligise for questions that I should really know, am being pushed into the deep end here so trying my best :).

Thanks again.

Cheers

Darren

---

Sorry for bumping this back the list, but I am at my wits end as how best to "clean out" the reports

once they have been closed or timed out.

Surely there must be a way to release all objects (be it a actaul rpt file or the classes12.jar) once the

reports have been viewed and closed.

Even if there is something I can load via another servlet that destroys anything that has to do

with the main website.

Thanks and again sorry for moving this back up the list. If i get no replies, ill assume this is impossible

and that the only way to upload a new version of a report is to shut the whole Tomcat service and

make the changes.

Cheers

Edited by: Darren Jackson on Dec 3, 2008 12:31 PM

Former Member
0 Kudos

EXCELLENT,

Right if anyone cares, I have solved the problem, with some help from Jitan Vyas who was helping

someone else in another topic.

The answer lies in the timeout setting in CRConfig.xml

I had mine set to 0 thus the reports never timed out.

I set it to 2 minutes and now I can delete the reports without shutting down Tomcat.

Thanks so much Jitan for helping me with out knowing