Hello, I have recently started working as a junior
java developer and my first task was to create two reports from the database and send it to the management everyday. The application is in a Linux Server and my report generation was working fine until one day the Linux server was restarted and following was the error in the log file:
However, restarting
tomcat seems to solve the problem and the report started running fine again. I spoke to our Linux admin and he was not able to help . I tried to replicate this issue in our development environment and added the path of the reports to the log file to find exactly what is happening and following is what I have found:
This is the code for creating the report :
The name of the application is BusinessReportScheduler and the tomcat is installed under
BusinessReportScheduler/bin. We deploy our application through AzureDevOps and tomcat shutdown and restart is handled by the pipeline. Looking into the log file for the path where the report is created I found that whenever the tomcat is restarted , the report creation is working fine and is created in the following path :
/BusinessReportScheduler/bin/Complaints.xls and /BusinessReportScheduler/bin/Events.xls
However when the Linux server is restarted , its trying to create the report in the root of the linux server :
/Complaints.xls and /Events.xls and that is when it is failing throwing exception as we do not have write permissions in the linux server root:
[/code]
My solution is to create a folder under BusinessReportScheduler and then explicitly use the path of that folder to write the reports into. But can anyone please let me know why the code tries to create the reports in the root of the linux server when the server is restarted and why does it create the report under the bin folder when tomcat is restarted?
I am relatively new to programming so please don't mind is this is too naive.