• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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

 
Ranch Hand
Posts: 40
Eclipse IDE Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Saloon Keeper
Posts: 27762
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Shiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic