I am finding a little untraceable issue in using POI package for reading and writing in to excel sheet. Basically my requirement is to read the excel templat and get some values which can be used as search keys to query and get the data from DB. And the results of DB select query will be written in the same excel temaplate in few cells.
Now, with one FileInputstream I am reading the file. Next by using one FileInputstream I am finding the where the result should be written and by using one FileOutputstream I am writing the file.
I did all the closing and flushing of streams proper.
Now, I am getting the filenotfoundexception at random point of executions. For example, if I am executing the read/write operation 50 times by using a loop, the error comes in 20 th time or 45th time or evn 5th time which is completely unpredictable and untraceable of what exactltly cause the error. Few times the complete execution happens successfully without any issues. Can any one of you please help me?