Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
Win a copy of OCP Oracle Certified Professional Java SE 11 Programmer I Study Guide: Exam 1Z0-815 this week in the Programmer Certification forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
  • Knute Snortum
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Ron McLeod
  • Carey Brown
  • Paweł Baczyński
  • Piet Souris
  • Vijitha Kumara

unable to read file from war file

Ranch Hand
Posts: 763
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

i'm trying to display report created using jasper report.

following is the code of my jsp which contains one button on click of that button my servlet is getting called

My Servlet code which will call the static method of java class

and following is my java class's method which is being called from servlet

ERROR on console

however i'm also packaging jrxml file in report folder

so my war file folder structure is as follows.

WAR file/report/*.jrxml files....

but i am still getting the IO error... any perticular reason begind it ???
[ April 13, 2007: Message edited by: Bear Bibeault ]
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can not do normal disk I/O from applications that are running from packed war files.

You'll need to either figure out how to get your container to unpack the war file on deployment or use ServletContext.getResourceAsStream and figure out how to pass a stream to JasperReports instead of a file path.
Let me tell you a story about a man named Jed. He made this tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!