File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Servlets and the fly likes unable to read file from war file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "unable to read file from war file" Watch "unable to read file from war file" New topic
Author

unable to read file from war file

Jigar Naik
Ranch Hand

Joined: Dec 12, 2006
Posts: 751
hi,

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 ]

Jigar Naik


Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

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.


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: unable to read file from war file
 
Similar Threads
tomcat connection
org.xml.saxSAXNotRecognEx
Unable to execute jar file....got following stack trace.
Problem with Jasper report
Unable to execute jar file....got following stack trace.