0

Trying to read a Xml file from webapps folder. I am using eclipse as IDE.Code is def dir = new File("webapps/WEB-INF/file.txt).
This works if I test this class from a main() but when I run it on Tomcat server it throws FileNotFoundException because it is trying find the file in Eclipse Installation Directory/webapps/WEB-INF/file.txt
Application is getting deployed at Tomcat installation directory.

Updated Code

def dir = this.class.getResource("webapps/WEB-INF/appEntryXslt/appEntryToSEGRequest")
dir.eachFileRecurse(FileType.FILES) { file ->
 //do something with the file
}

But this also did not work. I want to read all the files from a directory.

Himanshu Yadav
  • 13,315
  • 46
  • 162
  • 291
  • Also http://stackoverflow.com/questions/8710865/how-to-get-the-inputstream-to-configuration-file-lying-under-web-inf-folder-in-t?rq=1 – tim_yates Oct 02 '13 at 14:28
  • Also http://stackoverflow.com/questions/13112936/how-do-i-reference-a-file-that-is-placed-in-the-web-inf-folder-when-using-arquil has another option (moving the file into WEB-INF/classes) – tim_yates Oct 02 '13 at 14:33
  • @tim_yates Added updated code. I am not sure how would I read each file from `ResourceStream` – Himanshu Yadav Oct 02 '13 at 15:05

0 Answers0