Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Strange java.io.FileNotFoundException: error

 
Kartick Srinivas
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A java listener process is running on unix server. This java listener process listens to a MQueue. When a message is received by the queue, it is passed on to the java listener process. The java process stores the message to a file in the input directory and calls a db procedure by passing the file name. The db procedure then processes it creates an acknowledgement file in the output directory and passes the ack file name back to java process. Then the java process reads the contents of the file and sends it to another MQueue. If any of the steps fail in between, the process calls the another db procedure with the error message as parameter and the procedure generates a fail acknowledgement file in the output directory and passes the fail ack file name back to java process. Then the java process reads the contents of the file and sends it to another MQueue.
The process also writes each and every step in the logger.

This listener process has been running successfully for more than two months with no issues. But for the past two days, for some messages from MQueue (say 4 out of 20), the listener fails to store the message to an input file (java.io.FileNotFoundException) and hence calls the db procedure to generate fail acknowledge message. Then, the java process is not able to read the fail acknowledgement file (java.io.FileNotFoundException). Above all this, it is not able to write the steps to the log file during this time. There is nothing in the log file for these 4 failed messages.

We checked the unix permissions for all these folders, everything is alright.

Any help would be appreciated.
 
Surendra Kumar
Ranch Hand
Posts: 236
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please post the file writing code snippet.
 
Kartick Srinivas
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Surender,

File inputFile = new File("/xxx/yyy/InputMessage_"+currentTimestamp+"_"+messageID+".xml");
inputFile.setReadable(true);
out = new FileOutputStream(inputFile);
out.write(messageContents);
out.close();
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic