• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Getting filenotfoundexception when trying to preview generated pdf file in DEV server

 
Raghu Sundar
Ranch Hand
Posts: 40
Chrome Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am generating a pdf report by reading a jrxml file.The pdf report is read and displayed as a repview in the browser.When i deploy the war file in my local and try to do this operation it is working fine.But when i try to do the same in the DEV server it is throwing filenotfound exception.

The structure of my deployed app in tomcat directory is apache-tomcat-6.0.29\webapps\lpsr\reports where i am storing my reports in reports directory.

My pdf previewing code snippet is as below



generateReport method from where report gets generated



As i mentioned before it is working fine in local environment but in DEV server it is throwing

java.io.FileNotFoundException: /app/tomcat/tomcat-inst1/tomcat-current/webapps/lpsr/reports/generalCoverageReport.pdf (No such file or directory)

and stacktrace is pointing to input = new BufferedInputStream(new FileInputStream(file), DEFAULT_BUFFER_SIZE); in generatePreview method.

I am not able to figure out reason for this and right now i cannot view server log.

Please help me to solve this issue.Thanks in advance.
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
First, the obvious question: does that file exist? Your next step should be to look at the server logs, before you know what happened this is just wandering in the dark. I could imagine several reasons why creating the file didn't work, like the account under which Tomcat runs not having permissions for that directory, or there being a security manager in place that prevents it, etc.

By the way, you should get in the habit of flushing and closing output streams when you're done with them, e.g. the "output" stream.
 
Tim Holloway
Saloon Keeper
Pie
Posts: 18226
53
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I hope you are not attempting to generate the actual reports in a directory within the WAR.

Because that is a blatant violation of J2EE architecture and will fail outright on some servers and servers where exploded wars are not enabled.

Aside from that, however, why is this question in the JSF forum? If you are generating a PDF and attempting to jam it out via the JSF output stream, you're going to have a bad time. JSF is already doing things with that stream.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic