0

I have a .war file intended for use in Tomcat. It uses poor practice to try and load files from within its own WEB-INF, for example:

DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
DocumentBuilder db = dbf.newDocumentBuilder();
document = db.parse("WEB-INF\\resources\\config.xml");

(Contrast the best practices here: File path to resource in our war/WEB-INF folder?)

Unfortunately, I cannot re-compile from source: I have to use the .war as is. The above lines fail, probably because my Tomcat is configured differently than the original author's Tomcat was.

How can I configure Tomcat so that the above code works? How can I change which folder Tomcat runs its jar files from so that the above lines are able to load the config file as intended?

Community
  • 1
  • 1

0 Answers0