File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes I/O and Streams and the fly likes Issue in saving XML data to 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 » I/O and Streams
Bookmark "Issue in saving XML data to file" Watch "Issue in saving XML data to file" New topic
Author

Issue in saving XML data to file

Senthamarai Prabhu
Greenhorn

Joined: Apr 16, 2009
Posts: 3
Hi,

I have method to write the XML Document to the file, Which is shown below



I am getting the following exception occasionally

java.io.FileNotFoundException: D:\data.xml (Access is denied)
at java.io.FileOutputStream.open(Native Method)
at java.io.FileOutputStream.<init>(Unknown Source)
at java.io.FileOutputStream.<init>(Unknown Source)


I used to call this method multiple times, 10% of times I used to get this exception

Please help to resolve this issue

Thanks
S Prabhu

S Prabhu
Greg Charles
Sheriff

Joined: Oct 01, 2001
Posts: 2771
    
  10

FileOutputStream.open() will throw a FileNotFoundException in various situations. The most likely causes are the file exists, but is read only, or the path is inaccessible.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Issue in saving XML data to file
 
Similar Threads
stackOverFlow with XMLWriter.write
Is there a java API to generate xml with an inline schema definition
XSL-FO Multiple Page Sequences
Writing XML File - Null Pointer Exception
NoClassDefFoundError while using iText